On 8/9/25 08:39, Robert Elz wrote:
Date: Sat, 9 Aug 2025 01:35:17 +0200
From: Denys Vlasenko <dvlas...@redhat.com>
Message-ID: <f7ec2956-dfeb-af4e-d314-937f36424...@redhat.com>
| A year ago, dash had this fix:
| expand: Fix naked backslah leakage
I would call that a change, rather than a fix.
Whatever. I'm not from the dash team.
Probably should CC them. Done.
FWIW, the NetBSD sh, another ash descendant, like dash is, produces
the same result as (current) bash does here
<\*bc>
That is, the pattern after the ## is invalid, as the unquoted, unescaped
\ that comes from $b has nothing to escape, so matches nothing.
If you want to interpret such a \ as meaning the same as \\ that's OK,
what happens is unspecified after all, but if you really meant to say \\
that's what you should be writing in the code - ie: as an author of
shell code, you shouldn't be creating invalid patterns. Don't demand
that other shells act the same way as you expect when you do though.
I don't demand that.
What I "demand" (advocate for, or trying to facilitate) is to have
consistent behavior across tools.
I look at it from the POV of the users. It's a particular source
of PITA when supposedly compatible tools have these irritating
corner-case differences.
When you are working with a huge complicated conglomerate
of various Unix tools (a build system, for example:
uses shell, make, rpm's specfile, lua, awk, sed, grep, cut,
and a few other "languages"), and when it mysteriously breaks
and you need to hunt down which of the tools made a change
and what obscure corner of this mess got affected...
it's no fun. It's anti-fun.
What we (collectively in different tools) aren't doing well is:
* we don't always communicate well
* when we fix a bug, we don't always add a testsuite item to track it.
The end result is that when we fix a bug in an obscure case,
we often break another, previously fixed behavior in another obscure
case.
For example, dash does not seem to have a testsuite. It's not in
the git tree, at least.
I don't care what the behavior would be deemed "correct"
in this case, but it'll be better to have the same behavior
across all Bourne shells.
Lets just choose one behavior, and add it to our testsuites
to "solidify" it, so that it doesn't changes unnoticed
in the future.