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

Use Sys.isexecutable() to calculate git hashes #2253

Merged
merged 3 commits into from
Dec 3, 2020
Merged

Conversation

staticfloat
Copy link
Sponsor Member

Since our libuv now understands file permissions better on windows, we can finally use Sys.isexecutable() on Windows. :)

Since our libuv now understands file permissions better on windows, we can finally use `Sys.isexecutable()` on Windows.  :)
@StefanKarpinski StefanKarpinski added the backport 1.6 Change should be backported to release-1.6 label Dec 1, 2020
@StefanKarpinski StefanKarpinski added this to the 1.6 milestone Dec 1, 2020
@KristofferC
Copy link
Sponsor Member

One of the tests stopped being broken so I pushed a commit that tweaked that. However, another test seems to have started to break:

git tree hash computation: Test Failed at C:\projects\pkg-jl\test\new.jl:2315
  Expression: "0a890bd10328d68f6d85efd2535e3a4c588ee8e6" == tree_hash(dir)
   Evaluated: "0a890bd10328d68f6d85efd2535e3a4c588ee8e6" == "952cfce0fb589c02736482fa75f9f9bb492242f8"

This prevents different umasks and platform permissions defaults from
interfering with our git tree hashing tests.
@staticfloat
Copy link
Sponsor Member Author

This is actually a good thing! The test was assuming an initial permissions that wasn't true on Windows, but because we were permissions blind before, the test still passed. I've changed it to now explicitly set the permissions of the file, so we should be good to go on that test.

@KristofferC KristofferC closed this Dec 3, 2020
@KristofferC KristofferC reopened this Dec 3, 2020
@KristofferC KristofferC merged commit 0f5c26e into master Dec 3, 2020
@KristofferC KristofferC deleted the sf/isexecutable branch December 3, 2020 13:25
KristofferC pushed a commit that referenced this pull request Dec 3, 2020
* Use Sys.isexecutable() to calculate git hashes

Since our libuv now understands file permissions better on windows, we can finally use `Sys.isexecutable()` on Windows.  :)

* change a test to no longer be broken

* Explicitly set permissions of file before treehashing

This prevents different umasks and platform permissions defaults from
interfering with our git tree hashing tests.

Co-authored-by: KristofferC <[email protected]>
(cherry picked from commit 0f5c26e)
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]>
KristofferC added a commit that referenced this pull request Dec 5, 2020
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Dec 17, 2020
staticfloat added a commit that referenced this pull request Jan 6, 2021
* Use Sys.isexecutable() to calculate git hashes

Since our libuv now understands file permissions better on windows, we can finally use `Sys.isexecutable()` on Windows.  :)

* change a test to no longer be broken

* Explicitly set permissions of file before treehashing

This prevents different umasks and platform permissions defaults from
interfering with our git tree hashing tests.

Co-authored-by: KristofferC <[email protected]>
(cherry picked from commit 0f5c26e)
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