JuliaIO / Tar.jl

TAR files: create, list, extract them in pure Julia
MIT License
79 stars 19 forks source link

Tar.create: include entries for all directories #106

Closed StefanKarpinski closed 3 years ago

StefanKarpinski commented 3 years ago

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[bot] commented 3 years ago

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%) :arrow_up:

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 commented 3 years ago

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.