Retain file permissions when shading monolithic jars.

Review Request #3420 — Created Feb. 4, 2016 and submitted

gmalmquist
pants
gmalmquist/fix-shaded-jar-permissions
2885
pants-reviews
benjyw, nhoward_tw, stuhood
On some systems (macos at least), the atomic_copy function at the
end of the jar shading process would cause the file permissions to
be set to '-rw-------', instead of the normal '-rw-r--r--', because
of the permissions of the temporary file that atomic_copy creates.

This change simply records the permissions of the jar before
shading, and chmod's the shaded jar to have whatever permissions it
had previously.

Added an integration test to test_shader_integration.py.

CI went green here: https://travis-ci.org/pantsbuild/pants/builds/107310100

  • 0
  • 0
  • 2
  • 0
  • 2
Description From Last Updated
NH
  1. 
      
  2. How about moving this into atomic_copy? I think it makes sense for atomic_copy to copy permissions as well as the file. Currently this is the only usage of atomic_copy, but if it were used somewhere else, it would be surprising that it changes the permissions.

    Also, it might be more atomic to do the permissions change on the temp file before the rename.

  3. 
      
GM
ST
  1. Ship It!
  2. 
      
NH
  1. Ship It!
  2. 
      
BE
  1. Nice!

    1. I assume you mean the inverse of that

    2. Ooops, yeah... :)

  2. 
      
GM
BE
  1. Ship It!
  2. 
      
GM
GM
Review request changed

Status: Closed (submitted)

Change Summary:

In commit 37fdcb7d35b8673223ae77a5747c678b8e4c13d5. Thanks Stu, Nick, and Benjy!

Loading...