[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Command substitution with null bytes generates warning
From: |
Chet Ramey |
Subject: |
Re: Command substitution with null bytes generates warning |
Date: |
Wed, 5 Oct 2016 09:20:58 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 9/16/16 1:51 AM, Eric Pruitt wrote:
> Bash Version: 4.4
> Patch Level: 0
> Release Status: release
>
> Description:
> I have a script that execute `if [[ "$(<"/proc/$1/cmdline")" = tmux*
> ]];`.
> All /proc/*/cmdline include null bytes, and as of Bash 4.4, this
> results in
> a warning being spewed on stderr which did not happen in Bash 4.3.
>
> Repeat-By:
> echo "$(<"/proc/$$/cmdline")"
>
> Fix:
> Is this even an intentional change? I looked at some of the other
> internal_warning invocations, and they were commented out using "#if 0
> ...
> #endif."
Try the attached patch, which reduces the number of warnings to 1 per call
to command substitution.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
comsub-nullbyte.patch
Description: Text Data
- Re: Command substitution with null bytes generates warning,
Chet Ramey <=