perl5
perl5 copied to clipboard
Win32 stat() didn't handle AF_UNIX socket files
Unfortunately both symbolic links and sockets can only be "statted" by opening with FILE_FLAG_OPEN_REPARSE_POINT which obviously doesn't follow symbolic links.
So to find if a chain of symbolic links points to a socket, is a broken chain, or loops, we need to follow the chain ourselves.
Fixes #20204
Just a small heads up: I'm planning on doing some testing with this and some reviewing;
(so if possible: wait with merging until I had a chance to test/review)
(so if possible: wait with merging until I had a chance to test/review)
That's no problem.
One test is failing, though I don't see why yet.
One test is failing, though I don't see why yet.
It succeeds sometimes, but mostly fails. I haven't managed to get it to fail locally, and DrMemory (like valgrind) isn't showing anything relevant that I can see.
It succeeds sometimes, but mostly fails.
Or it was, I can't get it to fail in CI at all now.
FWIW, this 20204-stat-socket branch is fine for me when I build it on Windows 11 using gcc-12, where _WIN32_WINNT is 0x0a00 - though some of the TODO tests fail, and the only archtype I've tested is MSWin32-x64-multi-thread.
With the same archtype and same compiler on Windows 7, t/win32/stat.t doesn't run to completion. When run outside the Test::Harness, it terminates with:
....
ok 46 - filename '"' shouldn't exist
ok 47 # skip Cannot create unix socket
Label not found for "last SKIP" at ./test.pl line 535.
Something awry with the SKIP construction ?
It also fails some TODO tests.
Of course, there's a couple of questionable practices being undertaken on Windows 7:
- AIUI, Windows 7 is technically not supported any more;
- Using a compiler that has _WIN32_WINNT set to 0xa00 (Windows 10) on a Windows 7 machine seems a bit dubious.
But this has not been a problem before with gcc-12 builds of perl on Windows 7 - so long as optimization is set to -Os (which I think has just recently become the default optimization setting in blead's win32/GNUmakefile).
Cheers, Rob
The failing TODO tests are for bugs that had been reported against Win32 stat() before I re-worked it, unfortunately they seem to be Windows limits (or bugs, I guess).