Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception throw when listing non readable files #74

Closed
1 task done
Boomatang opened this issue Jul 12, 2023 · 0 comments · Fixed by #75
Closed
1 task done

Exception throw when listing non readable files #74

Boomatang opened this issue Jul 12, 2023 · 0 comments · Fixed by #75
Assignees
Labels
🛠 goal: fix Bug fix 🖥️ os: linux Specific to GNU/Linux 🟨 priority: medium Not blocking but should be fixed soon 🐛 versioning: patch Patch version bump, associated with bug fix

Comments

@Boomatang
Copy link
Contributor

Description

Exception is throw when trying to list directories that the user has not access to view.

Reproduction

Create the temporary files

mkdir /tmp/test
touch /tmp/test/test

sudo chown -R root:root /tmp/test
sudo chmod -R 400 /tmp/test

Checkout from ls

ls /tmp/test

ls: cannot open directory '/tmp/test': Permission denied`

When trying the same with pls an exception is throw.

pls /tmp/test

Traceback (most recent call last):
  File "/home/boomatang/.local/bin/pls", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/boomatang/.local/pipx/venvs/pls/lib64/python3.11/site-packages/pls/main.py", line 160, in main
    node_specific_init(node, cli_prefs)
  File "/home/boomatang/.local/pipx/venvs/pls/lib64/python3.11/site-packages/pls/main.py", line 64, in node_specific_init
    state.state.setup_git(node)
  File "/home/boomatang/.local/pipx/venvs/pls/lib64/python3.11/site-packages/pls/globals/state.py", line 120, in setup_git
    self.git_root = get_git_root(directory)
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/boomatang/.local/pipx/venvs/pls/lib64/python3.11/site-packages/pls/fs/git.py", line 73, in get_git_root
    proc = exec_git(
           ^^^^^^^^^
  File "/home/boomatang/.local/pipx/venvs/pls/lib64/python3.11/site-packages/pls/fs/git.py", line 52, in exec_git
    proc = subprocess.run(
           ^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib64/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: PosixPath('/tmp/test')

Expectation

Would have expected a better error message.

Screenshots

Environment

  • Device:
  • OS: Fedora 38
  • Browser:
  • Version: 5.4.0
  • Other info:

Additional context

Resolution

  • 🙋 I would be interested in resolving this bug.
@Boomatang Boomatang added 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 🛠 goal: fix Bug fix labels Jul 12, 2023
@dhruvkb dhruvkb added 🟨 priority: medium Not blocking but should be fixed soon 🐛 versioning: patch Patch version bump, associated with bug fix 🖥️ os: linux Specific to GNU/Linux and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠 goal: fix Bug fix 🖥️ os: linux Specific to GNU/Linux 🟨 priority: medium Not blocking but should be fixed soon 🐛 versioning: patch Patch version bump, associated with bug fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants