Page MenuHomeFreeBSD

env: Add an option to change the directory.
ClosedPublic

Authored by des on Tue, Oct 8, 10:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 5, 3:31 AM
Unknown Object (File)
Sat, Oct 19, 8:15 PM
Unknown Object (File)
Tue, Oct 15, 7:37 AM
Unknown Object (File)
Sun, Oct 13, 5:33 AM
Unknown Object (File)
Thu, Oct 10, 7:58 AM
Unknown Object (File)
Tue, Oct 8, 11:23 PM
Unknown Object (File)
Tue, Oct 8, 5:21 PM
Subscribers

Details

Summary

This mirrors the equivalent option in GNU coreutils env, but does not
add support for long options.

Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Tue, Oct 8, 10:07 AM

We'll need to update the manual page as well. I could do that :)

usr.bin/env/env.c
72–73

Any reason to keep it on one line?

96

What happened here?

194

Could we have it a bit more descriptive like "failed to change directory to %s" or something along those lines? Or does it attempt to follow what gnu env does?

usr.bin/env/tests/env_test.sh
125

Could you also add a negative test?

incorporate review feedback

des marked 3 inline comments as done.Tue, Oct 8, 11:06 AM

Thanks!

The manual page update and release notes may go in another revision.

This revision is now accepted and ready to land.Tue, Oct 8, 11:09 AM

Doh! The manual page had completely slipped my mind...

des added a reviewer: manpages.
des edited the summary of this revision. (Show Details)
des removed a reviewer: manpages.

Update the manual page + error if -C or -P but no utility

This revision now requires review to proceed.Tue, Oct 8, 11:50 AM
bcr added a subscriber: bcr.

OK for the man page change.

This revision is now accepted and ready to land.Tue, Oct 8, 12:25 PM
0mp requested changes to this revision.Tue, Oct 8, 1:18 PM

2 minor requests. Otherwise, the manual change looks OK.

usr.bin/env/env.1
516

-C should join this list. A note saying that it attempts to match GNU's behavior can be considered.

522

Would be nice to note what's the earliest release to feature -C.

This revision now requires changes to proceed.Tue, Oct 8, 1:18 PM
des marked 2 inline comments as done.Tue, Oct 8, 1:48 PM
des marked an inline comment as done.Tue, Oct 8, 1:52 PM
des added inline comments.
usr.bin/env/env.c
96

The strdup() is unnecessary and unchecked. I could either remove it or add a NULL check. Removing it was easier.

des marked an inline comment as done.Tue, Oct 8, 1:52 PM
This revision is now accepted and ready to land.Tue, Oct 8, 2:01 PM
This revision was automatically updated to reflect the committed changes.