Re: Backslashes in unquoted parameter expansions

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

 



Op 26-03-18 om 17:38 schreef Harald van Dijk:
> And not by dash 0.5.4. Like I wrote, dash 0.5.5 had some bugs that were
> fixed in 0.5.6, which mostly restored the behaviour to match <0.5.5.

Ah, sorry. dash 0.5.4 and earlier don't compile on my system, so they
are not included in my conveniently accessible arsenal of test shells.

> As for my patches, that was by accident and doesn't work reliably. When
> the shell sees no metacharacters, pathname expansion is bypassed, and
> backslash isn't considered a metacharacter. Which got me to my original
> example of /de\v: there are no metacharacters in there, so the shell
> doesn't look to see if it matches anything. Which seems highly
> desirable: the shell shouldn't need to hit the file system for words not
> containing metacharacters. The only way then to get consistent behaviour
> is if the backslash is taken as quoted, so I'm not tempted to argue for
> the behaviour you're hoping for, sorry. :)

But 'case' never hits the file system. There may be a compelling reason
to differ from bash (and ignore the apparent POSIX requirement) when it
comes to pathname expansion, but I don't see one for 'case'.

Plus, expansions within 'case' are already treated differently: no field
splitting or generating of fields, no pathname expansion. And the
pattern matching behaviour is already different as well.

So if we're going to ignore what POSIX appears to require anyway, maybe
this behaviour does not really need to be consistent between 'case' and
pathname expansion.

You initially asked for "scenarios where it's important to treat an
expanded backslash as unquoted". So I gave you a use case involving a
shell function that does pattern matching with 'case', which needs this
functionality to match arbitrary strings without an expensive
workaround. I guess you don't think that use case is compelling enough?

> And remember, personal playground, lots of disclaimers about bugs.

Yes, I'm aware. As I indicated earlier, I'm now using it as my default
/usr/local/bin/dash to help you find those bugs.

> I suspected the intent for dash was to treat it as quoted, but I was
> hoping for verification.

Calling Herbert Xu, come in please...

- M.
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

  Powered by Linux