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

tsort: show error if directory is specified #5853

Closed
cakebaker opened this issue Jan 17, 2024 · 3 comments · Fixed by #5860
Closed

tsort: show error if directory is specified #5853

cakebaker opened this issue Jan 17, 2024 · 3 comments · Fixed by #5860
Labels

Comments

@cakebaker
Copy link
Contributor

GNU tsort shows an error if a directory is specified and returns 1 as exit code:

$ tsort dir
tsort: dir: read error: Is a directory
$ echo $?
1

uutils tsort, on the other hand, doesn't fail:

$ cargo run tsort dir
$ echo $?
0
@mtimaN
Copy link
Contributor

mtimaN commented Jan 17, 2024

I cannot replicate this.

$ which tsort 
/usr/bin/tsort
$ tsort dir
$ echo $?
0

@SaHHiiLL
Copy link
Contributor

I cannot replicate this.

$ which tsort 
/usr/bin/tsort
$ tsort dir
$ echo $?
0

I can replicate this.

$ tsort $HOME/Downloads
tsort: Downloads: read error: Is a directory

Version

$ tsort --version
tsort (GNU coreutils) 9.4
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mark Kettenis.

@SaHHiiLL
Copy link
Contributor

This seems like a simple fix I can create a pr, path.is_dir() check and early return should fix and give the expected behavior.

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

Successfully merging a pull request may close this issue.

3 participants