From: Reece Dunn <msclrhd@googlemail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jerzy Kozera <jerzy.kozera@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] git-p4: Fix 'p4 opened' in git-p4 for names with spaces
Date: Tue, 14 Dec 2010 23:36:56 +0000 [thread overview]
Message-ID: <AANLkTi=Cp=FCuJdthr7JfML6jdNzUiDAUPjrWpTQfWGk@mail.gmail.com> (raw)
In-Reply-To: <7vvd2wq72l.fsf@alter.siamese.dyndns.org>
On 14 December 2010 23:16, Junio C Hamano <gitster@pobox.com> wrote:
> Jerzy Kozera <jerzy.kozera@gmail.com> writes:
>
>> Signed-off-by: Jerzy Kozera <jerzy.kozera@gmail.com>
>> ---
>> contrib/fast-import/git-p4 | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
>> index 04ce7e3..a5297e7 100755
>> --- a/contrib/fast-import/git-p4
>> +++ b/contrib/fast-import/git-p4
>> @@ -144,7 +144,7 @@ def setP4ExecBit(file, mode):
>> def getP4OpenedType(file):
>> # Returns the perforce file type for the given file.
>>
>> - result = p4_read_pipe("opened %s" % file)
>> + result = p4_read_pipe("opened \"%s\"" % file)
>
> Don't you need a lot more than that? What if file has " or \ in it?
Those are invalid characters for a filename on Windows, so cannot be
entered/present in the filename. On Linux, they are accepted, but
don't get put into the filename, so it all depends on where the data
for file comes from (API call or user/external source). Not sure how
Mac/BSD/Solaris handle those characters.
This looks fine to me, but I wonder if there are other places
referencing file paths that require quoting to correctly handle
spaces.
Also, escaping the quote characters can be avoided by using single
quoted string literals:
+ result = p4_read_pipe('opened "%s"' % file)
- Reece
next prev parent reply other threads:[~2010-12-14 23:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-14 20:56 [PATCH] git-p4: Fix 'p4 opened' in git-p4 for names with spaces Jerzy Kozera
2010-12-14 20:56 ` Jerzy Kozera
2010-12-14 23:16 ` Junio C Hamano
2010-12-14 23:36 ` Reece Dunn [this message]
2011-01-13 18:51 ` [PATCH] git-p4: Fixed handling of file " Jerzy Kozera
2011-01-14 22:01 ` Andreas Schwab
2011-01-14 22:45 ` Jerzy Kozera
2011-01-15 14:35 ` Pete Wyckoff
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='AANLkTi=Cp=FCuJdthr7JfML6jdNzUiDAUPjrWpTQfWGk@mail.gmail.com' \
--to=msclrhd@googlemail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jerzy.kozera@gmail.com \
/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).