This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
forked from moby/moby
-
Notifications
You must be signed in to change notification settings - Fork 423
[18.09 backport] pkg/archive:CopyTo(): fix for long dest filename #167
Merged
andrewhsu
merged 1 commit into
docker-archive:18.09
from
thaJeztah:18.09_backport_cp_longname
Mar 6, 2019
Merged
[18.09 backport] pkg/archive:CopyTo(): fix for long dest filename #167
andrewhsu
merged 1 commit into
docker-archive:18.09
from
thaJeztah:18.09_backport_cp_longname
Mar 6, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> (cherry picked from commit f55a417) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
After this is merged, we need to update the cli vendor as well 😅 ping @kolyshkin @andrewhsu |
(for the reference, this is a backport of moby#38634) LGTM |
andrewhsu
approved these changes
Mar 6, 2019
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
thaJeztah
added a commit
to thaJeztah/cli
that referenced
this pull request
Mar 27, 2019
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>
docker-jenkins
pushed a commit
to docker-archive/docker-ce
that referenced
this pull request
Mar 27, 2019
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
3 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
relates to moby#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.
Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com
(cherry picked from commit f55a417)
Signed-off-by: Sebastiaan van Stijn github@gone.nl
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)