Commit Graph
40 Commits
Author SHA1 Message Date
AnthonyandGitHub 36ac85b1f3 tests: add WASI integration test support via wasmtime 2026-04-12 15:19:04 +02:00
Christopher DrydenandSylvestre Ledru dec633c0bd fix: cargo fmt and restrict /dev/full tests to Linux 2026-02-12 20:48:05 +01:00
Christopher DrydenandSylvestre Ledru d15e762a90 date,comm,tty: add integration tests for write error handling 2026-02-12 20:48:05 +01:00
Tuomas Tynkkynen a2715e1b00 comm: Properly handle I/O errors when reading input 2026-01-29 18:40:44 +02:00
b9372e509e Fixes #10192 - fix(comm): improve stdout handling and add test for lossy UTF-8 output (#10206)
* fix(comm): improve stdout handling and add test for lossy UTF-8 output

* run cargo fmt

* perf(comm): use BufWriter for buffered stdout output

Wrap stdout in BufWriter to improve performance and avoid
duplicate error messages, matching GNU comm behavior.

* fix: refactor write operations in comm to use a dedicated function

* comm: use translate!

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2026-01-20 16:38:10 +01:00
Martin KunkelandGitHub 75f45e87e5 comm: fix comparison when reading from pipes (#9545)
* comm: fix comparison when reading from pipes

Use case is that two files are piped into comm, i.e. in bash
   comm <(cat file1) <(cat file2)

Before the fix, comm reads from the pipes twice. Once in "fn comm" and
once in "fn are_files_identical". As such, part of the data is skipped
in comparison which leads to wrong output.

This is fixed by skipping the file comparison in case one of the files
is not a regular file.

* comm: add test for reading from pipes
2026-01-17 14:28:04 +01:00
Cả thế giới là RustandGitHub fd83181ac2 Fix EINTR handling in cat, od, and comm (#8946)
* fix: handle EINTR (signal interruptions) in cat, od, and comm

Add proper retry loops for ErrorKind::Interrupted in I/O operations
to handle signals like SIGUSR1 that can interrupt read/write calls.

This pattern is proven in production - identical to PR #6025 (merged
March 2024) which fixed dd's EINTR handling for GNU test dd/stats.sh.
The same pattern is already used in 9+ utilities (head, tail, tee, wc,
sort, sum, tr, shuf, dd) without issues.

Changes:
- cat: Fix write_fast() and write_lines() to retry on EINTR
- od: Fix PartialReader::read() in all three read paths
- comm: Fix are_files_identical() for both file readers
- tests: Add InterruptingReader/Writer test utilities

Historical context:
- Pattern validated by cre4ture's PR #6025 (dd EINTR fix)
- Matches existing implementations in dd/dd.rs:450,881
- POSIX best practice for signal-interrupted I/O

Fixes #1275

* fix: handle EINTR (signal interruptions) in cat, od, and comm

Add proper retry loops for ErrorKind::Interrupted in I/O operations to handle signals like SIGUSR1 that can interrupt read/write calls.

Pattern matches PR #6025 (dd EINTR fix) and is already used in 9+ utilities. Changes:
- cat: Fix write_fast() and write_lines() to retry on EINTR
- od: Fix PartialReader::read() in all three read paths
- comm: Fix are_files_identical() for both file readers
- tests: Add visible EINTR integration tests for CI

Addresses sylvestre's review feedback on code documentation and CI test visibility.

* style: apply cargo fmt formatting to EINTR changes

* test: fix EINTR integration test failures

- Fix comm test: use stdout_contains instead of stdout_only for tabbed output
- Fix od test: create new command instance to avoid 'already run this UCommand' error
- Remove unused imports and dead code to eliminate compiler warnings
- Both tests now pass without warnings or errors

* style: fix formatting and remove duplicate comment in od test

* ci: add EINTR and related technical terms to appropriate cspell dictionaries

- Add EINTR, eintr, nextest to jargon.wordlist.txt (technical/systems programming terms)
- Add SIGUSR, SIGINT, etc. to shell.wordlist.txt (POSIX signals)
- Add uutils, coreutils, ucmd, etc. to workspace.wordlist.txt (project-specific terms)
- Fixes CI cspell warnings for legitimate technical terminology
- Proper categorization follows existing dictionary structure
2025-10-26 13:59:47 +01:00
Daniel Hofstetter 14ba196a79 Cargo.toml: remove "test_unimplemented" feature 2025-10-19 11:41:14 +02: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
Sylvestre Ledru f0290e4754 clap: override the usage section 2025-08-13 14:15:55 +02:00
Luv-RayandGitHub fb2399f56b fix clippy (#8275)
* fix clippy

* update

* update
2025-06-27 09:15:24 +02:00
Sylvestre Ledru a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +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
Sylvestre Ledru b50a012d13 comm: implement the ordering check
A few comments:
* skip if the two args are pointing to the same file
* skip if the same content in the two files
* implement --check-order
* implement --nocheck-order
* output the right things on stderr

Should pass: tests/misc/comm
2025-01-18 09:22:41 +01:00
Sylvestre Ledru 4e45ca673c comm: don't use files for test 2025-01-15 16:13:51 +01:00
Sylvestre Ledru 0cae322dfa comm: generate an error if the input is a directory
tested by tests/misc/read-errors
2024-11-30 10:26:34 +01:00
Ben Wiederhake 884ef1f54b comm: implement and test correct handling of repeated flags 2024-03-23 23:35:40 +01:00
Ben Wiederhake 801edbbcb4 comm: implement and test correct handling of repeated --output-delimiter 2024-03-23 23:35:40 +01:00
Ben Wiederhake 1fa0b032e5 comm: permit and test separators that contain a hyphen 2024-03-23 23:35:40 +01:00
Sylvestre Ledru bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
Daniel Hofstetter 6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Daniel Hofstetter a7a55c7433 comm: allow multiple occurrence of -z 2023-03-02 16:18:42 +01:00
Daniel Hofstetter 0d782e09c1 comm: implement --zero-terminated 2023-03-01 16:59:51 +01:00