JuliaLang / libuv

Cross-platform asynchronous I/O
http://libuv.org/
MIT License
9 stars 14 forks source link

Address review comments on libuv patch #16

Open staticfloat opened 4 years ago

staticfloat commented 4 years ago

This hopefully addresses the two actionable comments from @erw7. In particular:

musm commented 3 years ago

Does this solve issues like the following:

mkdir("C:\\test")
chmod("C:\\test", 0o777)
rm("C:\\test") # currently a permission denied error

# On the other hand, without chmod
mkdir("C:\\test")
rm("C:\\test") # works
vtjnash commented 3 years ago

bump

vtjnash commented 2 years ago

bump

staticfloat commented 2 years ago

With the latest commit on windows:

mktempdir() do dir
    foo = joinpath(dir, "foo")
    @info("default")
    touch(foo)
    run(`icacls $(foo)`)

    for perm in (0o777, 0o757, 0o750, 0o600)
        @info(string(perm, base=8))
        chmod(foo, perm)
        run(`icacls $(foo)`)
        @show Sys.isexecutable(foo)
    end
end

Results in:

[ Info: default
C:\Users\Administrator\AppData\Local\Temp\jl_zAzid9\foo NT AUTHORITY\SYSTEM:(I)(F)
                                                        BUILTIN\Administrators:(I)(F)
                                                        DEBUGGING-AMDCI\Administrator:(I)(F)

Successfully processed 1 files; Failed processing 0 files
[ Info: 777
C:\Users\Administrator\AppData\Local\Temp\jl_zAzid9\foo BUILTIN\Administrators:(M,DC)
                                                        DEBUGGING-AMDCI\None:(M,DC)
                                                        Everyone:(M,DC)
                                                        NT AUTHORITY\SYSTEM:(M,DC)
                                                        DEBUGGING-AMDCI\Administrator:(M,DC)

Successfully processed 1 files; Failed processing 0 files
Sys.isexecutable(foo) = true
[ Info: 757
C:\Users\Administrator\AppData\Local\Temp\jl_zAzid9\foo BUILTIN\Administrators:(M,DC)
                                                        DEBUGGING-AMDCI\None:(RX,WA)
                                                        Everyone:(RX,WA)
                                                        NT AUTHORITY\SYSTEM:(RX,WA)
                                                        DEBUGGING-AMDCI\Administrator:(RX,WA)

Successfully processed 1 files; Failed processing 0 files
Sys.isexecutable(foo) = true
[ Info: 750
C:\Users\Administrator\AppData\Local\Temp\jl_zAzid9\foo BUILTIN\Administrators:(M,DC)
                                                        DEBUGGING-AMDCI\None:(RX,WA)
                                                        DEBUGGING-AMDCI\Administrator:(RX,WA)

Successfully processed 1 files; Failed processing 0 files
Sys.isexecutable(foo) = true
[ Info: 600
C:\Users\Administrator\AppData\Local\Temp\jl_zAzid9\foo BUILTIN\Administrators:(R,W,D,DC)

Successfully processed 1 files; Failed processing 0 files
Sys.isexecutable(foo) = false

Which I think all looks good to me. I also added some icacls calls to remove all ACE entries, hoping that this would cause the ACL to return NULL, and it continued to function just fine:

mktempdir() do dir
    foo = joinpath(dir, "foo")
    @info("default")
    touch(foo)
    run(`icacls $(foo)`)

    @info("NULL")
    run(`icacls $(foo) /inheritance:d`)
    run(`icacls $(foo) /remove "NT AUTHORITY\\SYSTEM"`)
    run(`icacls $(foo) /remove BUILTIN\\Administrators`)
    run(`icacls $(foo) /remove Administrator`)
    run(`icacls $(foo)`)

    for perm in (0o777, 0o757, 0o750, 0o600)
        @info(string(perm, base=8))
        chmod(foo, perm)
        run(`icacls $(foo)`)
        @show Sys.isexecutable(foo)
    end
end
[ Info: default
C:\Users\Administrator\AppData\Local\Temp\jl_3cqGE6\foo NT AUTHORITY\SYSTEM:(I)(F)
                                                        BUILTIN\Administrators:(I)(F)
                                                        DEBUGGING-AMDCI\Administrator:(I)(F)

Successfully processed 1 files; Failed processing 0 files
[ Info: NULL
processed file: C:\Users\Administrator\AppData\Local\Temp\jl_3cqGE6\foo
Successfully processed 1 files; Failed processing 0 files
processed file: C:\Users\Administrator\AppData\Local\Temp\jl_3cqGE6\foo
Successfully processed 1 files; Failed processing 0 files
processed file: C:\Users\Administrator\AppData\Local\Temp\jl_3cqGE6\foo
Successfully processed 1 files; Failed processing 0 files
processed file: C:\Users\Administrator\AppData\Local\Temp\jl_3cqGE6\foo
Successfully processed 1 files; Failed processing 0 files
C:\Users\Administrator\AppData\Local\Temp\jl_3cqGE6\foo 
Successfully processed 1 files; Failed processing 0 files
[ Info: 777
C:\Users\Administrator\AppData\Local\Temp\jl_3cqGE6\foo BUILTIN\Administrators:(M,DC)
                                                        DEBUGGING-AMDCI\None:(M,DC)
                                                        Everyone:(M,DC)

Successfully processed 1 files; Failed processing 0 files
Sys.isexecutable(foo) = true
[ Info: 757
C:\Users\Administrator\AppData\Local\Temp\jl_3cqGE6\foo BUILTIN\Administrators:(M,DC)
                                                        DEBUGGING-AMDCI\None:(RX,WA)
                                                        Everyone:(RX,WA)

Successfully processed 1 files; Failed processing 0 files
Sys.isexecutable(foo) = true
[ Info: 750
C:\Users\Administrator\AppData\Local\Temp\jl_3cqGE6\foo BUILTIN\Administrators:(M,DC)
                                                        DEBUGGING-AMDCI\None:(RX,WA)

Successfully processed 1 files; Failed processing 0 files
Sys.isexecutable(foo) = true
[ Info: 600
C:\Users\Administrator\AppData\Local\Temp\jl_3cqGE6\foo BUILTIN\Administrators:(R,W,D,DC)

Successfully processed 1 files; Failed processing 0 files
Sys.isexecutable(foo) = false
vtjnash commented 2 years ago

CI is unhappy with this currently:

D:\a\libuv\libuv\src\win\fs.c(2448,3): warning C4013: 'build_access_struct' undefined; assuming extern returning int D:\a\libuv\libuv\src\win\fs.c(2518,37): error C2065: 'S_IWUSR': undeclared identifier D:\a\libuv\libuv\src\win\fs.c(2518,47): error C2065: 'S_IWGRP': undeclared identifier D:\a\libuv\libuv\src\win\fs.c(2518,56): error C2065: 'S_IWOTH': undeclared identifier D:\a\libuv\libuv\src\win\fs.c(2521,37): error C2065: 'S_IWUSR': undeclared identifier D:\a\libuv\libuv\src\win\fs.c(2521,47): error C2065: 'S_IWGRP': undeclared identifier D:\a\libuv\libuv\src\win\fs.c(2521,56): error C2065: 'S_IWOTH': undeclared identifier
vtjnash commented 2 years ago

we can merge once CI passes

staticfloat commented 1 year ago

I can't tell if CI is passing 😅

vtjnash commented 1 year ago

Fair point, but let's say at least "builds" even if it does not then pass all tests

staticfloat commented 1 year ago

It does build on our windows CI machines, which is where I tested it. What build status should I pay attention to here that says it doesn't build?

vtjnash commented 1 year ago

The console here for GitHub actions splits up the jobs by stage. FWIW, it is an MSVC thing, probably where the definitions are supposed to have a leading _ but where mingw-w64 adds extra ones without the underscore for simplicity

staticfloat commented 1 year ago

I tried using _mode_t, but it doesn't know that one either. I decided to just use DWORD, since this variable is completely of our own construction anyway.

vtjnash commented 1 year ago

still failing CI

D:\a\libuv\libuv\src\win\fs.c(2432,41): error C2065: 'S_IRWXU': undeclared identifier [D:\a\libuv\libuv\build\uv.vcxproj]
[104](https://github.com/JuliaLang/libuv/actions/runs/3621315770/jobs/6104606485#step:4:105)
staticfloat commented 1 year ago

Hmmm, should I #define those if they're missing?

vtjnash commented 1 year ago

yep

vtjnash commented 1 year ago

bump?

vtjnash commented 9 months ago

bump?