git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [StGIT] Not working on Windows with msysgit.
@ 2008-07-28 17:29 Jurko Gospodnetić
  2008-08-04  9:25 ` Karl Hasselström
  0 siblings, 1 reply; 2+ messages in thread
From: Jurko Gospodnetić @ 2008-07-28 17:29 UTC (permalink / raw)
  To: git

   Hi.

   I believe StGIT fails to work on Windows with msysgit installed 
because of the way it runs its external executables. It assumes that the 
executable is available on the path and is named exactly 'git'.

   This however is not the case on Windows with msysgit installed. There 
the 'git executable' is a batch script named git.cmd and stgit fails to 
find it causing all git calls to return an error code.

   Popen() calls in StGIT's run.py module seem to run their executables 
(git & gitk only as far as I saw from the sources) directly instead of 
running them through the shell in order to have the shell try all the 
default extensions (configured on Windows using the PATHEXT environment 
variable).

   One 'fix' that corrects this in all the use cases on Windows that I 
tried is to add the shell=True parameter to all Popen() calls in StGIT's 
run.py module (one in __run_io() and one in __run_noio()). This would 
however require more testing as I do not know how this would affect 
other OSs or whether there might be some problems with how Windows's 
default cmd shell handles quoting in the executed command lines. I do 
recall Python having some serious problems with these quoting in 
executed commands... something about external quotes getting stripped in 
some cases... I might be able to dig up a workaround from somewhere if 
needed...

   I'm using Windows XP SP3 and my git/StGIT/Python version information is:
> Stacked GIT 0.14.3
> git version 1.5.6.1.1071.g76fb
> Python version 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]

   Anyone using StGIT on Windows with sysgit?

   The place where I originally detected this problem is that StGIT 
fails to read the stgit.editor configuration option with 
Windows/msysgit. I think it got so far though only because I also had 
cygwin git a bit later on the path.

   Best regards,
     Jurko Gospodnetić

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [StGIT] Not working on Windows with msysgit.
  2008-07-28 17:29 [StGIT] Not working on Windows with msysgit Jurko Gospodnetić
@ 2008-08-04  9:25 ` Karl Hasselström
  0 siblings, 0 replies; 2+ messages in thread
From: Karl Hasselström @ 2008-08-04  9:25 UTC (permalink / raw)
  To: Jurko Gospodneti?; +Cc: git, Catalin Marinas

On 2008-07-28 19:29:49 +0200, Jurko Gospodneti? wrote:

> I believe StGIT fails to work on Windows with msysgit installed
> because of the way it runs its external executables. It assumes that
> the executable is available on the path and is named exactly 'git'.

Yes, that's correct.

> This however is not the case on Windows with msysgit installed.
> There the 'git executable' is a batch script named git.cmd and stgit
> fails to find it causing all git calls to return an error code.
>
> Popen() calls in StGIT's run.py module seem to run their executables
> (git & gitk only as far as I saw from the sources) directly instead
> of running them through the shell in order to have the shell try all
> the default extensions (configured on Windows using the PATHEXT
> environment variable).
>
> One 'fix' that corrects this in all the use cases on Windows that I
> tried is to add the shell=True parameter to all Popen() calls in
> StGIT's run.py module (one in __run_io() and one in __run_noio()).
> This would however require more testing

Don't do that, please.

The reason to not go via the shell is that that way, we don't have to
worry about quoting. That's a big pile of bugs that we never have to
see again.

Plus, it's also slightly faster (especially on Windows, I guess) not
to have to spawn a shell.

It'd be _much_ better to just be a little more flexible about which
git command to use. Maybe look at PATHEXT if we're on Windows, or
maybe let the user configure the location of git at stg install time.
(RFC) patches welcome: :-)

> I do recall Python having some serious problems with these quoting
> in executed commands... something about external quotes getting
> stripped in some cases... I might be able to dig up a workaround
> from somewhere if needed...

That's the shell doing a level of unquoting. Nothing Python specific.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-04  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-28 17:29 [StGIT] Not working on Windows with msysgit Jurko Gospodnetić
2008-08-04  9:25 ` Karl Hasselström

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).