Possible regression in Dash v0.5.10 on OSX / home-brew

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

 



Hi All,

I hope this is the right place to report this:

It looks like something is up with processing of certain characters
inside quoted strings when --enable-fnmatch --enable-glob are enabled,
as they are in the homebrew installation of dash on OSX:

  ( git checkout v0.5.10 && git clean -dfx && ./autogen.sh &&
./configure --enable-fnmatch --enable-glob && make && ./src/dash -c
"printf '%s\n' 'a/?*[/b'" ) 2>/dev/null | tail -1

produces

  a\/\?\*\[\/b\n

with no terminating newline. I believe that dash is adding an extra
backslash in front of some special characters inside quoted strings.
The \n and missing newline above is because dash is doubling the
backslash, so printf is then seeing \\n, printing \ and n (and no
newline). This theory is backed up by switching out printf for a
simple c program which just dumps argv to stdout.

The behaviour is present on master for me, at git commit
03cbaba30d7f6e4f89b6e881b6b909cb45924025

Any one of using v0.5.9, or removing --enable-fnmatch, or removing
--enable-glob, makes the effect go away and prints the expected

  a/?*[/b

including the trailing newline. It's worth noting ! is also affected,
but i left it out of the example because of interactions with my outer
shell (zsh) history. For completeness, the good command lines are:

  ( git checkout v0.5.9 && git clean -dfx && ./autogen.sh &&
./configure --enable-fnmatch --enable-glob && make && ./src/dash -c
"printf '%s\n' 'a/?*[/b'" ) 2>/dev/null | tail -1
  ( git checkout v0.5.10 && git clean -dfx && ./autogen.sh &&
./configure --enable-glob && make && ./src/dash -c "printf '%s\n'
'a/?*[/b'" ) 2>/dev/null | tail -1
  ( git checkout v0.5.10 && git clean -dfx && ./autogen.sh &&
./configure --enable-fnmatch && make && ./src/dash -c "printf '%s\n'
'a/?*[/b'" ) 2>/dev/null | tail -1

That list of characters is discussed in src/TOUR and CTLESC handling,
but i haven't debugged beyond the above reproductions or try to bisect
further than 0.5.9 to 0.5.10.

These tests we done on OSX (10.13.6) with gcc --version reporting
Apple LLVM version 9.1.0 (clang-902.0.39.2) . Happy to help with
further info / testing if i can.

 - Robbie



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux