Repository navigation
Conversation
Everyone who uses a shell knows that `exit` leaves it, so "exit to come back" said nothing new, and made the line read unlike `confine`'s.
What the commands said on stderr was in many forms: the system's errors
capitalized, with Rust's "(os error 17)", and ours in lowercase; paths
made absolute, often in the temporary directory, whatever was typed; a
taken name said as the base being there, not the fork; argh's errors with
no command name and a blank line; and conflicting options explained at
length.
Now everything is `prog: subject: problem`, on one line, in lowercase:
fsfork: p.x: file exists
fsfork: p.x: its base .p.x.base is left over; remove it
fsfork: nope: no such file or directory
fsdiff: .: not a fork: no .p.base next to it
confine: nosuchcmd: command not found
A path is as it was typed, or, if made by the command, as it would be
typed from the working directory. `forked to` still says where the fork
is in full, as it is said once, and the command then runs elsewhere.
Wrong arguments are said with how to give them:
fsfork: -n cannot be given with a fork
usage: fsfork [--no-ignore] [--print] [-n name] [dir [fork]]
`confine` looks for the command before running it, and before forking,
so that one that is not there is said to be not found, exits 127 as the
man page says, and leaves no fork, rather than being reported by
`sandbox-exec` with 71. On Linux, the Landlock error no longer says
"confine" twice. The warning when git cannot tell what is ignored is
said by the command that forked, `confine` too, with the first line of
git's error.
The forms are kept in `fsfork::message`, which the three share.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unifies what the three tools print: errors, warnings, status lines and usage. Each had grown its own shape; now every message is
prog: subject: problem, on one line, in lowercase, so that people and agents can read it, and it is still as short as a UNIX tool's.fsfork: /private/…/.p.x.base: File exists (os error 17)fsfork: p.x: file existsfsfork: p.x: its base .p.x.base is left over; remove itfsfork: nope: No such file or directory (os error 2)fsfork: nope: no such file or directoryfsfork: /private/…/p/a: not a directoryfsfork: p/a: not a directoryfsdiff: /abs/p: no base at /abs/.p.base; is it a fork?fsdiff: .: not a fork: no .p.base next to itUnrecognized argument: --bogus, a blank line,Run fsfork --help for more information.fsfork: unrecognized argument: --bogusand the usage lineconfine: --rm removes a fork, and -d runs the command without oneconfine: --rm cannot be given with -d, which makes no forkand the usage linesandbox-exec: execvp() of 'nosuchcmd' failed: …, exit 71confine: nosuchcmd: command not found, exit 127confine: confine needs Landlock, …confine: Landlock is not available; it needs Linux 5.19 or later(os error N), so that it matches our own text.p.x, or../turso.1.forked tostill gives the full path, because the fork is named only there, and the command then runs somewhere else.confinelooks for the command first. A command that isn't there now exits 127, as the man page says, and is checked before forking, so it leaves no fork. A path with a/in it is looked for in the directory the command runs in.confineit now saysconfine:and notfsfork:. It shows only the first line of git's error.The message formatting lives in
fsfork::message, which all three commands share. The lib now depends onargh, for parsing.Stacked on #7, since it changes the same
fsfork.rs. Merge that first.Not changed
--helpoutput is still argh's (Usage:,Options:). It goes to stdout and isn't a message.cpduring a fork are passed through ascpprints them.Testing
cargo testandcargo clippypass on macOS. New tests check exact stderr for usage errors in all three commands, for lowercase system errors with paths as typed, for taken names and left-over bases, and thatconfinesays a missing command is not found, exits 127 and makes no fork. CI covers Linux. The Landlock message hasn't been seen on a machine without Landlock.