bzr.bat splaps all win98 users immediately in the face

Steve Christensen stnchris at xmission.com
Tue Feb 28 02:05:52 GMT 2006


John Arbash Neinel wrote:
> James Blackwell wrote:
> > On Mon, Feb 27, 2006 at 03:08:38PM -0500, Robert J. Cristel wrote:
> >> C:\Python24\Scripts>type bzr.bat
> >> @C:\Python24\python.exe C:\Python24\Scripts\bzr %*
> >>
> >> C:\Python24\Scripts>bzr.bat
> >> bzr: ERROR: unknown command '*'
> >>
> >> C:\Python24\Scripts>
> >>
> >> C:\Python24\Scripts>
> >>
> >> Why?
> >>> Windows NT 4 introduced a set of new features for command line parameters:
> >>> %* 	  	will return all command line parameters following %0
> > 
> > 
> > I know that Windows 2000 has it. I'm unable to verify that NT4 has it. Bzr
> > is telling you though that it got "*" for an argument, which implies to me
> > that NT 4 doesn't have the feature. I suggest that you test with this
> > standalone batch script
> > 
> > test.bat:
> >   echo I got:%*
> > 
> > C..> test.bat hello world
> > 
> > The results may be illuminating.  By the way, newer versions of bzr have
> > command aliases which may help you out of the problem that you're in.
> > 
> > Regards,
> > James
> > 
> 
> Actually, the problem is that he is on Windows 98, which doesn't have
> anything from the NT line. So $* is illegal in win98.
> 
> Now officially, we don't support Win9x platforms. I realize we shouldn't
> be overly hostile towards it, though.
> 
> All he is really asking is that we change our default .bat file to be:
> 
> "c:\Path\To\python.exe" "C:\Path\To\bzr" $1 $2 $3 $4 $5 $6 $7 $8 $9
> 
> (I don't believe that the Win9x batch processor can handle more than 9
> arguments).
> 
> It is a small change, and if it works for him, then we might as well do it.
> 
> That said, if we run into any other major problems (like the fact that
> Win9x support for unicode is very poor, and bzr uses unicode
> extensively), I don't expect we will do a lot of work to make bzr run on
> Win98.
> 
> Can you let us know if changing the batch file makes bzr work for you?
> Otherwise there isn't much point in adding the fix, as it then limits
> other windows people to only 9 arguments. (Which is probably sufficient
> in the common case, but still a limitation).
> 
> Oh, and probably it needs to be:
> 
> "$1" "$2" "$3"
> 
> Can you confirm that as well? I know my colleague tried to do:
> bzr commit -m 'some text'
> 
> But it turns out that the Windows XP shell doesn't treat single quotes
> as special.
> 
> (Which brings up another point, that the message 'No changes to commit'
> hides the problem, and probably when a file spec is given we should give
> 'No changes to "foo" to commit')


You could also change the .bat file to do the right thing on
NT/XP/Vista, and the 'old' way on 98/95.

Here's what Vim's gvim.bat looks like. For 98/95, they loop over the
command-line w/ shift, accumulating the command-line parameters in
%VIMARGS%. But, on NT/XP/2005 it just uses %*


Or, look at Maven's mvn.bat:
http://maven.apache.org/continuum/scripts/mvn.bat


------------------>8----gvim.bat ------8<-------------


@echo off
rem -- Run Vim --

set VIM=C:\Program Files\Vim

if exist "%VIM%\vim64\gvim.exe" goto havevim
echo "%VIM%\vim64\gvim.exe" not found
goto eof

:havevim
rem collect the arguments in VIMARGS for Win95
set VIMARGS=
set VIMNOFORK=
:loopstart
if .%1==. goto loopend
if NOT .%1==.-f goto noforkarg
set VIMNOFORK=1
:noforkarg
set VIMARGS=%VIMARGS% %1
shift
goto loopstart

:loopend
if .%OS%==.Windows_NT goto ntaction

if .%VIMNOFORK%==.1 goto nofork
start "%VIM%\vim64\gvim.exe"  %VIMARGS%
goto eof

:nofork
start /w "%VIM%\vim64\gvim.exe"  %VIMARGS%
goto eof

:ntaction
rem for WinNT we can use %*
if .%VIMNOFORK%==.1 goto noforknt
start "dummy" /b "%VIM%\vim64\gvim.exe"  %*
goto eof

:noforknt
start "dummy" /b /wait "%VIM%\vim64\gvim.exe"  %*

:eof
set VIMARGS=
set VIMNOFORK=





More information about the bazaar mailing list