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

Support reading AIX big archive format #462

Merged
merged 5 commits into from
Sep 18, 2022
Merged

Conversation

ecnelises
Copy link
Contributor

@ecnelises ecnelises commented Sep 8, 2022

The archive format on AIX is called 'big archive' (see definition at https://www.ibm.com/docs/en/aix/7.3?topic=formats-ar-file-format-big), which is quite different from BSD and GNU variants.

This PR will add support for reading it, as part of the efforts porting Rust toolchain onto AIX. (Writing facility was done by wrapping LLVM upstream code in rust-lang/ar_archive_writer#2)

Also thanks to contribution from @jsji.

src/read/archive.rs Outdated Show resolved Hide resolved
src/archive.rs Show resolved Hide resolved
src/read/archive.rs Outdated Show resolved Hide resolved
src/read/archive.rs Outdated Show resolved Hide resolved
src/read/archive.rs Outdated Show resolved Hide resolved
src/read/archive.rs Outdated Show resolved Hide resolved
src/read/archive.rs Outdated Show resolved Hide resolved
src/read/archive.rs Outdated Show resolved Hide resolved
src/read/archive.rs Outdated Show resolved Hide resolved
src/archive.rs Outdated Show resolved Hide resolved
@ecnelises ecnelises requested review from philipc and bjorn3 and removed request for philipc and bjorn3 September 15, 2022 02:57
@ecnelises ecnelises marked this pull request as ready for review September 15, 2022 02:58
@philipc
Copy link
Contributor

philipc commented Sep 15, 2022

Why did you remove the fixed header definition?

@ecnelises
Copy link
Contributor Author

Why did you remove the fixed header definition?

It's rather an internal structure only used in file structure recognition part (ArchiveFile::parse). I thought it's enough to read the whole part as bytes and parse.

@philipc
Copy link
Contributor

philipc commented Sep 15, 2022

I think it's part of the file format, which is an external structure, and it's documented as such in the link you gave. I prefer if you add it back in please.

Also, please don't mark conversation as resolved. It's better if I mark them as resolved myself once I have reviewed.

Use 'AixFileHeader' to avoid confusion.
Copy link
Contributor

@philipc philipc left a comment

Choose a reason for hiding this comment

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

Thanks! I'll do some style changes in a following PR.

@philipc philipc merged commit 13c1392 into gimli-rs:master Sep 18, 2022
@philipc
Copy link
Contributor

philipc commented Sep 18, 2022

Is there a reason you didn't use the member table at the end of the archive that is pointed to by the fl_memoff field? My concern that is by using ar_nxtmem, a malformed file could cause an infinite loop.

@ecnelises
Copy link
Contributor Author

Ah, I did not think of such case when nxtmem is malformed (not a reasonable scenario to me at first). But yes, linked list may cause infinite loop. I'll try and post a new PR to iterate over the member table for offsets.

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.

3 participants