Junio tagged Git 1.5.5, but unfortunately msysgit still fails too many
tests to build an installer.
I still have only little time for the git development; but I at least
started to have a look at the first test that fails (see below).
On Mar 17, 2008, at 4:54 PM, Eyvind Bernhardsen wrote:
>
> On 16. mars. 2008, at 23.33, Steffen Prohaska wrote:
>
> > 24 test fail for me. I did not have the time to investigate the
> > reasons. I pushed regardless. In case someone wants to help,
> > here are the failing tests:
>
> I don't know how much help it is, but I've done a little investigation:
Thanks Eyvind. Although I had no time to respond to your investigation
immediately, I did not forget about it.
>
> > *** t3903-stash.sh ***
> > * FAIL 8: drop middle stash
> > * FAIL 9: stash pop
>
> This fails because the git wrapper somehow mangles "[EMAIL PROTECTED]" into
> "[EMAIL PROTECTED]". Running the test manually with "git-stash" instead of
> "git stash" works.
>
Either CreateProcess or the shell launched eat the {} (see below).
Hannes,
I think you wrote most of the argument quoting code. Any idea what's
happening here.
I added two trace lines to quote_arg() and mingw_spawnve() (see patch
below). The command line that fails now prints the following:
$ git stash drop [EMAIL PROTECTED]
trace: exec: 'git-stash' 'drop' '[EMAIL PROTECTED]'
trace: quote_arg: C:/msysgit/bin/sh.exe
trace: quote_arg: C:/msysgit/bin/git-stash
trace: quote_arg: drop
trace: quote_arg: [EMAIL PROTECTED]
trace: CreateProcess lpCommandLine: C:/msysgit/bin/sh.exe
C:/msysgit/bin/git-stash drop [EMAIL PROTECTED]
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--is-inside-work-tree'
trace: built-in: git 'rev-parse' '--show-cdup'
trace: built-in: git 'rev-parse' '--revs-only' '--no-flags' '[EMAIL
PROTECTED]'
[EMAIL PROTECTED]: not a valid stashed state
You can see that up to CreateProcess everything looks good but the
launched shell does not receive the right argument, as you can see in
the last two lines.
Escaping the { as \\{ helps. The first '\' is needed for the shell
parsing the command line. It is removed before CreateProcess sees the
argument. The second '\' is removed either by CreateProcess or by the
shell launched by CreateProcess. All I can say is that it is removed
before the argument is passed to rev-parse. Here is the trace:
$ git stash drop [EMAIL PROTECTED]
trace: exec: 'git-stash' 'drop' '[EMAIL PROTECTED]'
trace: quote_arg: C:/msysgit/bin/sh.exe
trace: quote_arg: C:/msysgit/bin/git-stash
trace: quote_arg: drop
trace: quote_arg: [EMAIL PROTECTED]
trace: CreateProcess lpCommandLine: C:/msysgit/bin/sh.exe
C:/msysgit/bin/git-stash drop [EMAIL PROTECTED]
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--is-inside-work-tree'
trace: built-in: git 'rev-parse' '--show-cdup'
trace: built-in: git 'rev-parse' '--revs-only' '--no-flags' '[EMAIL
PROTECTED]'
trace: built-in: git 'reflog' 'delete' '--updateref' '--rewrite' '[EMAIL
PROTECTED]'
Dropped [EMAIL PROTECTED] (62df21684d6cebbea74289ac20f05129aa13a998)
Here are the calls to trace:
diff --git a/compat/mingw.c b/compat/mingw.c
index a5b43bc..54beeb6 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -378,6 +378,7 @@ static const char *quote_arg(const char *arg)
int force_quotes = 0;
char *q, *d;
const char *p = arg;
+ trace_printf("trace: quote_arg: %s\n", arg);
if (!*p) force_quotes = 1;
while (*p) {
if (isspace(*p) || *p == '*' || *p == '?')
@@ -628,6 +629,7 @@ static pid_t mingw_spawnve(const char *cmd, const char
**argv, char **env,
free(sorted_env);
}
+ trace_printf("trace: CreateProcess lpCommandLine: %s\n", args.buf);
memset(&pi, 0, sizeof(pi));
ret = CreateProcess(cmd, args.buf, NULL, NULL, TRUE, flags,
env ? envblk.buf : NULL, NULL, &si, &pi);
Steffen