athityakumar / athityakumar/colorls

Cannot list directory with broken symlink over sshfs with follow_symlinks

Open
#473 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Ruby
Stars
5.1k
Forks
396
PR merge metrics
No merged PRs in 30d

Description

### Description

I have a small homeserver with an external raid hdd that i can switch on and off per shellscript. Mostly they are switched off but i still have a symlink to the /run/media/.... folder where the mounted raid5 will appear.

On the server the symlink to a yet non existing directory is no problem:
`raid5 -> /run/media/bosco/raid5`

over sshfs (with the follow symlinks option: `sshfs -o follow_symlinks ....`) ls -l shows an error but still shows all other directories and files including the folder and just marks the name red with black background in color mode :
```
$ls
ls: cannot access 'raid5': No such file or directory
?????????? ? ? ? ? ? raid5
drwxrwxr-x 1 user users 4096 Mar 20 2019 otherokdir
```

but colorls just aborts with an error and wont even show files or folders besides the broken raid5 symlink:
```
$colorls
.: No such file or directory @ rb_file_s_lstat - ./raid5
```

For example other programs such as the GUI nautilus file explorer work too. It just doesn't show these broken "folders" but at least shows all the other files and folders in the directory.

Of course it would be cleaner to cleanup those links on unmount and recreate them on mount and im just lazy (sry ;) ), however for whatever reason a folder is broken like this and its stats/type can't be read, aborting completly and ignoring the 'ok' files and folders besides it seems wrong and stops me from using colorls as a default.

- Relevant Issues : (none)
- Relevant PRs : (none)
- Type of issue :
- [ ] Installation
- [ ] Font-related
- [ ] Feature request
- [x] Bug in existing feature
- [ ] Developer mode : Code quality / Tests / Documentation

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by running colorls over sshfs with follow_symlinks in a directory containing a broken symlink and other entries. Trace the directory-listing and file-stat handling, then verify that an unreadable or broken symlink is reported without aborting the rest of the listing.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.