This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fails to launch batch script in some directories


On 2018-04-20 06:33, David Macek wrote:
> Whoa, an interesting bug.  I'm forwarding this to the Cygwin mailing list for
> reference.  I might take a deeper look over the weekend if no-one beats me to it.
> 
> It seems like running batch files (.bat, .cmd) inside a directory with an at
> sign and a space (such as '@ x' or 'x @') fails.
> 
> /w/temp/@ x$ ./hello.bat
> 'W:\temp\@' is not recognized as an internal or external command,
> operable program or batch file.

>From strace on cmd run from directory created with same name, looks like
child_info_spawn::worker may need to escape/double quote the name if it contains
spaces:

   65  119143 [main] bash 9384 spawnve: spawnve (./ntpstatus.cmd,
./ntpstatus.cmd, 0x60006F6B0)
   34  119177 [main] bash 9384 child_info_spawn::worker: mode = 3, prog_arg =
./ntpstatus.cmd
   36  119213 [main] bash 9384 perhaps_suffix: prog './ntpstatus.cmd'
   30  119243 [main] bash 9384 normalize_posix_path: src ./ntpstatus.cmd
   28  119271 [main] bash 9384 cwdstuff::get: posix /proc/cygdrive/c/.../@ x
   29  119300 [main] bash 9384 cwdstuff::get: (/proc/cygdrive/c/.../@ x) =
cwdstuff::get (0x600000010, 32768, 1, 0), errno 108
   29  119329 [main] bash 9384 normalize_posix_path: /proc/cygdrive/c/.../@
x/ntpstatus.cmd = normalize_posix_path (./ntpstatus.cmd)
   30  119359 [main] bash 9384 mount_info::conv_to_win32_path:
conv_to_win32_path (/proc/cygdrive/c/.../@ x/ntpstatus.cmd)
   33  119392 [main] bash 9384 mount_info::cygdrive_win32_path: src
'/proc/cygdrive/c/.../@ x/ntpstatus.cmd', dst 'C:\...\@ x\ntpstatus.cmd'
   33  119425 [main] bash 9384 set_flags: flags: binary (0x2)
   28  119453 [main] bash 9384 mount_info::conv_to_win32_path: src_path
/proc/cygdrive/c/.../@ x/ntpstatus.cmd, dst C:\...\@ x\ntpstatus.cmd, flags
0x4022, rc 0
  153  119606 [main] bash 9384 symlink_info::check: 0x0 = NtCreateFile
(\??\C:\...\@ x\ntpstatus.cmd)
   85  119691 [main] bash 9384 symlink_info::check: not a symlink
   79  119770 [main] bash 9384 symlink_info::check: 0 = symlink.check(C:\...\@
x\ntpstatus.cmd, 0xFFFFA850) (0x4022)
   55  119825 [main] bash 9384 path_conv::check: this->path(C:\...\@
x\ntpstatus.cmd), has_acls(1)
   35  119860 [main] bash 9384 perhaps_suffix: buf C:\...\@ x\ntpstatus.cmd,
suffix found ''
   90  119950 [main] bash 9384 child_info_spawn::worker: priority class 32
   95  120045 [main] bash 9384 fhandler_console::need_invisible: invisible_console 0
   39  120084 [main] bash 9384 build_env: envp 0x60006F6B0
   38  120122 [main] bash 9384 spenv::retrieve: no_envblock 0
   40  120162 [main] bash 9384 spenv::retrieve: duping existing value for
'USERDOMAIN='
   48  120210 [main] bash 9384 spenv::retrieve: no_envblock 0
   39  120249 [main] bash 9384 spenv::retrieve: duping existing value for
'USERNAME='
   29  120278 [main] bash 9384 spenv::retrieve: no_envblock 0
   28  120306 [main] bash 9384 spenv::retrieve: duping existing value for
'LOGONSERVER='
   35  120341 [main] bash 9384 spenv::retrieve: no_envblock 0
   32  120373 [main] bash 9384 spenv::retrieve: no_envblock 0
   27  120400 [main] bash 9384 spenv::retrieve: duping existing value for
'USERPROFILE='
   29  120429 [main] bash 9384 spenv::retrieve: no_envblock 0
   27  120456 [main] bash 9384 spenv::retrieve: duping existing value for
'SYSTEMROOT='
   43  120499 [main] bash 9384 spenv::retrieve: no_envblock 0
   31  120530 [main] bash 9384 spenv::retrieve: duping existing value for 'WINDIR='
   37  120567 [main] bash 9384 spenv::retrieve: no_envblock 0
   30  120597 [main] bash 9384 spenv::retrieve: no_envblock 0
   27  120624 [main] bash 9384 spenv::retrieve: duping existing value for
'HOMEDRIVE='
   33  120657 [main] bash 9384 spenv::retrieve: no_envblock 0
   28  120685 [main] bash 9384 spenv::retrieve: duping existing value for
'HOMEPATH='
   34  120719 [main] bash 9384 build_env: env count 108, bytes 9407
  324  121043 [main] bash 9384 build_env: envp 0x180306DA8, envc 108
   34  121077 [main] bash 9384 child_info::child_info: subproc_ready 0x0
20253  141330 [main] bash 9384 child_info_spawn::worker: pid 9384, prog_arg
./ntpstatus.cmd, cmd line "C:\...\@ x\ntpstatus.cmd")
  102  141432 [main] bash 9384! child_info_spawn::worker: new process name
\\?\C:\...\@ x\ntpstatus.cmd
   56  141488 [main] bash 9384! fhandler_base::close_with_arch: line 1129:
/dev/pty0<0x1803054F0> usecount + -1 = 3
   31  141519 [main] bash 9384! fhandler_base::close_with_arch: not closing
archetype
   67  141586 [main] bash 9384! fhandler_base::close_with_arch: line 1129:
/dev/pty0<0x1803054F0> usecount + -1 = 2
   33  141619 [main] bash 9384! fhandler_base::close_with_arch: not closing
archetype
   34  141653 [main] bash 9384! fhandler_base::close_with_arch: line 1129:
/dev/pty0<0x1803054F0> usecount + -1 = 1
   35  141688 [main] bash 9384! fhandler_base::close_with_arch: not closing
archetype
   38  141726 [main] bash 9384! child_info_spawn::worker: spawned windows pid 9260
   52  141778 [main] bash 9384! proc_subproc: args: 1, -2145357536
--- Process 9260 created
--- Process 9384 thread 8320 created
  306  142084 [main] bash 9384! pinfo::wait: created tracking thread for pid
9384, winpid 0x242C, rd_proc_pipe 0x284
   48  142132 [main] bash 9384! proc_subproc: added pid 9384 to proc table, slot 0
   45  142177 [main] bash 9384! proc_subproc: returning 1
--- Process 9260 loaded C:\Windows\System32\ntdll.dll at 00007ffb92730000
   89  142266 [waitproc] bash 9384! cygthread::stub: thread 'waitproc', id
0x2080, stack_ptr 0x329CCD0
--- Process 9260 loaded C:\Windows\System32\kernel32.dll at 00007ffb918e0000
--- Process 9260 loaded C:\Windows\System32\KernelBase.dll at 00007ffb8f750000
--- Process 9260 loaded C:\Windows\System32\msvcrt.dll at 00007ffb91840000
--- Process 9260 thread 5056 created
--- Process 2844 created
--- Process 2844 loaded C:\Windows\System32\ntdll.dll at 00007ffb92730000
--- Process 2844 loaded C:\Windows\System32\kernel32.dll at 00007ffb918e0000
--- Process 2844 loaded C:\Windows\System32\KernelBase.dll at 00007ffb8f750000
--- Process 2844 loaded C:\Windows\System32\msvcrt.dll at 00007ffb91840000
--- Process 2844 thread 5964 created
--- Process 2844 thread 32 created
--- Process 2844 loaded C:\Windows\System32\ulib.dll at 00007ffb7dcd0000
--- Process 2844 thread 6228 created
--- Process 2844 loaded C:\Windows\System32\fsutilext.dll at 00007ffb8a980000
--- Process 2844 thread 5964 exited with status 0x0
--- Process 2844 thread 6228 exited with status 0x0
--- Process 2844 thread 32 exited with status 0x0
--- Process 2844 exited with status 0x0
--- Process 9260 thread 5056 exited with status 0x1
--- Process 9260 exited with status 0x1
45516  187782 [waitproc] bash 9384! pinfo::maybe_set_exit_code_from_windows: pid
9384, exit value - old 0x0, windows 0x1, cygwin 0x8000100
  110  187892 [waitproc] bash 9384! proc_waiter: exiting wait thread for pid 9384
   47  187939 [main] bash 9384! proc_terminate: nprocs 1
   81  188020 [main] bash 9384! proc_subproc: args: 5, 1
   80  188100 [main] bash 9384! proc_subproc: clear waiting threads
   47  188147 [main] bash 9384! proc_subproc: finished clearing
   34  188181 [main] bash 9384! proc_subproc: returning 1
   30  188211 [main] bash 9384! cygthread::terminate_thread: thread '(null)', id
0x2080, inuse 0, stack_ptr 0x329CCD0
   31  188242 [main] bash 9384! proc_terminate: leaving
   30  188272 [main] bash 9384! pinfo::maybe_set_exit_code_from_windows: pid
9384, exit value - old 0x8000100, windows 0xDEADBEEF, cygwin 0x8000100
   55  188327 [main] bash 9384! pinfo::exit: Calling ExitProcess n 0x4000000,
exitcode 0x1

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]