cosmopolitan icon indicating copy to clipboard operation
cosmopolitan copied to clipboard

Windows bash script hangs but shell runs

Open chancyk opened this issue 6 months ago • 0 comments

OS : Windows 11 Pro Cosmos: 3.1.3 Cosmocc: 3.1.3

I'm trying to compile a Nim C file with cosmocc which works fine from within the bash shell, but hangs indefinitely if I invoke the same command from a script like:

export PATH="/C/Bin/cosmos/bin:/C/Bin/cosmocc/bin"
cd /C/Bin/cosmocc
./bin/cosmocc $*
exit 0

image

With --strace, cosmocc seems to churn indefinitely on:

SYS  15840  13036      2'041'625'954 readlinkat(AT_FDCWD, "C:/", [""]) → -1 EINVAL
SYS  15840  13036      2'041'770'592 readlinkat(AT_FDCWD, "C:/", [""]) → -1 EINVAL
SYS  15840  13036      2'041'921'260 readlinkat(AT_FDCWD, "C:/", [""]) → -1 EINVAL
SYS  15840  13036      2'042'118'201 readlinkat(AT_FDCWD, "C:/", [""]) → -1 EINVAL
SYS  15840  13036      2'042'743'730 readlinkat(AT_FDCWD, "C:/", [""]) → -1 EINVAL

And --ftrace:

FUN  10532   2368     13'985'177'440   4'152               &readlink
FUN  10532   2368     13'985'228'212   4'168                 &readlinkat
FUN  10532   2368     13'985'295'248   4'232                   &__zipos_notat
FUN  10532   2368     13'985'350'250   5'288                     &__zipos_parseuri
FUN  10532   2368     13'985'401'501   4'232                   &sys_readlinkat_nt
FUN  10532   2368     13'985'453'065   4'296                     &__sig_block
FUN  10532   2368     13'985'508'165   4'296                     &sys_readlinkat_nt_impl
FUN  10532   2368     13'985'560'347   6'488                       &__mkntpathat
FUN  10532   2368     13'985'617'133   6'504                         &__mkntpathath
FUN  10532   2368     13'985'705'492   6'536                           &__mkntpathath_impl
FUN  10532   2368     13'985'758'135   8'632                             &_isutf8
FUN  10532   2368     13'985'809'414   8'664                               &strlen
FUN  10532   2368     13'985'868'190   8'632                             &__mkntpath2
FUN  10532   2368     13'985'919'212   8'712                               &tprecode8to16
FUN  10532   2368     13'985'971'162   8'712                               &__normntpath
FUN  10532   2368     13'986'023'274   8'712                               &memmove
FUN  10532   2368     13'986'074'257   6'536                           &GetFileAttributes
FUN  10532   2368     13'986'165'790   6'488                       &strlen16
FUN  10532   2368     13'986'226'936  12'520                       &CreateFile
FUN  10532   2368     13'986'299'788  12'504                       &GetFileType
FUN  10532   2368     13'986'354'768  12'504                       &GetFileInformationByHandle
FUN  10532   2368     13'986'415'089  12'520                       &DeviceIoControl
FUN  10532   2368     13'986'477'038  12'504                       &CloseHandle
FUN  10532   2368     13'986'541'441   4'296                     &__sig_unblock
FUN  10532   2368     13'986'594'882   4'328                       &__sig_check
FUN  10532   2368     13'986'648'762   4'360                         &__sig_getter
FUN  10532   2368     13'986'699'846   4'152               &strchrnul
FUN  10532   2368     13'986'750'448   4'152               &memmove
FUN  10532   2368     13'986'800'426   4'152               &__errno_location

Any ideas what might be going on here?

chancyk avatar Dec 17 '23 22:12 chancyk