Repository navigation
csplit: seq 10 | csplit - 1 silently ignores EIO (tests/csplit/csplit-io-err.sh?) #9853
Description
Activity
It seems this is not
csplit-io-err.shtoo. @ChrisDryden Can you removeLD_PRELOAD?Are you saying to rewrite the test to not use LD_PRELOAD? From initial investigation I think the easier adapting is to have a wrapper for fwrite. I have modified the test to work with write but it appears there is still an underlying issue that needs to be fixed.
- Are you saying to rewrite the test to not use LD_PRELOAD?Yes. I want to avoid having patches/sed hacks at downstream if possible (or keep upstreamable form).
I'll see if they're open to the idea of changing that test to be a symlink to /dev/full since that would give the error code. Have you gone through the process of proposing changing the tests, I have an example new test that would cover the same cases but I'm not familiar with how open they are to update the tests?
#!/bin/sh # Ensure we handle i/o errors correctly in csplit # Copyright (C) 2015-2025 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. . "${srcdir=.}/tests/init.sh"; print_ver_ csplit if ! test -w /dev/full || ! test -c /dev/full; then skip_ '/dev/full is required' fi # Ensure error messages are in English LC_ALL=C export LC_ALL # Get the wording of the OS-dependent ENOSPC message returns_ 1 seq 1 >/dev/full 2>msgt || framework_failure_ sed 's/seq: write error: //' msgt > msg || framework_failure_ # Create the expected error message { printf "%s" "csplit: write error for 'xx01': " ; cat msg ; } > exp \ || framework_failure_ # Create symlink so xx01 writes to /dev/full (triggers ENOSPC) ln -s /dev/full xx01 || framework_failure_ # Split the input - xx00 succeeds (empty), xx01 fails # the 'csplit' command should fail with exit code 1 seq 10 | returns_ 1 csplit - 1 4 2>out || fail=1 # Ensure we got the expected error message compare exp out || fail=1 Exit $failI think
csplit: write error for 'xx01'is difficult to repro by symlink.I think its only because we have an issue with our implementation, let me publish my draft branch and it works with the symlink test too
- Can we see write error with gnu/csplit with symlink instead of no spce or I/O error?
I think #9855 addresses that? Let me create the commands you can run to validate that this matches the gnu implementation
Fixed. Thankyou. It would be nice to use the word "Fixes ISSUE_TAG" at next PR.
As similar with #9832 ,