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

Inaccessible files and directories should be shown in the file listing #1359

Closed
jantatje opened this issue Jul 28, 2023 · 1 comment · Fixed by #1382
Closed

Inaccessible files and directories should be shown in the file listing #1359

jantatje opened this issue Jul 28, 2023 · 1 comment · Fixed by #1382

Comments

@jantatje
Copy link
Contributor

In some cases like on NFS the current user may not have permission to access or stat some directories. If you list them with ls they will be shown, but cannot be accessed. lf should not hide these directories.

example:
/etc/exports

/mnt            10.0.0.0/24(sec=krb5i,ro,fsid=0,no_subtree_check,async,sec=sys,all_squash)
/mnt/data       10.0.0.0/24(sec=krb5i,rw,no_subtree_check,async)
/mnt/backup     10.0.0.0/24(sec=krb5i,rw,no_subtree_check,async)
...

The first line allows mounting / both anonymously and authenticated via kerberos, the second and third lines exports other filesystems that can only be accessed as an authenticated user.

if you now mount with mount -o sec=sys servername:/ /mnt/nfs then ls -la output looks like this:

ls: cannot access 'data': Operation not permitted
ls: cannot access 'backup': Operation not permitted
total 12
drwxr-xr-x 6 root root 4096 Sep 10  2021 .
drwxr-xr-x 1 user user   68 Jul 28 17:52 ..
?????????? ? ?    ?       ?            ? backup
?????????? ? ?    ?       ?            ? data
drwxr-xr-x 2 root root 4096 Sep  9  2021 public
drwxr-xr-x 2 root root 4096 Sep 10  2021 public2

lf only shows the public and public2 directories.

The same can also happen on corrupted FAT filesystems.

@gokcehan
Copy link
Owner

@jantatje Thanks for reporting this. In general, I think this would be an acceptable change, though I'm not sure how this can be implemented. Maybe one could store some dummy values when there is a stat error and show question marks in the ui when there are such dummy values. There could be too many places in the code for these checks though, I'm not sure. If anyone want to give this a try, I think one could start with the stat error during readdir in nav.go.

jantatje added a commit to jantatje/lf that referenced this issue Aug 12, 2023
Implements a `fakeStat` struct with dummy values and stores the
error in `file.err`, then shows the error instead of FileInfo, if
the file is inaccesible.

Fixes gokcehan#1359
gokcehan pushed a commit that referenced this issue Aug 26, 2023
Implements a `fakeStat` struct with dummy values and stores the
error in `file.err`, then shows the error instead of FileInfo, if
the file is inaccesible.

Fixes #1359
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants