From 7ab8dda160f246fcf8ca7eac28587f0ecacb42b6 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Wed, 24 Apr 2019 20:50:23 +0200 Subject: [PATCH] Fix gnu archives --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- src/archive.rs | 19 ++----------------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aeca3ecf472..80bc1c90a47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,7 +19,7 @@ dependencies = [ [[package]] name = "ar" version = "0.6.2" -source = "git+https://github.com/mdsteele/rust-ar.git#1cfa68dcecaa063510758e8bdced7115a3393616" +source = "git+https://github.com/bjorn3/rust-ar.git?branch=non_multiple_of_two_identifiers_gnu_format#efa2308b9ded41f4977d4fed98dac7af4d9075cf" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -582,7 +582,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "rustc_codegen_cranelift" version = "0.1.0" dependencies = [ - "ar 0.6.2 (git+https://github.com/mdsteele/rust-ar.git)", + "ar 0.6.2 (git+https://github.com/bjorn3/rust-ar.git?branch=non_multiple_of_two_identifiers_gnu_format)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift 0.30.0 (git+https://github.com/CraneStation/cranelift.git)", @@ -843,7 +843,7 @@ dependencies = [ [metadata] "checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum ar 0.6.2 (git+https://github.com/mdsteele/rust-ar.git)" = "" +"checksum ar 0.6.2 (git+https://github.com/bjorn3/rust-ar.git?branch=non_multiple_of_two_identifiers_gnu_format)" = "" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" diff --git a/Cargo.toml b/Cargo.toml index b71ad7ffb25..c5565699cde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ indexmap = "1.0.2" #gimli = { path = "../" } [patch.crates-io] -ar = { git = "https://github.com/mdsteele/rust-ar.git" } +ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "non_multiple_of_two_identifiers_gnu_format" } [profile.dev.overrides."*"] opt-level = 3 diff --git a/src/archive.rs b/src/archive.rs index 44ca68c2127..2adb80da879 100644 --- a/src/archive.rs +++ b/src/archive.rs @@ -36,7 +36,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> { dst: output.to_path_buf(), src: input.map(|p| p.to_path_buf()), lib_search_paths: archive_search_paths(sess), - is_like_osx: true, //sess.target.target.options.is_like_osx, + is_like_osx: sess.target.target.options.is_like_osx, }; let (src_archives, entries) = if let Some(src) = &config.src { @@ -147,23 +147,8 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> { let entry = self.src_archives[archive_index].jump_to_entry(entry_index).unwrap(); let orig_header = entry.header(); - let orig_filename = orig_header.identifier().to_vec(); - - use std::collections::hash_map::DefaultHasher; - use std::hash::{Hash, Hasher}; - let mut hasher = DefaultHasher::new(); - orig_filename.hash(&mut hasher); - let mut filename = hasher.finish().to_le_bytes()[0..6].to_vec(); - filename.extend(&orig_filename[orig_filename.len() - 9..]); - - assert!( - filename.len() <= 16, - "Filenames bigger than 16 bytes are not yet supported. Filename was: \"{}\"", - String::from_utf8(filename).unwrap_or_else(|e| e.to_string()), - ); - let mut header = - ar::Header::new(filename, orig_header.size()); + ar::Header::new(orig_header.identifier().to_vec(), orig_header.size()); header.set_mtime(orig_header.mtime()); header.set_uid(orig_header.uid()); header.set_gid(orig_header.gid());