Re: [PATCH] quote arguments in xtrace output

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

 



On 27/02/2017 21:08, Martijn Dekker wrote:
Op 27-02-17 om 20:24 schreef Harald van Dijk:
If the modification to single_quote can handle all cases (perhaps
quoting unnecessarily if it's unclear), then the conditional
parameter could be removed and applied unconditionally: as far as I
can tell, there are no existing calls that require the single quotes
for simple words.

True, but this would change the output of something like:

$ dash -c 'alias stuff=xyz; trap true EXIT; alias; trap'

from:

stuff='xyz'
trap -- 'true' EXIT

to:

stuff=xyz
trap -- true EXIT

While there is technically nothing wrong with this, I think it's nicer
to leave those quoted unconditionally, because that facilitates editing
the output of those commands to feed it back to the shell.

Fair point.

Looking at other shells:

            | bash | ksh93 | zsh | posh | dash | dash (patched)
   alias    | 2    | 1     | 1   | -    | 2    | 2
    trap    | 2    | 1     | 1   | 1    | 2    | 2
  export -p | 2    | 1     | 1   | 0    | 2    | 2
readonly -p | 2    | 1     | 1   | 0    | 2    | 2
     set    | 1    | 1     | 1   | -    | 2    | 2
     set -x | 1    | 1     | 1   | 0    | 0    | 1

Here, 0 means "never quoted", 1 means "quoted when containing special characters", and 2 means "always quoted".

Although there is a bit of variation in other shells, your approach brings dash closer to bash, which I believe is considered a goal for dash, all else being equal. My suggestion would bring dash closer to bash in one command, but further from bash in four others, so unless there is a good reason for it, I think I agree that that shouldn't be done.

Cheers,
Harald van Dijk
--
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