diff --git a/Cargo.toml b/Cargo.toml index d49afd92..819c0d00 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,6 @@ opt-level = 1 # No optimizations are too slow for us. [profile.release] lto = "thin" + +[patch.crates-io] +tar = { path = "../../alexcrichton/tar-rs" } \ No newline at end of file diff --git a/lib/src/tar/export.rs b/lib/src/tar/export.rs index ff9721a6..a91f012b 100644 --- a/lib/src/tar/export.rs +++ b/lib/src/tar/export.rs @@ -231,12 +231,22 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> { .append_data(&mut h, &path, &mut instream) .with_context(|| format!("Writing regfile {}", checksum))?; } else { + let target = meta.symlink_target().unwrap(); + let target = target.as_str(); let context = || format!("Writing content symlink: {}", checksum); - h.set_entry_type(tar::EntryType::Symlink); - h.set_size(0); - self.out - .append_link(&mut h, &path, meta.symlink_target().unwrap().as_str()) - .with_context(context)?; + if target.contains("//") { + h.set_link_name_literal(meta.symlink_target().unwrap().as_str()) + .with_context(context)?; + self.out + .append_data(&mut h, &path, &mut std::io::empty()) + .with_context(context)?; + } else { + h.set_entry_type(tar::EntryType::Symlink); + h.set_size(0); + self.out + .append_link(&mut h, &path, target) + .with_context(context)?; + } } }