Commit Graph
58 Commits
Author SHA1 Message Date
oech3andSylvestre Ledru a972eee8ab test_env: Make argv0 tests compatible with Ubuntu patch 2026-02-20 23:30:00 +01:00
Etienne CordonnierandGitHub e4e95a7c74 env: fix "--ignore-signal=PIPE" (#9618)
- revert https://github.com/uutils/coreutils/pull/9614 because `Command::exec()` resets the default signal handler for SIGPIPE, interfering with the option `--ignore-signal=PIPE`
- add regression-test for --ignore-signal=PIPE

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2026-02-09 15:33:43 -08:00
mattsuandGitHub c0b96841d7 env:Improve GNU coreutils Compatibility & Fix env-signal-handler.sh Test (#9465)
* feat(env): add signal handling options and logging

- Add default-signal, block-signal, and list-signal-handling options
- Support specifying, tracking, and reporting signal handling changes
- Update en-US and fr-FR locales to document new signal options

* feat: Add `__ALL__` signal option, improve signal argument parsing, and prevent ignoring uncatchable signals.

* fix: Preserve inherited SIGPIPE behavior using `RUST_SIGPIPE` environment variable and `uucore`'s new handler.

* style: reformat code, reorder imports, and remove trailing blank lines

* chore: update spell-checker ignore lists for technical terms

Added 'Sigmask' to ignore list in env.rs and 'sighandler' in test_env.rs to suppress false positives from spell-checker on legitimate specialized words.

* fix(env): Skip invalid signals instead of failing

Previously, the signal handling functions (`apply_default_signal`, `apply_ignore_signal`, and `apply_block_signal`) would return an error if `signal_from_value` got an invalid signal. This change modifies the code to skip invalid signals and continue processing, aligning with GNU env's behavior of ignoring undefined signals on certain platforms where `ALL_SIGNALS` may include invalid values. This improves compatibility and robustness.
2025-12-27 00:16:36 +01:00
Christopher Dryden 5d4abd88e9 env: preserve non-UTF-8 environment variables 2025-12-19 16:09:57 -05:00
Chris DrydenandGitHub b4423b9691 Adding integration tests for the braced variable parsing in env (#9459)
* Adding integration tests for the braced variable parsing in env

* Adding missing spell checker words
2025-11-23 21:21:53 +01:00
Daniel HofstetterandGitHub eb6bfce7a9 Merge pull request #8551 from sylvestre/emoji-2
add more emoji tests
2025-09-05 11:28:38 +02:00
Sylvestre LedruandDaniel Hofstetter 23f3551e1c clap/locale: fix the colors for all programs (Closes: #8501)
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-09-05 08:25:59 +02:00
Sylvestre Ledru 3ed1f47de3 add more emoji tests 2025-09-03 22:39:21 +02:00
Daniel Hofstetter 30f300c52b clippy: fix "hiding a lifetime" warnings
from mismatched_lifetime_syntaxes lint
2025-08-07 16:12:03 +02:00
Sylvestre Ledru 576bd6f565 env: adjust to test after the improvement on the error message 2025-06-30 13:42:40 +02:00
Dan Hipschman 814e82ea4e env: ignore flags after the command or -- argument 2025-04-18 18:48:37 -07:00
Yuri Astrakhan a27880e8a3 chore: use assert_eq! and assert_ne! instead of assert!
Makes intent clearer, and if something fails, prints the values that caused the failure as part of the panic message.
2025-04-08 13:25:41 -04:00
Dorian Peron 5250b893a7 test(env): fix test_gnu_e20 for coverage run 2025-04-07 10:19:00 +02:00
ValentinBoudevinandGitHub aea23408fd env: Move to "thiserror" + added errors test case (#7584)
Solved Issue #7535 : Removed parse_errors to follow other commands standard with thiserror
2025-03-30 11:21:57 +02:00
Sylvestre Ledru a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +01:00
Sylvestre Ledru a85539f530 Run cargo fmt on the tree 2025-03-24 21:33:12 +01:00
Nicolas Boichat 7eb873c326 test_env: Try to execute an empty file instead of .
For some unclear reason, Android _now_ sometimes returns an
IsADirectory error, instead of PermissionDenied, when trying
to execute `.`.

Since this test really wants to test PermissionDenied, we try
to execute a file in the fixture instead, that doesn't have
exec permission.

Also, limit this test to Unix.

Fixes part of #7542.
2025-03-23 19:37:59 +01:00
Daniel Hofstetter df4dfea852 tests: replace run() with succeeds() or fails() 2025-03-09 16:53:56 +01:00
Sylvestre Ledru 18cb7dcf9e Use the new function fails_with_code
Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
2025-03-01 17:26:20 +01:00
sreehari prasadandGitHub c2505841e0 Tests: provides easy mount of temp fs (#7249) 2025-02-01 19:01:49 +01:00
danieleadesandGitHub 5d6a04ab71 Fix clippy warning manual_if_else (#7177)
and enable the rule
2025-01-23 22:49:13 +01:00
Sylvestre Ledru 58f6afdeb4 env: handle the error properly
instead of:
env: unknown error: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
2025-01-08 00:13:31 +01:00
jovie :)andGitHub 646fc394f6 env: don't allow '=' with -u (#7008)
* Added error handling to ensure '=' after -u returns 125 as '=' is not allowed

* Added tests for disallow = on short options

* Added error handling to ensure '=' after -u returns 125 as '=' is not allowed

* Added tests for disallow = on short options

* Disallow only short unset option from having '=' as its starting character

* Remove needless tests and update function name for clarity
2024-12-31 09:16:14 +01:00
Sylvestre Ledru a3a4457a44 clippy: spawned process is never 'wait()'ed on 2024-11-28 22:10:28 +01:00
Daniel Hofstetter ab9e5cb8a7 env: add missing cfg attributes to tests 2024-11-27 09:29:22 +01:00