Artifacts Associated With Ticket 914108ffffffffff
Ticket change [29ee6f5717] (rid 118468) by p_samson on 2004-03-11 13:13:33:
- assignee initialized to: "vincentdarley"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OS: Windows/Cygwin $ tclsh % exec gzip --version gzip 1.3.5 % exec gunzip --version couldn't execute "gunzip": no such file or directory % exec /usr/bin/gunzip --version couldn't execute "D:\cygwin\bin\gunzip": invalid argument % exec /usr/bin/gunzip.exe --version gzip 1.3.5 $ ls -l /usr/bin/gunzip lrwxrwxrwx 1 Samson Users 19 Nov 27 15:20 /usr/bin/gunzip -> gzip.exe So, gunzip is a link. Fine, why not. But why exec is not able to consider links when searching for the target in its known directories? Does it work on a pure Unix box? Please amend the doc to state that. (I didn't see anything in 8.4.5)
- foundin initialized to: "obsolete: 8.4.1"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "p_samson"
- subsystem initialized to: "36. Pathname Management"
- title initialized to:
windows: exec doesn't find symlink without full path
- type initialized to: "Bug"
Ticket change [90554ba07a] (rid 120434) by vincentdarley on 2004-03-22 19:31:32:
- assignee changed to: "mdejong"
Ticket change [b2c7d64166] (rid 98402) by vincentdarley on 2004-03-22 19:31:33:
- icomment:
Logged In: YES user_id=32170 I have no knowledge of cygwin, so re-assigning.
- login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [77074e30e1] (rid 105693) by davygrvy on 2004-06-03 13:53:02:
- icomment:
Logged In: YES user_id=7549 symlinks from bash aren't file system entities with cygwin. To see, open gunzip.exe into notepad and you get: !<symlink>gzip.exe that text file doesn't have a valid PE header, therefore it connot be run as an executable because it isn't one. If it was up to me, I'd mark this bug report invalid and close it.
- login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [c1695df54d] (rid 111314) by davygrvy on 2004-06-03 15:15:16:
- icomment:
Logged In: YES user_id=7549 To put it another way, there aren't any Win32 functions to decode a cygwin symlink text file.
- login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [16f32a2587] (rid 124801) by p_samson on 2004-06-03 19:43:10:
- icomment:
Logged In: YES user_id=994002 David, Thanks for pointing how cygwin symlink are made. I understand that they are not real exe. But I would not consider this report invalid and closed, unless you can explain why: exec /usr/bin/gunzip.exe works but exec /usr/bin/gunzip exec gunzip do not.
- login: "p_samson"
- mimetype: "text/plain"
- username: "p_samson"
- icomment:
Ticket change [8be8a38d7f] (rid 127659) by dgp on 2004-06-03 20:23:33:
- icomment:
Logged In: YES user_id=80530 Has the submitter tried: eval exec [auto_execok gunzip] ? That's the more reliable, recommended construct.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [8cf2bde7fa] (rid 127829) by hobbs on 2004-06-03 23:27:29:
- closedate changed to: "2004-06-03T16:27:29"
- closer changed to: "hobbs"
- icomment:
Logged In: YES user_id=72656 auto_execok is the way to go: (Tcl) 49 % auto_execok gunzip C:/cygwin/bin/gunzip.EXE In any case, the reason that only the full path works is because that is the only valid exe from Windows point of view. Cygwin does lots of bizarre pseudo-Windows stuff that just isn't valid from the real Windows point of view.
- login: "hobbs"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- username: "hobbs"
Ticket change [688c3a85ed] (rid 103089) by dgp on 2004-06-03 23:42:37:
- icomment:
Logged In: YES user_id=80530 then just watch out for Bug 954263. It's fixed now, but will cause trouble if you're using Tcl 8.5a1
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [25b787944f] (rid 88218) by p_samson on 2004-06-04 21:45:39:
- icomment:
Logged In: YES user_id=994002 OK for auto_execok if it helps to find the path to the executable to gunzip. But I still find a little strange that %exec gzip works without any help. Both files are located at the same place: D:\cygwin\bin\gzip.exe D:\cygwin\bin\gunzip.exe The only difference is that the latter doesn't have a real executable struture, but [auto_execok gunzip] neither. Now, another point of frustration: % exec [auto_execok gunzip] x.gz gzip: x.gz already has .gz suffix -- unchanged gzip.exe is executed as expected but it checks if it has been so with the application name 'gun*' to know if decompression must be exerciced. If you look at tcl8.4.1\win\tclWinPipe.c: if ((*tclWinProcs->createProcessProc)(NULL, (TCHAR *) Tcl_DStringValue(&cmdLine), NULL, NULL, TRUE, (DWORD) createFlags, NULL, NULL, &startInfo, &procInfo) == 0) { The first argument is lpApplicationName. If it contains 'gunzip' then gzip.exe knows it must decompress. With NULL, the application name is taken from the second argument, which contains 'gzip', so compression is selected. Any chances to have the application name included in the process creation call? - login: "p_samson"
- mimetype: "text/plain"
- username: "p_samson"
- icomment:
Ticket change [9e86550a2b] (rid 96485) by davygrvy on 2004-06-05 02:50:46:
- icomment:
Logged In: YES user_id=7549 But if you look earlier in TclpCreateProcess, you'll see that ApplicationType() reads the PE header of gunzip.exe and find that it is invalid as an executable.
- login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [987b64af55] (rid 110608) by nobody on 2004-06-05 12:20:04:
- icomment:
Logged In: NO Even the command shell doesn't know what to do with it: Microsoft Windows 2000 [Version 5.00.2195] (C) Copyright 1985-2000 Microsoft Corp. C:\cygwin\bin>gunzip C:\cygwin\bin>
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"
- icomment:
Ticket change [ae675c21e3] (rid 101634) by p_samson on 2004-06-05 13:51:31:
- icomment:
Logged In: YES user_id=994002 My mistake. Remember that I run a Cygwin version, not a Windows version. I shouldn't have mention tclWinPipe.c, but tclUnixPipe.c. In TclpCreateProcess, the call is to execvp(newArgv[0], newArgv); execvp is in winsup\cygwin\exec.cc. I didn't find anything obvious in a few minutes, for this comment. Comparison should be done with a bash shell, not a cmd.exe: $ gunzip --version gunzip 1.3.5
- login: "p_samson"
- mimetype: "text/plain"
- username: "p_samson"
- icomment:
Ticket change [aae1a940ec] (rid 100997) by nobody on 2004-06-05 21:15:52:
- icomment:
Logged In: NO Then you should send a bug report to the cygwin folks as execvp() is not in the Tcl code.
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"
- icomment:
Ticket change [c1201747f7] (rid 111274) by p_samson on 2004-06-06 15:48:45:
- icomment:
Logged In: YES user_id=994002 Well, I had to browse deeper in code, and strace.exe the runs to know more. First let's correct some of my wrong previous assertions: - Forget tclUnixPipe.c and execvp(). For the cygwin package tclWinPipe.c is used. - Forget what I wrote about lpApplicationName. Even directly from bash, a CreateProcess() is called with lpApplicationName = "C:\cygwin\bin\gzip.exe" lpCommandLine="C:\cygwin\bin\gzip.exe /tmp/some.gz" Now, what I think is the explanation: bash uses spawn.cc. CreateProcess() is called in spawn_guts() of this source, with extra information in lpStartupInfo.lpReserved2 (which should be NULL for a MSC Runtime exe). This info will provide the argv for the child process, but with the replacement of argv[0]: newargv.replace0_maybe (prog_arg); That's how gzip.exe gets its arg[0] as "/bin/gunzip.exe". Note: the cygwin starter also supports lpReserved2 as NULL, but then all this wizardry for arg[0] is missing. I guess there is no way for TCL to satisfy these cygwin internals, so I'm on my own to replace every "gunzip" with "gzip -d" in the tcl-based open source products I use. And for any !<symlink> form of exe as well. Thanks anyway to all for your comments and assistance.
- login: "p_samson"
- mimetype: "text/plain"
- username: "p_samson"
- icomment: