bzr 2.1.0 on windows: bzr eats backslashes in command-line arguments

Bug #528944 reported by Alexander Belchenko
26
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Critical
Gordon Tyler
2.1
Fix Released
High
Alexander Belchenko
QBzr
Fix Released
High
Alexander Belchenko

Bug Description

C:\Temp\1>bzr ci -m "move to \\ACAD"
Committing to: C:/Temp/1/
added bar
Committed revision 2.

C:\Temp\1>bzr log -l1
------------------------------------------------------------
revno: 2
committer: Alexander Belchenko <email address hidden>
branch nick: 1
timestamp: Sat 2010-02-27 13:28:14 +0200
message:
  move to \ACAD

NOTE: in log message there should be 2 backslashes, but there is only one!

I discover this while doing commit with qcommit and my first guess was: something wrong with Qt. But then I've managed to reproduce the problem with plain bzr. I think there is bug in new windows-specific command-line parser. For me it's a critical regression.

Related branches

Revision history for this message
Alexander Belchenko (bialix) wrote :

Corresponding part of .bzr.log:

0.219 bazaar version: 2.1.0
0.219 bzr arguments: [u'ci', u'-m', u'move to \\ACAD']
0.266 looking for plugins in C:\work\Bazaar\plugins
0.484 looking for plugins in C:/Program Files/Bazaar/plugins
0.578 encoding stdout as sys.stdout encoding 'cp866'
0.641 opening working tree 'C:/Temp/1'
0.687 preparing to commit
[ 1792] 2010-02-27 13:28:14.953 INFO: Committing to: C:/Temp/1/
0.719 Selecting files for commit with filter None
[ 1792] 2010-02-27 13:28:14.953 INFO: added bar
[ 1792] 2010-02-27 13:28:15.171 INFO: Committed revision 2.
0.937 Transferred: 0KiB (0.0K/s r:0K w:0K)
0.953 return code 0

Revision history for this message
Alexander Belchenko (bialix) wrote :

To avoid your guesses, plain python works fine here:

C:\Temp\1>python -c "import sys; print sys.argv" "move to \\ACAD"
['-c', 'move to \\\\ACAD']

Changed in bzr:
status: New → Confirmed
Revision history for this message
Gordon Tyler (doxxx) wrote :

This may be a result of the new cmdline module. It tries to replicate the backslash parsing behaviour of CommandLinetoArgv Win32 API function which in some cases will reduce 2N backslashes to N slashes.

Changed in bzr:
importance: Undecided → High
assignee: nobody → Gordon Tyler (doxxx)
Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 528944] Re: bzr 2.1.0 on windows: bzr eats backslashes in arguments

Gordon Tyler пишет:
> This may be a result of the new cmdline module. It tries to replicate
> the backslash parsing behaviour of CommandLinetoArgv Win32 API function
> which in some cases will reduce 2N backslashes to N slashes.

I think this is completely wrong.

Revision history for this message
Gordon Tyler (doxxx) wrote : Re: bzr 2.1.0 on windows: bzr eats backslashes in arguments

I cannot reproduce this using current bzr.dev (r5059). I only get it using bzr 2.1.0, but the cmdline stuff was only merged ito bzr.dev and not 2.1.0. So, I'd say that the new cmdline stuff fixed it even ;)

Revision history for this message
Gordon Tyler (doxxx) wrote :

Sat 2010-02-27 09:57:08 -0500
0.134 bazaar version: 2.2.0dev1
0.134 bzr arguments: [u'commit', u'-m', u'move to \\\\acad']

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 528944] Re: bzr 2.1.0 on windows: bzr eats backslashes in arguments

Gordon Tyler пишет:
> I cannot reproduce this using current bzr.dev (r5059). I only get it
> using bzr 2.1.0, but the cmdline stuff was only merged ito bzr.dev and
> not 2.1.0. So, I'd say that the new cmdline stuff fixed it even ;)

So then it should be backported.

Revision history for this message
Gordon Tyler (doxxx) wrote :

On 2/27/2010 9:59 AM, Alexander Belchenko wrote:
> Gordon Tyler пишет:
>> This may be a result of the new cmdline module. It tries to replicate
>> the backslash parsing behaviour of CommandLinetoArgv Win32 API function
>> which in some cases will reduce 2N backslashes to N slashes.
>
> I think this is completely wrong.

It's in the handling of backslashes followed by a quote.

See: http://msdn.microsoft.com/en-us/library/bb776391(VS.85).aspx

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: bzr 2.1.0 on windows: bzr eats backslashes in arguments

OK, I see. But in my case following rule is apply:

n backslashes not followed by a quotation mark simply produce n backslashes.

Anyway, it seems I have to address other cases when 2n backslashes becomes n backslashes, otherwise our qsubprocess becomes unhappy.

Changed in qbzr:
status: New → Confirmed
importance: Undecided → High
Changed in qbzr:
assignee: nobody → Alexander Belchenko (bialix)
summary: - bzr 2.1.0 on windows: bzr eats backslashes in arguments
+ bzr 2.1.0 on windows: bzr eats backslashes in command-line arguments
Changed in qbzr:
milestone: none → 0.18.5
Revision history for this message
Alexander Belchenko (bialix) wrote :

I've added workaround in QBzr to make qsubprocess more robust against such kind of errors. But the root cause in bzr core is not fixed yet, and should be fixed as well.

Changed in qbzr:
status: Confirmed → In Progress
status: In Progress → Fix Released
Changed in bzr:
importance: High → Critical
Revision history for this message
Perry (perryrapp) wrote :

I said I'd test 2.2b2 and follow-up on my bug (https://bugs.launchpad.net/bzr/+bug/569050) which was marked as duplicate to this, so I'm following up here.

Unfortunately, I was unable to test 2.2b2, because the install failed, so I do not have a data point for 2.2b2. I'll post the failed install as a separate bug.

Is 2.2b2 expected to fix this?

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 528944] Re: bzr 2.1.0 on windows: bzr eats backslashes in command-line arguments

Perry пишет:
> Is 2.2b2 expected to fix this?

AFAIK, it should. But I'm not sure. :-/

--

All the dude wanted was his rug back

Revision history for this message
Martin Pool (mbp) wrote :

I'm told this is fixed in trunk but needs to be merged back to 2.1. But it can't directly be merged back because it needs another fix.

Changed in bzr:
milestone: none → 2.2b3
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.