Fix ls: panicking on dangling symlink with ``--color=auto -l``
fixes #6227
The get_metadata() function seemed to try to deference to the non existent file. We change it to directly get the metadata of the symlink itself incase the deference fails.
GNU testsuite comparison:
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Changes since last push :
- Changed the logic to use
let md_res = get_metadata_with_deref_opt(target.p_buf.as_path(), path.must_dereference);
let md = md_res.or(target.p_buf.symlink_metadata());
apply_style_based_on_metadata(path, md.as_ref(),ok(), ls_colors, style_manager, &name)
- Added test
GNU testsuite comparison:
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Changes since last push:
- Using
at.symlink_filefor symlink creation - Switched to regex matching for extracting colors from stdout
- Squashed the commit into an older comment formatting commit to clean up history .
I was wondering if i should clean up the commit history a bit more ? Maybe only leave two commits one for the main change and another for the test ?
GNU testsuite comparison:
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)