From: Harald van Dijk <harald@gigawatt.nl>
To: Martijn Dekker <martijn@inlv.org>, dash@vger.kernel.org
Subject: Re: [PATCH] quote arguments in xtrace output
Date: Mon, 27 Feb 2017 22:34:31 +0100 [thread overview]
Message-ID: <0ef1b102-a04c-f3ac-609e-5285d59904d0@gigawatt.nl> (raw)
In-Reply-To: <6e8434e8-87e3-db2a-9d80-147f064c4793@inlv.org>
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
next prev parent reply other threads:[~2017-02-27 21:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 6:22 [PATCH] quote arguments in xtrace output Martijn Dekker
2017-02-27 19:24 ` Harald van Dijk
2017-02-27 20:08 ` Martijn Dekker
2017-02-27 21:34 ` Harald van Dijk [this message]
2017-02-27 23:17 ` Martijn Dekker
2017-02-28 3:39 ` Martijn Dekker
2017-03-18 4:31 ` Martijn Dekker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0ef1b102-a04c-f3ac-609e-5285d59904d0@gigawatt.nl \
--to=harald@gigawatt.nl \
--cc=dash@vger.kernel.org \
--cc=martijn@inlv.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.