Page MenuHomeFreeBSD

Add support for -0 to env(1)
ClosedPublic

Authored by jrm on Sun, Nov 3, 5:28 PM.

Details

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jrm created this revision.Sun, Nov 3, 5:28 PM
bcr accepted this revision as: manpages.Sun, Nov 3, 6:44 PM
bcr added a subscriber: bcr.

OK from manpages. Don't forget to bump the .Dd of the man page when you commit this content change.

kevans accepted this revision.Sun, Nov 3, 11:20 PM
kevans added a subscriber: kevans.

Straight forward enough!

This revision is now accepted and ready to land.Sun, Nov 3, 11:20 PM
jrm updated this revision to Diff 63914.EditedMon, Nov 4, 12:59 AM

Ignore command when -0 is supplied.

This revision now requires review to proceed.Mon, Nov 4, 12:59 AM
jrm updated this revision to Diff 63915.Mon, Nov 4, 1:01 AM

Remove accidental change to diff.c.

jrm updated this revision to Diff 63916.Mon, Nov 4, 1:04 AM

Whitespace fix

jrm updated this revision to Diff 63917.Mon, Nov 4, 1:07 AM

Attempt #2 for whitespace fix

swills added inline comments.Mon, Nov 4, 3:18 AM
usr.bin/env/env.c
126 ↗(On Diff #63917)

I think maybe this should call exit(), perhaps with a non-zero exit, perhaps with 125 instead.

jrm updated this revision to Diff 63927.Mon, Nov 4, 3:48 PM

Report and error and exit when -0 and command are specified together

jrm updated this revision to Diff 63928.Mon, Nov 4, 3:53 PM

Remove else {} since we are exiting when -0 and command are specified together

imp added inline comments.Mon, Nov 4, 3:56 PM
usr.bin/env/env.c
126 ↗(On Diff #63928)

what's a 125?

jrm added a comment.Mon, Nov 4, 4:49 PM

125 is the exit code used by genv. See https://github.com/coreutils/coreutils/blob/master/src/env.c#L899-L903 and https://github.com/coreutils/coreutils/blob/master/src/system.h#L90 Copying the coreutils exit codes seems to be what is currently happening based on the 126 and 127 exit codes. SYSEXITS(3) does say "According to style(9), it is not a good practice to call exit(3) with arbitrary values to indicate a failure condition when ending a program. Instead, the pre-defined exit codes from sysexits should be used, so the caller of the process can get a rough estimation about the failure class without looking up the source code." If SYSEXIT(3)/STYLE(9) is what we want to follow, then exit code 64 makes the most sense to me.

imp added a comment.Mon, Nov 4, 4:59 PM

It would be better to put

#define EXIT_CANCELED 125

and use that instead of the bare 125. I know we have other numbers elsewhere, but that's a good place to make this not a magic number.

jrm updated this revision to Diff 63948.Tue, Nov 5, 2:54 AM

#define exit codes used by genv

jrm added a reviewer: imp.Tue, Nov 5, 2:55 AM
bcr accepted this revision.Wed, Nov 6, 2:53 PM

I'm fine with the latest changes to the man page.

This revision is now accepted and ready to land.Wed, Nov 6, 2:53 PM
imp accepted this revision.Thu, Nov 7, 4:07 PM

These look good to me.
Thanks for integrating my feedback.

usr.bin/env/env.1
34 ↗(On Diff #63948)

date :)

This revision was automatically updated to reflect the committed changes.