cygexec strangeness

Christopher Layne clayne@anodized.com
Sat Jan 20 11:27:00 GMT 2007


Kind of strange.
Am I missing something on how cygexec is supposed to be used?

$ cat o.c
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char **argv)
{
        int r;

        if ((r = open(argv[1], O_RDONLY)) < 0)
                perror("open");

        return 0;
}

$ gcc -g3 -ansi -pedantic -o o o.c
$ ./o o.c
$ mount -f -b -s -X 'c:\cygwin' /
$ ./o o.c
$ strace ./o o.c
strace: error creating process o, (error 2)
strace: error creating process o, (error 2)
strace: error creating process o, (error 2)
strace: error creating process o, (error 2)
strace: error creating process o, (error 2)
strace: error creating process o, (error 2)

I don't get that, but I'll presume it's intertwined with what
I'm asking about.

$ PATH="/var/tmp:$PATH" strace o o.c
[...]

   56   54874 [main] o 19080 open: open (o.c, 0x0)
   35   54909 [main] o 19080 normalize_posix_path: src o.c
   23   54932 [main] o 19080 cwdstuff::get: posix /c/WINDOWS/system32
   22   54954 [main] o 19080 cwdstuff::get: (/c/WINDOWS/system32) = cwdstuff::get (0x22C8A0, 260, 1, 0), errno 0
   21   54975 [main] o 19080 normalize_posix_path: /c/WINDOWS/system32/o.c = normalize_posix_path (o.c)
   23   54998 [main] o 19080 mount_info::conv_to_win32_path: conv_to_win32_path (/c/WINDOWS/system32/o.c)
   23   55021 [main] o 19080 mount_info::cygdrive_win32_path: src '/c/WINDOWS/system32/o.c', dst 'c:\WINDOWS\system32\o.c'
   21   55042 [main] o 19080 set_flags: flags: binary (0x2)
   83   55125 [main] o 19080 mount_info::conv_to_win32_path: src_path /c/WINDOWS/system32/o.c, dst c:\WINDOWS\system32\o.c, flags 0x2A, rc 0
  137   55262 [main] o 19080 symlink_info::check: GetFileAttributes (c:\WINDOWS\system32\o.c) failed
   25   55287 [main] o 19080 geterrno_from_win_error: windows error 2 == errno 2
   51   55338 [main] o 19080 symlink_info::check: GetFileAttributes (c:\WINDOWS\system32\o.c.lnk) failed
   24   55362 [main] o 19080 geterrno_from_win_error: windows error 2 == errno 2
   22   55384 [main] o 19080 symlink_info::check: 0 = symlink.check (c:\WINDOWS\system32\o.c, 0x22C560) (0x2A)
   21   55405 [main] o 19080 mount_info::conv_to_win32_path: conv_to_win32_path (/c/WINDOWS/system32)
   20   55425 [main] o 19080 mount_info::cygdrive_win32_path: src '/c/WINDOWS/system32', dst 'c:\WINDOWS\system32'
   20   55445 [main] o 19080 set_flags: flags: binary (0x2)
   20   55465 [main] o 19080 mount_info::conv_to_win32_path: src_path /c/WINDOWS/system32, dst c:\WINDOWS\system32, flags 0x2A, rc 0
   39   55504 [main] o 19080 symlink_info::check: not a symlink
   22   55526 [main] o 19080 symlink_info::check: 0 = symlink.check (c:\WINDOWS\system32, 0x22C560) (0x2A)
   72   55598 [main] o 19080 path_conv::check: this->path(c:\WINDOWS\system32\o.c), has_acls(1)
   31   55629 [main] o 19080 build_fh_pc: fh 0x611B2E08
   58   55687 [main] o 19080 fhandler_base::open: (c:\WINDOWS\system32\o.c, 0x100000)
   62   55749 [main] o 19080 seterrno_from_win_error: /netrel/src/cygwin-snapshot-20070110-1/winsup/cygwin/fhandler.cc:710 windows error 2
   24   55773 [main] o 19080 geterrno_from_win_error: windows error 2 == errno 2
   20   55793 [main] o 19080 __set_errno: void seterrno_from_win_error(const char*, int, DWORD):310 val 2
   19   55812 [main] o 19080 fhandler_base::open: C0000034 = NtCreateFile (0x0, 80100000, c:\WINDOWS\system32\o.c, io, NULL, 0, 7, 1, 4020, NULL, 0)
   20   55832 [main] o 19080 fhandler_base::open: 0 = fhandler_base::open (c:\WINDOWS\system32\o.c, 0x100000)
   17   55849 [main] o 19080 fhandler_base::open_fs: 0 = fhandler_disk_file::open (c:\WINDOWS\system32\o.c, 0x0)
   18   55867 [main] o 19080 open: -1 = open (o.c, 0x0)

[...]

What's the obsession with c/w/system32 ?

$ PATH="/var/tmp:$PATH" strace o /var/tmp/o.c
   43   34889 [main] o 52328 fhandler_base::open: (c:\cygwin\var\tmp\o.c, 0x100000)
   38   34927 [main] o 52328 fhandler_base::set_flags: flags 0x100000, supplied_bin 0x10000
   19   34946 [main] o 52328 fhandler_base::set_flags: filemode set to binary
   16   34962 [main] o 52328 fhandler_base::open: 0 = NtCreateFile (0x6F0, 80100000, c:\cygwin\var\tmp\o.c, io, NULL, 0, 7, 1, 4020, NULL, 0)
   18   34980 [main] o 52328 fhandler_base::open: 1 = fhandler_base::open (c:\cygwin\var\tmp\o.c, 0x100000)
   17   34997 [main] o 52328 fhandler_base::open_fs: 1 = fhandler_disk_file::open (c:\cygwin\var\tmp\o.c, 0x0)
   16   35013 [main] o 52328 open: 3 = open (/var/tmp/o.c, 0x0)

Hmmm...

$ mount -f -b -s 'c:\cygwin' /
$ strace ./o o.c
   36   41956 [main] o 37300 fhandler_base::open: (c:\cygwin\var\tmp\o.c, 0x100000)
   36   41992 [main] o 37300 fhandler_base::set_flags: flags 0x100000, supplied_bin 0x10000
   18   42010 [main] o 37300 fhandler_base::set_flags: filemode set to binary
   16   42026 [main] o 37300 fhandler_base::open: 0 = NtCreateFile (0x6F0, 80100000, c:\cygwin\var\tmp\o.c, io, NULL, 0, 7, 1, 4020, NULL, 0)
   17   42043 [main] o 37300 fhandler_base::open: 1 = fhandler_base::open (c:\cygwin\var\tmp\o.c, 0x100000)
   16   42059 [main] o 37300 fhandler_base::open_fs: 1 = fhandler_disk_file::open (c:\cygwin\var\tmp\o.c, 0x0)
   17   42076 [main] o 37300 open: 3 = open (o.c, 0x0)

BTW: It only does it during debugging with strace or gdb.

Looking for old threads, someone mentioned something in
regards to execvp/lp, but in my case it's just an open():

http://sourceware.org/ml/cygwin/2006-01/msg01477.html

Other than that can't really find anything previous...

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list