tee: exercise short writes through splice fallback - #14979
mattsu2020 wants to merge 3 commits into
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
acab138 to
40b6796
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
GNU testsuite comparison: |
| use uutests::new_ucmd; | ||
|
|
||
| #[test] | ||
| fn test_tee_short_writes_after_splice_fallback() { |
There was a problem hiding this comment.
This test was copy and pasted from GNU's test which is GPL3.
There was a problem hiding this comment.
I don't know any proper solution for this. Can we cause short-write without using strace (and contribute to GNU) under realistic situation?
There was a problem hiding this comment.
This test was copy and pasted from GNU's test which is GPL3.
@oech3 That’s quite a strong accusation to make. I’d suggest being more careful with your wording.
There was a problem hiding this comment.
What is strong? This is not a sentense to some specific people.
There was a problem hiding this comment.
@mattsu2020 Could you please make sure you’ve personally read and understood CONTRIBUTING.md, particularly the "AI policy" section?
There was a problem hiding this comment.
OK. It is much milder than my one.
There was a problem hiding this comment.
@mattsu2020 Could you please make sure you’ve personally read and understood
CONTRIBUTING.md, particularly the "AI policy" section?
I hadn't gotten around to checking the comparisons in the GNU coreutils source code.
I'll make sure to do that from now on.
40b6796 to
d6916fd
Compare
d6916fd to
a566a1d
Compare
a566a1d to
70f3f2d
Compare
Co-authored-by: oech3 <79379754+oech3@users.noreply.github.com>
| # strace only injects faults into traced calls. Include splice to force tee's | ||
| # stdout path to use read/write and exercise short-write retries. The | ||
| # replacement stops matching after the first edit, avoiding duplicate options. | ||
| sed -i 's/-e trace=write /-e trace=write,splice -e fault=splice /' \ |
There was a problem hiding this comment.
Does it mean splice fails only for fd=1 if --trace-fds=1 is given?
There was a problem hiding this comment.
Yes.
With --trace-fds=1, the fault injection applies only to splice calls operating on fd 1.
There was a problem hiding this comment.
That is OK. But I'd like to add test case with failure of splice for fd=0 at different PR. Both uses write_all, but they exist on different place.
There was a problem hiding this comment.
I’ll address it in a separate PR.
The GNU short-write check bypasses injected write faults through tee's splice path. Include splice in the trace filter and force stdout to use the read/write fallback with an idempotent test adjustment.
Add an independent Rust test using append mode and a file-size limit to exercise a real short write without strace, verify the retry reports the error, and check that stdout receives all input.
Refs #14981
The independent reproduction passes with strace 6.13 and 7.2. Linux tee tests (36) pass without strace; shell syntax, spelling, and repeated preparation pass. The GNU 9.12 test itself was not run locally.