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)
Thu, Nov 21, 2:29 AM
Unknown Object (File)
Sat, Nov 9, 9:22 AM
Unknown Object (File)
Thu, Nov 7, 5:40 AM
Unknown Object (File)
Thu, Nov 7, 4:44 AM
Unknown Object (File)
Thu, Nov 7, 4:41 AM
Unknown Object (File)
Thu, Nov 7, 4:33 AM
Unknown Object (File)
Thu, Nov 7, 2:57 AM
Unknown Object (File)
Tue, Nov 5, 3:31 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 59848
Build 56733: arc lint + arc unit

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.