Page MenuHomeFreeBSD

env: Add an option to change the directory.
ClosedPublic

Authored by des on Oct 8 2024, 10:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 30, 1:11 AM
Unknown Object (File)
Fri, Nov 29, 11:13 PM
Unknown Object (File)
Nov 26 2024, 7:08 PM
Unknown Object (File)
Nov 24 2024, 8:42 AM
Unknown Object (File)
Nov 22 2024, 11:52 PM
Unknown Object (File)
Nov 22 2024, 11:08 PM
Unknown Object (File)
Nov 21 2024, 2:29 AM
Unknown Object (File)
Nov 9 2024, 9:22 AM
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.Oct 8 2024, 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.Oct 8 2024, 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.Oct 8 2024, 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.Oct 8 2024, 11:50 AM
bcr added a subscriber: bcr.

OK for the man page change.

This revision is now accepted and ready to land.Oct 8 2024, 12:25 PM
0mp requested changes to this revision.Oct 8 2024, 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.Oct 8 2024, 1:18 PM
des marked 2 inline comments as done.Oct 8 2024, 1:48 PM
des marked an inline comment as done.Oct 8 2024, 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.Oct 8 2024, 1:52 PM
This revision is now accepted and ready to land.Oct 8 2024, 2:01 PM
This revision was automatically updated to reflect the committed changes.