On 11/14/22 2:40 PM, loic.yh...@gmail.com wrote:
Bash Version: 5.2
Patch Level: 2
Release Status: release
Description:
I can no longer run xxx-ct-ng.config scripts produced by crosstool-ng.
Those just contain a few lines of script, with appended bzip2
compressed text.
https://github.com/crosstool-ng/crosstool-ng/blob/master/scripts/toolchain-config.in
Bash 5.2 changed the check_binary_file function, it seems any NUL in
the first
80 characters will cause the error.
Repeat-By:
Create a test.sh with :
#!/bin/sh
tail -n+4 "${0}" | bzcat
exit 0
$ echo foo | bzip2 >> test.sh
$ bash ./test.sh
./test.sh: ./test.sh: cannot execute binary file
https://savannah.gnu.org/support/index.php?110744
I attached the patch I applied.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
*** ../bash-5.2-patched/general.c 2021-11-04 14:12:38.000000000 -0400
--- general.c 2022-10-24 10:20:12.000000000 -0400
***************
*** 682,685 ****
--- 684,688 ----
{
register int i;
+ int nline;
unsigned char c;
***************
*** 688,700 ****
/* Generally we check the first line for NULs. If the first line looks like
! a `#!' interpreter specifier, we just look for NULs anywhere in the
! buffer. */
! if (sample[0] == '#' && sample[1] == '!')
! return (memchr (sample, '\0', sample_len) != NULL);
for (i = 0; i < sample_len; i++)
{
c = sample[i];
! if (c == '\n')
return (0);
if (c == '\0')
--- 691,701 ----
/* Generally we check the first line for NULs. If the first line looks like
! a `#!' interpreter specifier, we look for NULs in the first two lines. */
! nline = (sample[0] == '#' && sample[1] == '!') ? 2 : 1;
for (i = 0; i < sample_len; i++)
{
c = sample[i];
! if (c == '\n' && --nline == 0)
return (0);
if (c == '\0')