On Fri, Jan 22, 2021 at 05:05:31AM +0100, Mathias Steiger wrote: > > Here is the strace output. > > https://filebin.net/9auqyreezma08z12/bug_bash.tar.gz?t=3bjx4xpd > > It is very excessive due to the nature of Autoconf and I couldn't make a lot > of sense of it. > > > When I downgraded the package from bash-5.1.004-1 to bash-5.0.018-2 the bug > disappeared.
This trace file is quite interesting (redacted for brevity): $ cat ./strace_if-statement_removed/strace_second.1243868 (...) openat(AT_FDCWD, "./config.status", O_WRONLY|O_CREAT|O_APPEND, 0666) = 8 dup2(8, 1) = 1 close(8) = 0 openat(AT_FDCWD, "/dev/null", O_RDONLY) = 8 dup2(8, 0) = 0 close(8) = 0 execve("/bin/cat", ["cat"], [(...)]) = 0 (...) fstat(1, {st_dev=makedev(0xfe, 0x3), st_ino=42548069, st_mode=S_IFREG|0775, st_nlink=1, st_uid=1006, st_gid=0, st_blksize=4096, st_blocks=32, st_size=16357, st_atime=1611282495 /* 2021-01-22T03:28:15.296486563+0100 */, st_atime_nsec=296486563, st_mtime=1611282560 /* 2021-01-22T03:29:20.712747829+0100 */, st_mtime_nsec=712747829, st_ctime=1611282560 /* 2021-01-22T03:29:20.712747829+0100 */, st_ctime_nsec=712747829}) = 0 fstat(0, {st_dev=makedev(0, 0x5), st_ino=1728, st_mode=S_IFREG|0666, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=73, st_atime=1611282495 /* 2021-01-22T03:28:15.243153560+0100 */, st_atime_nsec=243153560, st_mtime=1611282549 /* 2021-01-22T03:29:09.822815317+0100 */, st_mtime_nsec=822815317, st_ctime=1611282549 /* 2021-01-22T03:29:09.822815317+0100 */, st_ctime_nsec=822815317}) = 0 (...) read(0, "extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));\n", 131072) = 73 write(1, "extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));\n", 73) = 73 read(0, "", 131072) = 0 (...) This is in essence: cat </dev/null >./config.status These are worth highlighting: - Notice that the value returned by `fstat(0, ...)' indicates that /dev/null in your system is a *regular* file (it should be `st_mode=S_IFCHR|0666', but instead it is `st_mode=S_IFCHR|0666'). It also indicates that its size is 73 bytes (`st_size=73'). - Notice that `cat' reads from file descriptor 0 (i.e. /dev/null), and the return value is a string of 73 bytes in length. - `cat' then writes that string out to `./config.status' 73 happens to be the length of the string that has been causing issues for you: $ echo "extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));" | wc -c 73 Can you run: stat /dev/null And share with us what you get? This is how it should look like: $ stat /dev/null File: /dev/null Size: 0 Blocks: 0 IO Block: 4096 character special file Device: 5h/5d Inode: 4 Links: 1 Device type: 1,3 Access: (0666/crw-rw-rw-) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2021-01-09 15:28:48.589801534 -0800 Modify: 2021-01-09 15:28:48.589801534 -0800 Change: 2021-01-09 15:28:48.589801534 -0800 Birth: -