-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
pkg/archive:CopyTo(): fix for long dest filename #38634
Conversation
As reported in docker/for-linux/issues/484, since Docker 18.06 docker cp with a destination file name fails with the following error: > archive/tar: cannot encode header: Format specifies USTAR; and USTAR cannot encode Name="a_very_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_long_filename_that_is_101_characters" The problem is caused by changes in Go 1.10 archive/tar, which mis-guesses the tar stream format as USTAR (rather than PAX), which, in turn, leads to inability to specify file names longer than 100 characters. This tar stream is sent by TarWithOptions() (which, since we switched to Go 1.10, explicitly sets format=PAX for every file, see FileInfoHeader(), and before Go 1.10 it was PAX by default). Unfortunately, the receiving side, RebaseArchiveEntries(), which calls tar.Next(), mistakenly guesses header format as USTAR, which leads to the above error. The fix is easy: set the format to PAX in RebaseArchiveEntries() where we read the tar stream and change the file name. A unit test is added to prevent future regressions. NOTE this code is not used by dockerd, but rather but docker cli (also possibly other clients), so this needs to be re-vendored to cli in order to take effect. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
janky failure
is well known flaky test, #32673 |
reserved for Derek commands |
Nice to see Derek being put to use 👍 |
Codecov Report
@@ Coverage Diff @@
## master #38634 +/- ##
=========================================
Coverage ? 36.94%
=========================================
Files ? 610
Lines ? 45669
Branches ? 0
=========================================
Hits ? 16871
Misses ? 26475
Partials ? 2323 |
This might cause image-cache breakage because |
ping @tonistiigi @dmcgowan PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (issue is indeed fix with this change)
Caught up with @tonistiigi to verify if this would affect caching, and we should be good to go, so I'll go ahead and merge. Feel free to continue the discussion though if there are things we overlooked |
@cyphar as far as I remember, the sending side already takes care of this, see Lines 365 to 368 in 44af96c
|
relevant changes; - moby/moby#38006 / docker-archive/engine#114 client: use io.LimitedReader for reading HTTP error - moby/moby#38634 / docker-archive/engine#167 pkg/archive:CopyTo(): fix for long dest filename - fixes docker/for-linux#484 for 18.09 - moby/moby#38944 / docker-archive/engine#183 gitutils: add validation for ref - moby/moby#37780 / docker-archive/engine#55 pkg/progress: work around closing closed channel panic - addresses moby/moby#/37735 pkg/progress: panic due to race on shutdown Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
relevant changes; - moby/moby#38006 / docker-archive/engine#114 client: use io.LimitedReader for reading HTTP error - moby/moby#38634 / docker-archive/engine#167 pkg/archive:CopyTo(): fix for long dest filename - fixes docker/for-linux#484 for 18.09 - moby/moby#38944 / docker-archive/engine#183 gitutils: add validation for ref - moby/moby#37780 / docker-archive/engine#55 pkg/progress: work around closing closed channel panic - addresses moby/moby#/37735 pkg/progress: panic due to race on shutdown Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 010c234a0d5a03d450ebec60be37dd9f279feeca Component: cli
relates to #35739
As reported in docker/for-linux/issues/484, since Docker 18.06
docker cp with a destination file name fails with the following error:
The problem is caused by changes in Go 1.10 archive/tar, which
mis-guesses the tar stream format as USTAR (rather than PAX),
which, in turn, leads to inability to specify file names
longer than 100 characters.
This tar stream is sent by TarWithOptions() (which, since we switched to
Go 1.10, explicitly sets format=PAX for every file, see FileInfoHeader(),
and before Go 1.10 it was PAX by default). Unfortunately, the receiving
side, RebaseArchiveEntries(), which calls tar.Next(), mistakenly guesses
header format as USTAR, which leads to the above error.
The fix is easy: set the format to PAX in RebaseArchiveEntries()
where we read the tar stream and change the file name.
A unit test is added to prevent future regressions.
NOTE this code is not used by dockerd, but rather but docker cli
(also possibly other clients), so this needs to be re-vendored
to cli in order to take effect.
- A picture of a cute animal (not mandatory but encouraged)
from Cheburashka