bzr always returns exit code 0 on win32

Bug #349532 reported by Ingo Strüwing
4
Affects Status Importance Assigned to Milestone
Bazaar
Invalid
Medium
Unassigned

Bug Description

If bzr branch fails on Windows, it returns zero (success) anyway. This makes it impossible for a script to act on the problem.

On Debian GNU/Linux x86_64 unstable, I run Windows XP in VirtualBox.
In a cygwin shell window, I branch like this:

   bzr branch x:/bzrroot/mysql-6.0-backup mysql-6.0-backup

where x:/ is a VirtualBox "shared folder" into Linux's file system. The command prints: "bzr: ERROR: [Errno 13] Permission denied", but returns a zero error code so that my script thinks, it was successful, but fails to compile on the new tree. Repeating the same command, after removing the incomplete tree, succeeds. Always.

I wish to have bzr branch return a non-zero error code so that I can automize the removal and retry.

bzr version
Bazaar (bzr) 1.12rc1
  Python interpreter: c:\Python25\python.exe 2.5.2
  Python standard library: c:\Python25\lib
  bzrlib: c:\Python25\lib\site-packages\bzrlib
  Bazaar configuration: C:\Documents and Settings\istruewing\Application Data\bazaar\2.0
  Bazaar log file: C:\Documents and Settings\istruewing\My Documents\.bzr.log
...

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

On Linux, a permission denied error in branch does give an exit code of 3 for me.

Is this problem specific to bzr branch or do you get 0 if other commands fail? Try bzr diff?

Changed in bzr:
importance: Undecided → Low
status: New → Confirmed
status: Confirmed → Incomplete
Revision history for this message
Ingo Strüwing (ingo-struewing) wrote : Re: [Bug 349532] Re: bzr branch returns zero on error on Windows

Hi Martin,

Martin Pool, 22.06.2009 06:07:

> On Linux, a permission denied error in branch does give an exit code of
> 3 for me.

I confirm this.

However, I reported the problem for Windows. On Windows, I see the error
message, but the exit code is 0 anyway.

>
> Is this problem specific to bzr branch or do you get 0 if other commands
> fail? Try bzr diff?

Yes, it happens with bzr diff too.

In a Cygwin bash I used chmod a-r on some file. Then bzr diff on the
file. That produced the error, but the exit code was still 0.

Regards
Ingo
--
Ingo Strüwing, Database Group
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schröder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring HRB München 161028

Martin Pool (mbp)
tags: added: win32
summary: - bzr branch returns zero on error on Windows
+ bzr always returns exit code 0
Changed in bzr:
importance: Low → Medium
status: Incomplete → Confirmed
Martin Pool (mbp)
tags: added: mysql
Martin Pool (mbp)
summary: - bzr always returns exit code 0
+ bzr always returns exit code 0 on win32
Revision history for this message
Alexander Belchenko (bialix) wrote :

most likely this is a problem with bzr.bat script (see C:\Python25\Scripts directory). or maybe interacion with cygwin. can you check with standard cmd.exe?

Revision history for this message
PhiLho (philho) wrote :

I tried to reproduce this on my French Windows XP Pro SP3.

> bzr version
Bazaar (bzr) 1.13
  Python interpreter: C:\PrgCmdLine\Bazaar\python25.dll 2.5.2
  Python standard library: C:\PrgCmdLine\Bazaar\lib\library.zip
  bzrlib: C:\PrgCmdLine\Bazaar\lib\library.zip\bzrlib

> cat Test.cmd
@echo off
bzr pull FOO
ECHO ERRORLEVEL = %ERRORLEVEL%

> Test.cmd
bzr: ERROR: Not a branch: "E:/Dev/PhiLhoSoft/Lua/FOO/".
ERRORLEVEL = 3

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 349532] Re: bzr always returns exit code 0 on win32

PhiLho пишет:
> I tried to reproduce this on my French Windows XP Pro SP3.
>
>> bzr version
> Bazaar (bzr) 1.13
> Python interpreter: C:\PrgCmdLine\Bazaar\python25.dll 2.5.2
> Python standard library: C:\PrgCmdLine\Bazaar\lib\library.zip
> bzrlib: C:\PrgCmdLine\Bazaar\lib\library.zip\bzrlib

One small detail: you're using standalone bzr.exe, while topicstarter
using python-based bzr installation (I suspect this is because he need
bzr-gtk plugin).

Revision history for this message
Ingo Strüwing (ingo-struewing) wrote :

Hi all,

PhiLho, 30.06.2009 11:10:

...
>> cat Test.cmd
> @echo off
> bzr pull FOO
> ECHO ERRORLEVEL = %ERRORLEVEL%
>
>> Test.cmd
> bzr: ERROR: Not a branch: "E:/Dev/PhiLhoSoft/Lua/FOO/".
> ERRORLEVEL = 3

Found it: I had /usr/local/bin/bzr (Cygwin notation). I contained:

python C:/Python25/Scripts/bzr "$@" |tr -d '\r'

That is, it tried to get rid of carriage return in the output from bzr.
I use to save bzr output into log files. The carriage returns are pretty
disturbing in 'vi' or 'emacs' editors.

I'll find a way to get rid of the characters and still preserve the exit
code.

Thanks for your patience. Please close the bug.

Regards
Ingo
--
Ingo Strüwing, Database Group
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schröder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring HRB München 161028

Martin Pool (mbp)
Changed in bzr:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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