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

Fix empty fields causing AR reader to fail #130

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rgmz
Copy link

@rgmz rgmz commented Jun 6, 2024

This fixes #129.

Comment on lines +151 to +154
entryField{"Timestamp", &entry.Timestamp}: line[16:28],
entryField{"OwnerID", &entry.OwnerID}: line[28:34],
entryField{"GroupID", &entry.GroupID}: line[34:40],
entryField{"Size", &entry.Size}: line[48:58],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this struct because it makes errors clearer and debugging easier. If this isn't desirable, I can remove it.

@rgmz
Copy link
Author

rgmz commented Jun 23, 2024

Hey @paultag, I was curious if you had any insights into this.

It seems that ar files can contain special entries (/ and // meaning symbol table and extended filename table respectively1), hence why some fields are empty. My understanding is that the // entry and the /0 entry are for the same file. I'm not sure if my proposed fix is sufficient, or if additional pre-processing is desirable.

e.g., ar x long.a2 results in a single file named name-longer-than-16-bytes.gox. This seems to differ from this library's current behaviour.

$ cat long.a
!<arch>
/               1478713642  0     0     0       4         `
//                                              32        `
name-longer-than-16-bytes.gox/

/0              1478713628  10556 5000  100664  577       `
ELF>�@@v1;
package foo;
pkgpath blah;
priority 1;
func F ();
checksum F9F6C8FE0C9E3CDD5A09D2996847B4E9992D8118;
.symtab.strtab.shstrtab.go_exporti�&0   @

Footnotes

  1. https://en.wikipedia.org/wiki/Ar_(Unix)#System_V_(or_GNU)_variant

  2. https://github.com/openshift/ci-operator-prowgen/blob/ee31ec067b4670222de32ceecd01184b4eb52db3/vendor/golang.org/x/tools/go/gccgoexportdata/testdata/long.a

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 this pull request may close these issues.

Ar.Next() error: strconv.Atoi: parsing \"\": invalid syntax
1 participant