Skip to content

paste: name the file in open and read errors - #15642

Merged
cakebaker merged 2 commits into
uutils:mainfrom
emirmrkaljevic:paste-filename-errors
Nov 4, 2026
Merged

cakebaker merged 2 commits into
uutils:mainfrom
emirmrkaljevic:paste-filename-errors

Conversation

@emirmrkaljevic

Copy link
Copy Markdown
Contributor

paste dropped the file name from open and read errors:

$ paste missing.txt
paste: No such file or directory        # GNU: paste: missing.txt: No such file or directory
$ mkdir sub; paste sub
paste: Is a directory                   # GNU: paste: sub: Is a directory

File::open(path)? and the reads in InputSource now add the name with map_err_context, quoted with maybe_quote like GNU's quotef ('sp ace.txt', while 007 and f.txt/ stay as typed). Stdin errors are unchanged.

Two tests: a missing file and a directory operand (the latter #[cfg(not(windows))]). Both fail on main and pass with the change.

Refs #15254 (the paste -s b.txt missing.txt and paste 'sp ace.txt' sub rows). This only fixes the message; GNU also keeps printing the lines it already read before the error, which is left for a separate change.

Found with behave, a tool that records a CLI's behavior and replays it against another implementation.

GNU prints 'paste: missing.txt: No such file or directory' and
'paste: sub: Is a directory'; uutils dropped the file name.
@sylvestre
sylvestre force-pushed the paste-filename-errors branch from 21622ec to 93e4da3 Compare October 27, 2026 09:21
@cakebaker
cakebaker merged commit dff1616 into uutils:main Nov 4, 2026
99 of 100 checks passed
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants