From b7e18004a2e78ab5a6ea365e12c816a4be1289a5 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Wed, 27 Nov 2019 16:27:55 +0100 Subject: [PATCH] pxar: decoder: return original name in attributes() The returned filename should be the one of the file given at the offset, not of the one the hardlink points to. Signed-off-by: Christian Ebner --- src/pxar/decoder.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pxar/decoder.rs b/src/pxar/decoder.rs index 7c5143df..39a8096f 100644 --- a/src/pxar/decoder.rs +++ b/src/pxar/decoder.rs @@ -339,7 +339,10 @@ impl Decoder { if marker == PXAR_FORMAT_HARDLINK { let size: u64 = self.inner.read_item()?; let (_, diff) = self.inner.read_hardlink(size)?; - return self.attributes(offset - diff); + // Make sure to return the original filename, + // not the one read from the hardlink. + let (_, entry, xattr, file_size) = self.attributes(offset - diff)?; + return Ok((filename, entry, xattr, file_size)); } if marker != PXAR_ENTRY {