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

Tar.create: include entries for all directories #106

Merged
merged 1 commit into from
Apr 22, 2021

Conversation

StefanKarpinski
Copy link
Member

Issue #103 points out that omitting directory entries for non-empty directories can confuse some tools that consume tarballs, including docker, which applies overly restrictive permissions to directories which are not explicitly included in a tarball.

This commit changes Tar.create and Tar.rewrite to produce tarballs which include explicit directory entries for all (non-root) directories. This changes Tar.jl's "canonical format", which is, by design one-to-one with git tree hashes. However, it does not seem like anyone currently depends on that exact reproducibility and it seems worth making this change in order to avoid confusing external consumers of our tarballs.

Closes #103.

@codecov
Copy link

codecov bot commented Apr 22, 2021

Codecov Report

Merging #106 (1a40250) into master (9316af8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #106   +/-   ##
=======================================
  Coverage   96.29%   96.30%           
=======================================
  Files           4        4           
  Lines         648      649    +1     
=======================================
+ Hits          624      625    +1     
  Misses         24       24           
Impacted Files Coverage Δ
src/create.jl 97.09% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9316af8...1a40250. Read the comment docs.

@StefanKarpinski
Copy link
Member Author

Aside: I'm quite pleased that the test changes required for this are minimal but not non-existent. That means that we are testing whether we record non-empty directories or not, so the format cannot accidentally change without triggering a test failure. But at the same time, the tests are not overly tightly coupled to the exact format.

Issue #103 points out that omitting directory entries for non-empty
directories can confuse some tools that consume tarballs, including
docker, which applies overly restrictive permissions to directories
which are not explicitly included in a tarball.

This commit changes `Tar.create` and `Tar.rewrite` to produce tarballs
which include explicit directory entries for all (non-root) directories.
This changes Tar.jl's "canonical format", which is, by design one-to-one
with git tree hashes. However, it does not seem like anyone currently
depends on that exact reproducibility and it seems worth making this
change in order to avoid confusing external consumers of our tarballs.

Closes #103.
@StefanKarpinski StefanKarpinski merged commit ada4f12 into master Apr 22, 2021
@StefanKarpinski StefanKarpinski deleted the sk/directory-entries branch April 22, 2021 03:40
@StefanKarpinski StefanKarpinski changed the title Tar.create: include entries for non-empty directories Tar.create: include entries for all directories Feb 2, 2023
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.

Not recording non-empty directories is problematic
1 participant