Skip to content
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

cmd/pack: Running the same pack command twice creates an invalid archive. #8369

Closed
gopherbot opened this issue Jul 14, 2014 · 4 comments
Closed
Milestone

Comments

@gopherbot
Copy link

by dylan.p.hillier:

go version go1.3 linux/amd64

If you use pack to create an archive, the first time you run the command it works. A
second call to the command will kill the file, making it zero bytes.

Pack should probably just create a new valid file over writing any existing one.

Eg.

[gopher@caddyshack sync]$ /home/gopher/downloads/go/pkg/tool/linux_amd64/pack c
/tmp/go-test/sync/atomic.a /tmp/go-test/sync/atomic/_obj/asm_amd64.6
[gopher@caddyshack sync]$ ll /tmp/go-test/sync/atomic.a
-rw-r--r-- 1 gopher gopher_grp 4.1K Jul 15 07:34 /tmp/go-test/sync/atomic.a
[gopher@caddyshack sync]$ /home/gopher/downloads/go/pkg/tool/linux_amd64/pack c
/tmp/go-test/sync/atomic.a /tmp/go-test/sync/atomic/_obj/asm_amd64.6
pack: file is not an archive: bad header
[gopher@caddyshack sync]$ ll /tmp/go-test/sync/atomic.a
-rw-r--r-- 1 gopher gopher_grp 0 Jul 15 07:35 /tmp/go-test/sync/atomic.a
@ianlancetaylor
Copy link
Contributor

Comment 1:

Looks like "pack c FILE" when FILE already exists truncates FILE and then expects it to
have an archive header.

Labels changed: added repo-main, release-go1.4.

@rsc
Copy link
Contributor

rsc commented Sep 15, 2014

Comment 2:

Status changed to Accepted.

@gopherbot
Copy link
Author

Comment 3:

CL https://golang.org/cl/147010046 mentions this issue.

@robpike
Copy link
Contributor

robpike commented Sep 24, 2014

Comment 4:

This issue was closed by revision 1193993.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
There were at least two bugs:
1) It would overwrite a non-archive.
2) It would truncate a non-archive and then fail.
In general the file handling was too clever to be correct.
Make it more straightforward, doing the creation
separately from archive management.

Fixes golang#8369.

LGTM=adg, iant
R=golang-codereviews, adg, iant
CC=golang-codereviews
https://golang.org/cl/147010046
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
There were at least two bugs:
1) It would overwrite a non-archive.
2) It would truncate a non-archive and then fail.
In general the file handling was too clever to be correct.
Make it more straightforward, doing the creation
separately from archive management.

Fixes golang#8369.

LGTM=adg, iant
R=golang-codereviews, adg, iant
CC=golang-codereviews
https://golang.org/cl/147010046
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
There were at least two bugs:
1) It would overwrite a non-archive.
2) It would truncate a non-archive and then fail.
In general the file handling was too clever to be correct.
Make it more straightforward, doing the creation
separately from archive management.

Fixes golang#8369.

LGTM=adg, iant
R=golang-codereviews, adg, iant
CC=golang-codereviews
https://golang.org/cl/147010046
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants