Open shunf4 opened 2 weeks ago
I am not the Windows expert, but a general debugging step that often helps with these sorts of things is to run the command again with the cosmopolitan-specific --strace
flag; so like ls.exe --strace ../..
, and then paste in the output.
In this case I wonder if it isn't something weird with backslash vs slash for paths in coreutils, but in that case you'd think it would error rather than listing the contents of the wrong directory...
(also cc @G4Vi who is the Windows... well I don't know if he considers himself an expert or not, but I consider him an expert relative to me for sure.)
Sure, the strace output:
PS C:\Users\shunf4\Portable\cosmo\test\Food\Fruit\Apple> C:\Users\shunf4\Downloads\cosmos-ls.exe --strace ../../
SYS 24860 24860 4'308'672 bell system five system call support 8'253'280 magnums loaded on the new technology
SYS 24860 5256 4'669'356 getenv("_COSMO_FDS") → NULL
SYS 24860 5256 4'800'768 getenv("COSMOPOLITAN_DISABLE_ZIPOS") → NULL
SYS 24860 5256 4'866'168 getenv("COSMOPOLITAN_INIT_ZIPOS") → NULL
SYS 24860 5256 4'931'976 GetProgramExecutableName() → "/C/Users/shunf4/Downloads/cosmos-ls.exe"
SYS 24860 5256 5'188'392 openat(AT_FDCWD, "/C/Users/shunf4/Downloads/cosmos-ls.exe", O_RDONLY) → 3
SYS 24860 5256 5'353'452 fstat(3, [{.st_size=1'099'519, .st_blocks=1'101'824/512, .st_mode=0100700, .st_uid=28388, .st_gid=28388, .st_dev=0x346c42d6, .st_ino=0x540000000e9c20, .st_flags=20}]) → 0
SYS 24860 5256 5'637'324 mmap(0, 1'099'519, PROT_READ, MAP_SHARED, 3, 0) → 0x100080100000 (9'568'256 bytes total)
SYS 24860 5256 5'780'064 munmap(0x100080100000, 983'040) → 0 (8'585'216 bytes total)
SYS 24860 5256 5'849'892 madvise(0x1000801f4000, 90'112, 127) → -1 EINVAL
SYS 24860 5256 5'924'544 mmap(0, 816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) → 0x100080040000 (8'650'752 bytes total)
SYS 24860 5256 6'044'364 close(3) → 0
SYS 24860 5256 6'100'344 __zipos_get("/C/Users/shunf4/Downloads/cosmos-ls.exe") → 0
SYS 24860 5256 6'179'040 mmap(0, 131'072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) → 0x100080060000 (8'781'824 bytes total)
SYS 24860 5256 7'266'192 inflate([u"SYMT☺ l○ ☻ ☻ @ "...], 131'072, u"∞▌ï⌂Åuλ8≡≈↑S*½¶↔ε¼âΦ─PQ╚$Q*+èJm│═╢l╢vp◘Y"..., 32'245) → 0
SYS 24860 5256 7'803'696 GetSymbolTableFromZip() → 0x100080060000
SYS 24860 5256 7'876'884 mmap(0, 65'536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) → 0x100080050000 (8'847'360 bytes total)
SYS 24860 5256 7'926'492 fstat(0, [{.st_size=0, .st_mode=020666, .st_nlink=0, .st_dev=0x77777777, .st_ino=0x4, .st_blksize=512}]) → 0
SYS 24860 5256 7'968'648 getenv("TZ") → NULL
SYS 24860 5256 8'574'552 setenv("TZ", "Asia/Shanghai", true) → 0
SYS 24860 5256 8'614'944 setlocale(6, "") → C
SYS 24860 5256 8'646'792 getenv("POSIXLY_CORRECT") → NULL
SYS 24860 5256 8'674'236 getenv("LS_BLOCK_SIZE") → NULL
SYS 24860 5256 8'700'876 getenv("BLOCK_SIZE") → NULL
SYS 24860 5256 8'727'420 getenv("BLOCKSIZE") → NULL
SYS 24860 5256 8'753'748 getenv("POSIXLY_CORRECT") → NULL
SYS 24860 5256 8'780'496 getenv("BLOCK_SIZE") → NULL
SYS 24860 5256 8'806'752 isatty(1) → true
SYS 24860 5256 8'903'292 tcgetwinsize(1, [{.ws_row=50, .ws_col=120}]) → 0
SYS 24860 5256 8'932'596 getenv("TABSIZE") → NULL
SYS 24860 5256 8'959'632 getenv("QUOTING_STYLE") → NULL
SYS 24860 5256 8'986'464 getenv("TZ") → "Asia/Shanghai"
SYS 24860 5256 9'078'120 fstatat(AT_FDCWD, "../../", [{.st_size=0, .st_mode=040700, .st_uid=28388, .st_gid=28388, .st_dev=0x346c42d6, .st_ino=0x570000000e075b, .st_flags=10}], 0) → 0
SYS 24860 5256 9'194'796 openat(AT_FDCWD, "../../", O_RDONLY|O_CLOEXEC|O_DIRECTORY) → 3
SYS 24860 5256 9'612'000 fstat(3, [{.st_size=0, .st_mode=040700, .st_uid=28388, .st_gid=28388, .st_dev=0x346c42d6, .st_ino=0x570000000e075b, .st_flags=10}]) → 0
SYS 24860 5256 10'363'896 close(3) → 0
Apple1.txt Apple2.txt
SYS 24860 5256 12'866'136 write(1, u"Apple1.txt Apple2.txt◙", 23) → 23
SYS 24860 5256 13'661'676 exit(0)
SYS 24860 5256 14'119'188 __cxa_finalize(close_stdout, 0)
SYS 24860 5256 15'015'576 close(1) → 0
SYS 24860 5256 15'472'848 close(2) → 0
SYS 24860 5256 16'334'700 __cxa_finalize(__gdtoa_Bclear, 0)
SYS 24860 5256 16'792'944 __cxa_finalize(fflush_unlocked, 0)
SYS 24860 5256 17'693'796 _Exit(0)
PS C:\Users\shunf4\Portable\cosmo\test\Food\Fruit\Apple>
I'm happy to look into this. However, it might be a while, I'm busy at least the next two weeks.
What happened?
I downloaded https://cosmo.zip/pub/cosmos/bin/ls and renamed it to
cosmos-ls.exe
. And it doesn't work for relative parent paths like../../
. It printed result for current directory but it should print result in parent's parent.Neither
C:\Users\shunf4\Downloads\cosmos-ls.exe ..\..\
,C:\Users\shunf4\Downloads\cosmos-ls.exe '..\..\'
, norC:\Users\shunf4\Downloads\cosmos-ls.exe '..\\..\\'
worked.Version
At now the latest release of superconfigure says it's built with
jart/cosmopolitan@500a47b
so I think it's the version.What operating system are you seeing the problem on?
Windows
Relevant log output
No response