Commit fd83181
authored
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 structure1 parent adc3c97 commit fd83181
File tree
10 files changed
+436
-20
lines changed- .vscode/cspell.dictionaries
- src/uu
- cat/src
- comm/src
- od/src
- tests/by-util
10 files changed
+436
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
16 | 29 | | |
17 | 30 | | |
18 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
11 | 24 | | |
12 | 25 | | |
13 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
| 522 | + | |
522 | 523 | | |
523 | 524 | | |
524 | 525 | | |
| |||
545 | 546 | | |
546 | 547 | | |
547 | 548 | | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
552 | 556 | | |
553 | 557 | | |
554 | 558 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
140 | 156 | | |
141 | 157 | | |
142 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
52 | 60 | | |
53 | | - | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
59 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
63 | 75 | | |
64 | 76 | | |
65 | 77 | | |
66 | 78 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
72 | 87 | | |
73 | 88 | | |
74 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
826 | 826 | | |
827 | 827 | | |
828 | 828 | | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
0 commit comments