Respect tar entries modes when rewriting them on Windows#32959
Respect tar entries modes when rewriting them on Windows#32959tonistiigi merged 1 commit intomoby:masterfrom
Conversation
Previously, only perm-related bits where preserved when rewriting FileMode in tar entries on Windows. This had the nasty side effect of having tarsum returning different values when executing from a tar filed produced on Windows or Linux. This fix the issue, and pave the way for incremental build context to work in hybrid contexts. Signed-off-by: Simon Ferquel <[email protected]>
|
@tonistiigi I'm not sure if it could have some nasty side effects (like invalidating existing images SHA etc.). could you PTAL ? |
tonistiigi
left a comment
There was a problem hiding this comment.
LGTM
This should not affect existing images. Headers for them are already stored in tar-split files. It will break build cache for windows but that should be ok.
| func chmodTarEntry(perm os.FileMode) os.FileMode { | ||
| perm &= 0755 | ||
| //perm &= 0755 // this 0-ed out tar flags (like link, regular file, directory marker etc.) | ||
| permPart := perm & os.ModePerm |
There was a problem hiding this comment.
It is for readability: make it very explicits that the bits are splitted between a permission block, and the other bits.
As os.ModePerm and the other litterals used in bitwise computations here are compile-time constant, I assume all of this will be optimized away, and opted for clarity.
|
ping @jhowardmsft @johnstep PTAL |
|
@jstarks PTAL. The change looks reasonable, but I'm concerned it breaks builder caches. As Tonis said, that's probably OK. |
|
LGTM |
Previously, only perm-related bits where preserved when rewriting
FileMode in tar entries on Windows. This had the nasty side effect of
having tarsum returning different values when executing from a tar filed
produced on Windows or Linux.
This fix the issue, and pave the way for incremental build context
to work in hybrid contexts.
Signed-off-by: Simon Ferquel [email protected]
- What I did
Modified the chmodTarEntry function on Windows, to copy without any modification bits not related with file permissions
- How I did it
Combination of bitmasks
- How to verify it
Unit tests are included:
- Description for the changelog
Fixed an issue in tar packaging on Windows where some entries did not have the correct flags
- A picture of a cute animal (not mandatory but encouraged)
