Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sys.isexecutable() to use new jl_fs_access() API call #35625

Merged
merged 2 commits into from
May 14, 2020

Conversation

staticfloat
Copy link
Sponsor Member

This pull request bumps the libuv version to include JuliaLang/libuv#6, which un-breaks Sys.isexecutable() on Windows.

@JeffBezanson
Copy link
Sponsor Member

fixes #33212?

@staticfloat
Copy link
Sponsor Member Author

staticfloat commented Apr 28, 2020

Yes. Finally. :)

To test, you can use this function. On current Julia, reports all filesystems on Windows to be permissions-blind, with this change, most filesystems on windows are not reported as permissions-blind. (FAT32 may still be, I haven't tested that)

@staticfloat
Copy link
Sponsor Member Author

Alright the windows tests are failing because there's an assumption in the test suite that chmod(file, mode) and stat(file) == mode will work for the writable bit, and that not true on Windows right now because the way stat() works is different from how I have changed access() and chmod().

Is it worthwhile for me to go and fix stat() as well, or should we just disable this test for now? It doesn't seem critical to me right now, and it doesn't impact git tree hashing (Which is what motivates me).

base/sysinfo.jl Outdated Show resolved Hide resolved
@StefanKarpinski StefanKarpinski added this to the 1.5 milestone Apr 30, 2020
@staticfloat
Copy link
Sponsor Member Author

Turns out the error is because we aren't setting the (independent from ACLs) readonly bit anymore in this PR. I've got a new PR to libuv here that fixes this: JuliaLang/libuv#8

base/sysinfo.jl Outdated Show resolved Hide resolved
base/sysinfo.jl Outdated Show resolved Hide resolved
@staticfloat staticfloat force-pushed the sf/uv_fs_access branch 7 times, most recently from 416dd64 to 4ec36c9 Compare May 6, 2020 21:28
…ls on windows

These updates use the Windows ACL APIs to ask whether a file is truly
executable or not, allowing us to properly `chmod()` and `access()` to
set/get the executable bit reliably on windows.
`jl_fs_access()` makes use of the `uv_fs_access()` call from LibUV,
which is newly-able to interrogate Win32 ACLs, determining whether a
file is truly executable or not on Windows.

Also update `chmod()` to note that on windows, recursive is effectively
always true.
@staticfloat
Copy link
Sponsor Member Author

Thanks to Jameson's proddings, I think I've actually found a combination of flags that gives us the expected behavior of chmod() on all platforms. I've added some new tests, let's see if they pass on all platforms. If they do, I'm totally happy with this PR and we can merge it.

@staticfloat staticfloat merged commit 08861c7 into master May 14, 2020
@staticfloat staticfloat deleted the sf/uv_fs_access branch May 14, 2020 17:16
@staticfloat staticfloat modified the milestones: 1.5, 1.6 May 15, 2020
StefanKarpinski added a commit to JuliaIO/Tar.jl that referenced this pull request Dec 4, 2020
Unbekownst to me, Windows defaults to files being executable, so we were
incorrectly extracting normal files as executables. We didn't detect
this because until JuliaLang/julia#35625 we were
blind to the executable bit on Windows. With that change, however, we
can now tell that we are incorrectly leaving normal files executable.
JuliaLang/Pkg.jl#2253 fixes Pkg's
GitTools.tree_hash and in the process breaks our tests since they now
correctly detect that we are extracting non-executable files incorrectly
on Windows. This PR fixes that, making tests pass again with that fix.
StefanKarpinski added a commit to JuliaIO/Tar.jl that referenced this pull request Dec 4, 2020
Unbekownst to me, Windows defaults to files being executable, so we were
incorrectly extracting normal files as executables. We didn't detect
this because until JuliaLang/julia#35625 we were
blind to the executable bit on Windows. With that change, however, we
can now tell that we are incorrectly leaving normal files executable.
JuliaLang/Pkg.jl#2253 fixes Pkg's
GitTools.tree_hash and in the process breaks our tests since they now
correctly detect that we are extracting non-executable files incorrectly
on Windows. This PR fixes that, making tests pass again with that fix.
StefanKarpinski added a commit to JuliaIO/Tar.jl that referenced this pull request Dec 4, 2020
Unbekownst to me, Windows defaults to files being executable, so we were
incorrectly extracting normal files as executables. We didn't detect
this because until JuliaLang/julia#35625 we were
blind to the executable bit on Windows. With that change, however, we
can now tell that we are incorrectly leaving normal files executable.
JuliaLang/Pkg.jl#2253 fixes Pkg's
GitTools.tree_hash and in the process breaks our tests since they now
correctly detect that we are extracting non-executable files incorrectly
on Windows. This PR fixes that, making tests pass again with that fix.

* Use `Sys.isexecutable()` on Windows to determine file mode
* Manually set permissions while copying symlinks
* copy mode recursively for copied symlinks on Windows
* use a copy of `Pkg.GitTools.tree_hash` with `isexecutable` fix

Co-authored-by: Elliot Saba <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants