{"thread":{"id":"14725","subject":"[StGIT] Not working on Windows with msysgit.","startedAt":"2008-07-28T17:29:49Z","lastAt":"2008-08-04T09:25:51Z","messageCount":2,"participants":["Jurko Gospodnetić","Karl Hasselström"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"85309","messageId":"g6kvmc$sqr$1@ger.gmane.org","threadId":"14725","inReplyTo":null,"subject":"[StGIT] Not working on Windows with msysgit.","fromName":"Jurko Gospodnetić","fromEmail":"jurko.gospodnetic@docte.hr","sentAt":"2008-07-28T17:29:49Z","receivedAt":"2008-07-28T17:29:49Z","isPatch":false,"sender":{"key":"jurko.gospodnetic@docte.hr","avatar":null},"body":"   Hi.\n\n   I believe StGIT fails to work on Windows with msysgit installed \nbecause of the way it runs its external executables. It assumes that the \nexecutable is available on the path and is named exactly 'git'.\n\n   This however is not the case on Windows with msysgit installed. There \nthe 'git executable' is a batch script named git.cmd and stgit fails to \nfind it causing all git calls to return an error code.\n\n   Popen() calls in StGIT's run.py module seem to run their executables \n(git & gitk only as far as I saw from the sources) directly instead of \nrunning them through the shell in order to have the shell try all the \ndefault extensions (configured on Windows using the PATHEXT environment \nvariable).\n\n   One 'fix' that corrects this in all the use cases on Windows that I \ntried is to add the shell=True parameter to all Popen() calls in StGIT's \nrun.py module (one in __run_io() and one in __run_noio()). This would \nhowever require more testing as I do not know how this would affect \nother OSs or whether there might be some problems with how Windows's \ndefault cmd shell handles quoting in the executed command lines. I do \nrecall Python having some serious problems with these quoting in \nexecuted commands... something about external quotes getting stripped in \nsome cases... I might be able to dig up a workaround from somewhere if \nneeded...\n\n   I'm using Windows XP SP3 and my git/StGIT/Python version information is:\n> Stacked GIT 0.14.3\n> git version 1.5.6.1.1071.g76fb\n> Python version 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]\n\n   Anyone using StGIT on Windows with sysgit?\n\n   The place where I originally detected this problem is that StGIT \nfails to read the stgit.editor configuration option with \nWindows/msysgit. I think it got so far though only because I also had \ncygwin git a bit later on the path.\n\n   Best regards,\n     Jurko Gospodnetić\n"},{"id":"86166","messageId":"20080804092551.GC9425@diana.vm.bytemark.co.uk","threadId":"14725","inReplyTo":"g6kvmc$sqr$1@ger.gmane.org","subject":"Re: [StGIT] Not working on Windows with msysgit.","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-08-04T09:25:51Z","receivedAt":"2008-08-04T09:25:51Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-07-28 19:29:49 +0200, Jurko Gospodneti? wrote:\n\n> I believe StGIT fails to work on Windows with msysgit installed\n> because of the way it runs its external executables. It assumes that\n> the executable is available on the path and is named exactly 'git'.\n\nYes, that's correct.\n\n> This however is not the case on Windows with msysgit installed.\n> There the 'git executable' is a batch script named git.cmd and stgit\n> fails to find it causing all git calls to return an error code.\n>\n> Popen() calls in StGIT's run.py module seem to run their executables\n> (git & gitk only as far as I saw from the sources) directly instead\n> of running them through the shell in order to have the shell try all\n> the default extensions (configured on Windows using the PATHEXT\n> environment variable).\n>\n> One 'fix' that corrects this in all the use cases on Windows that I\n> tried is to add the shell=True parameter to all Popen() calls in\n> StGIT's run.py module (one in __run_io() and one in __run_noio()).\n> This would however require more testing\n\nDon't do that, please.\n\nThe reason to not go via the shell is that that way, we don't have to\nworry about quoting. That's a big pile of bugs that we never have to\nsee again.\n\nPlus, it's also slightly faster (especially on Windows, I guess) not\nto have to spawn a shell.\n\nIt'd be _much_ better to just be a little more flexible about which\ngit command to use. Maybe look at PATHEXT if we're on Windows, or\nmaybe let the user configure the location of git at stg install time.\n(RFC) patches welcome: :-)\n\n> I do recall Python having some serious problems with these quoting\n> in executed commands... something about external quotes getting\n> stripped in some cases... I might be able to dig up a workaround\n> from somewhere if needed...\n\nThat's the shell doing a level of unquoting. Nothing Python specific.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"}]}