Re: dash bug: double-quoted "\" breaks glob protection for next char
On 2/28/18 11:14 PM, Denys Vlasenko wrote: Guys, while you work on fixing this, consider taking a look at some more parsing cases in this bbox bug: https://bugs.busybox.net/show_bug.cgi?id=10821 I suppose some of them may fail in dash too (I did not test, sorry). $'...' isn't supported in dash, but the underlying problem does appear to exist in dash too: $ bash -c 'x=yz; echo "${x#'"'y'"'}"' z $ dash -c 'x=yz; echo "${x#'"'y'"'}"' yz (That is, they are executing x=yz; echo "${x#'y'}".) POSIX says that in "${var#pattern}" (and the same for ##, % and %%), the pattern is considered unquoted regardless of the outer quotation marks. Because of that, the single quote characters should not be taken literally, but should be taken as quoting the y. ksh, posh and zsh agree with bash. But: POSIX does not say the same for +/-/..., so dash is correct there: $ bash -c 'x=yz; echo "${x+'"'y'"'}"' 'y' $ dash -c 'x=yz; echo "${x+'"'y'"'}"' 'y' Because of that, for that report's follow-up comment about (unset x; echo "${x-$'\x41'}") I would not have expected this to be taken as a $'...' string. ksh (which does support $'...' strings too) prints the literal text $'\x41', and so does bash if invoked as sh. Cheers, Harald van Dijk -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dash bug: double-quoted "\" breaks glob protection for next char
On Sat, Feb 24, 2018 at 5:52 PM, Herbert Xuwrote: > On Sat, Feb 24, 2018 at 10:47:07AM +0100, Harald van Dijk wrote: >> >> It seems like the new control character doesn't get escaped in one place >> where it should be, and gets lost because of that: >> >> Unpatched: >> >> $ dash -c 'x=`printf \\\211X`; echo $x | cat -v' >> M-^IX >> >> Patched: >> >> $ src/dash -c 'x=`printf \\\211X`; echo $x | cat -v' >> X > > Hmm, it works here. Can you check that your Makefile is up-to-date > and the generated syntax.c looks like this: > > const char basesyntax[] = { > CEOF,CSPCL, CWORD, CCTL, > CCTL,CCTL,CCTL,CCTL, > CCTL,CCTL,CCTL,CCTL, > > Cheers, Guys, while you work on fixing this, consider taking a look at some more parsing cases in this bbox bug: https://bugs.busybox.net/show_bug.cgi?id=10821 I suppose some of them may fail in dash too (I did not test, sorry). -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html