Page MenuHomeFreeBSD

Add support for -0 to env(1)
ClosedPublic

Authored by jrm on Nov 3 2019, 5:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 19, 9:46 AM
Unknown Object (File)
Jan 7 2024, 10:37 PM
Unknown Object (File)
Nov 15 2023, 1:04 PM
Unknown Object (File)
Nov 10 2023, 9:03 AM
Unknown Object (File)
Nov 9 2023, 1:07 AM
Unknown Object (File)
Nov 8 2023, 10:41 PM
Unknown Object (File)
Nov 8 2023, 10:30 AM
Unknown Object (File)
Nov 7 2023, 7:07 AM
Subscribers

Details

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27325
Build 25578: arc lint + arc unit

Event Timeline

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 added a subscriber: kevans.

Straight forward enough!

This revision is now accepted and ready to land.Nov 3 2019, 11:20 PM

Ignore command when -0 is supplied.

This revision now requires review to proceed.Nov 4 2019, 12:59 AM

Remove accidental change to diff.c.

Attempt #2 for whitespace fix

usr.bin/env/env.c
126

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

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

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

usr.bin/env/env.c
126

what's a 125?

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.

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.

#define exit codes used by genv

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

This revision is now accepted and ready to land.Nov 6 2019, 2:53 PM

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

usr.bin/env/env.1
34

date :)

This revision was automatically updated to reflect the committed changes.