bug-bash
[Top][All Lists]
Advanced

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

bash 5.1 heredoc pipes problematic, shopt needed


From: Sam Liddicott
Subject: bash 5.1 heredoc pipes problematic, shopt needed
Date: Fri, 22 Apr 2022 14:51:19 +0100

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto
-ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security
-Wall
uname output: Linux junior 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30
15:54:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.1
Patch Level: 16
Release Status: release

Description:
        Listed in the changes:
        c. Here documents and here strings now use pipes for the expanded
           document if it's smaller than the pipe buffer size, reverting
           to temporary files if it's larger.

        This causes problems with many programs suffering from the TOCTOU
        bug of checking whether or not the input is actually a file
        instead of just using it as one.

        e.g. "repo" tool performs in manifest_xml.py:

          if not os.path.isfile(path):
            raise ManifestParseError('manifest %s not found' % name)

        This bug is clearly in repo and (these other tools) and certainly is
        not bash's fault but there is going to be a lot of breakage with the
        short and medium term remedy to downgrade to bash 5.0

        I *like* that files aren't needed any more but there are decades
        of scripts integrating with tools than make such checks, and which
        work on the unknown accidental assumption that heredocs are files.

Repeat-By:
        python2 -c 'import os; print(os.path.isfile("/dev/fd/3"))' 3<<<x

        emits True for bash 5.0 and before but emits False for bash 5.1

Fix:
        Please could we at least have a shopt to maintain the old behaviour?


reply via email to

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