Skip to content

archive files generated with archive() may be corrupted #363

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

Closed
jayhendren opened this issue Apr 19, 2018 · 4 comments
Closed

archive files generated with archive() may be corrupted #363

jayhendren opened this issue Apr 19, 2018 · 4 comments

Comments

@jayhendren
Copy link

jayhendren commented Apr 19, 2018

Repository archives generated with the archive() method will be corrupted if git archive prints anything to stderr.

When I run git archive commands on the command line, sometimes stuff gets printed to stderr, while the archive itself is output to stdout:

$ git archive --remote=ssh://git@my.git.server/my_git_repo.git master > my_git_repo.tar
X11 forwarding request failed on channel 0
$ file my_git_repo.tar
archive.tar: POSIX tar archive

However, I found that the line X11 forwarding request failed on channel 0 was getting prepended to my archives generated when using ruby-git's archive() method, resulting in a corrupted archive (note that "X1 archive" is not a valid archive type):

$ head -n 1 my_git_repo | strings
X11 forwarding request failed on channel 0
$ file my_git_repo
my_git_repo: X1 archive data

This appears to be because command() indiscriminately redirects stderr to stdout and archive() calls command() while redirecting stdout into the archive file. The upshot is that if git archive prints anything to stderr, the resulting archive will be corrupted.

See also.

@stale stale bot added the wontfix label Jun 18, 2018
@jayhendren
Copy link
Author

This is definitely still an issue. I don't believe I'm the one responsible for lack of progress here?

@stale stale bot removed the wontfix label Jun 18, 2018
@stale stale bot added the wontfix label Aug 17, 2018
@jayhendren
Copy link
Author

Please stop continually marking this issue as stale.

@stale stale bot removed the wontfix label Aug 17, 2018
@tarcinil
Copy link
Contributor

@poohblah I have pinned the issue so that stalebot will stop adding the wontfix.

@jcouball
Copy link
Member

Fixed with #684 and released in git-2.0.0-pre1

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 a pull request may close this issue.

3 participants