help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash 5.3.x is causing fstests to output unexpected command line


From: Greg Wooledge
Subject: Re: Bash 5.3.x is causing fstests to output unexpected command line
Date: Thu, 4 Sep 2025 07:23:40 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Thu, Sep 04, 2025 at 10:53:04 +0930, Qu Wenruo wrote:
> It looks like it's related the ulimit handling.
> 
> I have created a minimal reproducer:
> 
> ```
> #!/bin/bash
> 
> # Change the dev/mnt to whatever you need
> dev="/dev/test/scratch1"
> mnt="/mnt/btrfs"
> 
> mkfs.btrfs -f $dev > /dev/null
> mount $dev $mnt
> ulimit -f 102400
> xfs_io -f -c "falloc 0 101m" /mnt/btrfs/foobar
> umount $mnt
> ```

How are you running this?  According to your original post, the surprising
behavior is:

generic/228 0s ... - output mismatch (see 
/home/adam/xfstests-dev/results//generic/228.out.bad)
    --- tests/generic/228.out    2024-04-25 18:13:45.126552201 +0930
+++ /home/adam/xfstests-dev/results//generic/228.out.bad 2025-09-02 
19:51:22.806635177 +0930
    @@ -1,6 +1,6 @@
     QA output created by 228
     File size limit is now set to 100 MB.
     Let us try to preallocate 101 MB. This should fail.
    -File size limit exceeded
    +File size limit exceeded $XFS_IO_PROG -f -c 'falloc 0 101m' $TEST_DIR/ouch
     Let us now try to preallocate 50 MB. This should succeed.
     Test over.
    ...

which seems to be saying that your entire line of *script* (as indicated
by the $VAR expansions) is being written by an interpreter.  However,
this makes no sense to me if bash is the interpreter.  The only time
bash should echo command lines is if either the -x or -v option is in
effect.  However:

 * If it's -x then the $VAR expansions should have been expanded, not
   shown verbatim.

 * The -v option would show a line of script verbatim, but I would expect
   to see *lots* of lines being echoed if that were the case.

Either way, I can't reproduce it with ulimit:

hobbit:~$ cat x
#!/bin/bash
echo start
ulimit -f 102400
echo end
hobbit:~$ bash-5.2 x
start
end
hobbit:~$ bash-5.3 x
start
end

What is "xfs_io"?  Is it a utility in /usr/sbin or some other directory?
Or is it a function?  An alias?

You said you believe ulimit is the culprit.  Do you get the same
problem with any other command following ulimit?  Do you get the same
problem if the ulimit command is commented out?  Is your ulimit command
aliased?

The only way I can make any sense of your claim is if I turn xfs_io into
a magic alias.[1]

hobbit:~$ xfs_io_helper() { local cmd; read -r _ _ cmd < <(history 1); printf 
'%s\n' "$cmd"; eval "$cmd"; }
hobbit:~$ alias xfs_io='xfs_io_helper # '
hobbit:~$ xfs_io true -c -f "1 2 3" $LOGNAME/xyz
true -c -f "1 2 3" $LOGNAME/xyz

Are you using some variant of this?  Perhaps as a part of some testing
apparatus?  Your original report seems to indicate that you're running
some sort of test suite.  Does your reproducer only reproduce the issue
if you're running it as part of this test suite?

Does the test suite use magic aliases?

I'm unaware of any reason why a test suite, whether it uses magic aliases
or not, would exhibit a change of this type when switching bash versions.

What happens if you stick "type ulimit" and "type xfs_io" into your
reproducer, to show how they're being resolved?

[1]See:
    https://www.chiark.greenend.org.uk/~sgtatham/aliases.html
    https://wooledge.org/~greg/sprunge-magic-alias



reply via email to

[Prev in Thread] Current Thread [Next in Thread]