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

ls: -L on broken links should return 1 #2928

Closed
jtracey opened this issue Jan 27, 2022 · 10 comments
Closed

ls: -L on broken links should return 1 #2928

jtracey opened this issue Jan 27, 2022 · 10 comments
Labels

Comments

@jtracey
Copy link
Contributor

jtracey commented Jan 27, 2022

ls is supposed to have an exit status of 1 for "minor problems". This includes trying to dereference symbolic links (via -L) when they don't link anywhere. The lack of return code is causing the latest tests/ls/selinux-segfault GNU test to fail.

@tertsdiepraam
Copy link
Member

The call that should return 1, according to the GNU test, is specifically:

ls -L -Z

We already return 1 with:

ls -L -l

Or any other case where we try to deference the a broken symlink. I believe (but am not sure) that the issue is that because the security context is not supported in the first place, we never get the metadata, so we don't show the error.

@kimono-koans
Copy link
Contributor

ls seems like it needs a meta-thread for its issues. Is OP implementing this?

@sylvestre
Copy link
Contributor

sure, please open as many issues as you need :)

@stale
Copy link

stale bot commented Jan 28, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 28, 2023
@jtracey
Copy link
Contributor Author

jtracey commented Jan 30, 2023

This is still an issue.

We already return 1 with:
ls -L -l
Or any other case where we try to deference the a broken symlink.

I'm still seeing ret code 0 with just ls -L for us, and ret code 1 on GNU.

@granquet
Copy link
Contributor

granquet commented Jun 8, 2023

I've looked into it and think I've solved the ls -L -Z issue.

Though with GNU coreutils 9.1, I see ls -L returns 0, which is aligned with the behaviour I see in uutils ?

@tertsdiepraam
Copy link
Member

uutils ls -L is returning 0 for me. Which case is incompatible exactly?

@granquet
Copy link
Contributor

granquet commented Jun 8, 2023

ls -L -Z

ls -L returns 0 on both, @jtracey seemed to imply that ls -L should return 1 too?

@tertsdiepraam
Copy link
Member

Ah sorry, I misread your comment. I think you're right!

@cakebaker
Copy link
Contributor

Fixed in #4960

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

No branches or pull requests

6 participants