From: Thomas Rast <trast@student.ethz.ch>
To: Junio C Hamano <gitster@pobox.com>
Cc: <git@vger.kernel.org>, Kevin Ballard <kevin@sb.org>
Subject: Re: [PATCH] bash completion: use read -r everywhere
Date: Wed, 21 Dec 2011 20:09:15 +0100 [thread overview]
Message-ID: <87wr9pkahw.fsf@thomas.inf.ethz.ch> (raw)
In-Reply-To: <7vipl9hht4.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Wed, 21 Dec 2011 10:59:35 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> Thomas Rast <trast@student.ethz.ch> writes:
>
>> POSIX specifies
>>
>> The read utility shall read a single line from standard input.
>> By default, unless the -r option is specified, backslash ('\')
>> shall act as an escape character...
>>
>> Our omission of -r breaks the loop reading refnames from
>> git-for-each-ref in __git_refs() if there are refnames such as
>> "foo'bar", in which case for-each-ref helpfully quotes them as in
[...]
> Thanks.
>
> As this script is specific to bash, it is secondary importance what POSIX
> says. The "-r" option is important only because "bash" happens to follow
> POSIX in this case. I'd like to see the early part of the message reworded
> perhaps like this:
>
> At various points in the script, we use "read" utility without
> giving it the "-r" option that prevents a backslash ('\')
> character to act as an escape character. This breaks e.g. reading
> refnames from ...
Perhaps we can then just fold it into the first paragraph after the
POSIX quote, like
We use the 'read' command without -r, so that it treats '\' as an
escape character, in several places. This breaks the loop reading
refnames from git-for-each-ref in __git_refs() if there are refnames
such as "foo'bar", in which case for-each-ref helpfully quotes them as
in
Or some such. Do you want me to resend?
> Does this regress for zsh users in some ways, by the way?
I'm not one of them, but a quick googling for "zsh builtin read" turns
up that it has a dozen options, and -r means
-r
Raw mode: a \ at the end of a line does not signify line continuation.
I can't discern whether it treats \ special at all with or without -r.
--
Thomas Rast
trast@{inf,student}.ethz.ch
next prev parent reply other threads:[~2011-12-21 19:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-21 15:54 [PATCH] bash completion: use read -r everywhere Thomas Rast
2011-12-21 18:59 ` Junio C Hamano
2011-12-21 19:09 ` Thomas Rast [this message]
2011-12-21 19:23 ` Junio C Hamano
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=87wr9pkahw.fsf@thomas.inf.ethz.ch \
--to=trast@student.ethz.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kevin@sb.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).