Bug #48912
ls -l in cephfs-shell tries to chase symlinks when stat'ing and errors out inappropriately when stat fails
0%
Description
ls -l in cephfs-shell tries to chase symlink targets when stat'ing. For example, from the kclient:
$ ls -l total 1 drwx------. 3 jlayton jlayton 6 Jan 18 08:29 crypt lrwxrwxrwx. 1 jlayton jlayton 5 Jan 18 08:36 testlnk -> crypt
...but if I do the same in cephfs-shell:
CephFS:~/>>> ls -l drwx------ 141 4447 4447 2021-01-18 13:29:38 crypt/ drwx------ 141 4447 4447 2021-01-18 13:29:38 testlnk
...the symlink shows up as a directory instead. The stat needs to use AT_NOFOLLOW_SYMLINKS, or lstat().
On a related note, ls -l also aborts if a stat comes back with an error. It should instead do what "real" ls does and display '?' characters in the relevant fields, and continue on. For example, from kclient:
[jlayton@client1 vstart]$ ls -l testlnk lrwxrwxrwx. 1 jlayton jlayton 3 Jan 18 08:40 testlnk -> foo
...but from cephfs-shell:
CephFS:~/>>> ls -l testlnk opendir failed: No such file or directory [Errno 2]
Related issues
History
#1 Updated by Patrick Donnelly about 3 years ago
- Source set to Development
- Labels (FS) task(easy) added
#2 Updated by Varsha Rao about 3 years ago
- Assignee set to Varsha Rao
#3 Updated by Varsha Rao about 3 years ago
- Status changed from New to Fix Under Review
- Pull request ID set to 39687
Actually cephfs-shell does not support symlinks. For now I have just modified 'ls' command to support it.
#4 Updated by Patrick Donnelly about 3 years ago
- Status changed from Fix Under Review to Pending Backport
- Target version set to v17.0.0
- Backport set to pacific
#5 Updated by Backport Bot about 3 years ago
- Copied to Backport #49685: pacific: ls -l in cephfs-shell tries to chase symlinks when stat'ing and errors out inappropriately when stat fails added
#6 Updated by Loïc Dachary almost 3 years ago
- Status changed from Pending Backport to Resolved
While running with --resolve-parent, the script "backport-create-issue" noticed that all backports of this issue are in status "Resolved" or "Rejected".