Skip to content

Commit

Permalink
Use new append_link() API to handle long symlinks
Browse files Browse the repository at this point in the history
I hit this when exporting Fedora Silverblue, there are some
long symlinks in there.

Depends: alexcrichton/tar-rs#273
Closes: ostreedev#162
  • Loading branch information
cgwalters committed Nov 18, 2021
1 parent 6c5e53e commit c077548
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
8 changes: 3 additions & 5 deletions lib/src/tar/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,11 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
.append_data(&mut h, &path, &mut instream)
.with_context(|| format!("Writing regfile {}", checksum))?;
} else {
h.set_size(0);
h.set_entry_type(tar::EntryType::Symlink);
let context = || format!("Writing content symlink: {}", checksum);
h.set_link_name(meta.symlink_target().unwrap().as_str())
.with_context(context)?;
h.set_entry_type(tar::EntryType::Symlink);
h.set_size(0);
self.out
.append_data(&mut h, &path, &mut std::io::empty())
.append_link(&mut h, &path, meta.symlink_target().unwrap().as_str())
.with_context(context)?;
}
}
Expand Down

0 comments on commit c077548

Please sign in to comment.