monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Re: Serving * does not work


From: Matthew Gregan
Subject: Re: [Monotone-devel] Re: Serving * does not work
Date: Wed, 12 Oct 2005 23:55:07 +1300
User-agent: Mutt/1.5.10i

At 2005-10-12T11:08:43+0200, Wim Oudshoorn wrote:
> On MS Windows in the msys shell none of the followiing work;
> 
> monotone --db=...  set xxx yyy *   // This is obvious
> monotone --db=...  set xxx yyy "*"
> monotone --db=...  set xxx yyy '*'
> monotone --db=...  set xxx yyy \*
> monotone --db=...  set xxx yyy "\*"
> monotone --db=...  set xxx yyy '\*'
> monotone --db=...  set xxx yyy \\* 
> 
> All of them are expanded.  It is obviously a problem with the msys
> shell.  However, the strange thing is:

You can use "{*}" with monotone on Windows to get the desired behaviour.
This will be passed unexpanded through to monotone as the literal: {*},
which happens to be a set with a single member that matches all items.

On Windows, since the standard shells do not perform globbing, it's possible
to have the runtime library perform globbing on your application's arguments
before they're passed into your program.  This is generally controlled by
linking against an existing object called setargv.obj (but there are other
methods, including handling globbing in each application).  When building
with MinGW, a form of this behaviour is enabled by default.  You can disable
it by adding a the following at global scope somewhere in your program:

int _CRT_glob = 0;

Unfortunately, this also means that things like "monotone add *.cc" will
cease to do anything sensible on Windows unless you're using a shell that
performs glob expansion.

When this globbing behaviour is enabled _and_ you're using a shell with UNIX
style quoting and escaping rules, it becomes (as you've demonstrated above),
impossible to pass some strings through to the application without expansion
occuring.

> ls *   // List all files because * is  expanded
> ls '*' // says:  ls: *: No such file or directory
> ls \*  // says:  ls: *: No such file or directory
> etc.

This is probably related to the fact that the UNIX tools provided by MinGW
are based on Cygwin.  Cygwin performs some magic that, at runtime, enables
or disables the pre-main() automatic glob expansion depending on whether the
application is run inside or outside of the Cygwin environment.

> So the ls command works fine.  Oh and it is not the fact
> that ls is part of msys.  If you replace ls with notepad.exe
> the expansion behaviour is correct as well.

notepad.exe, like most native Windows applications, performs its own
glob expansion.

Cheers,
-mjg
-- 
Matthew Gregan                     |/
                                  /|                address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]