File 0007-tar-only-strip-unsafe-components-from-hardlinks-not-.patch of Package busybox.43070
From cd2ff9ca1addb754a224095ebfcc1d4c44e53c6e Mon Sep 17 00:00:00 2001
From: Radoslav Kolev <radoslav.kolev@suse.com>
Date: Sun, 1 Mar 2026 13:40:31 +0000
Subject: [PATCH 7/7] tar: only strip unsafe components from hardlinks, not
symlinks
commit 3fb6b31c7 introduced a check for unsafe components in
tar archive hardlinks, but it was being applied to symlinks too
which broke "Symlinks and hardlinks coexist" tar test.
---
archival/libarchive/get_header_tar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c
index dc0f7e038..a8c2ad8cc 100644
--- a/archival/libarchive/get_header_tar.c
+++ b/archival/libarchive/get_header_tar.c
@@ -453,7 +453,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
/* Everything up to and including last ".." component is stripped */
strip_unsafe_prefix(file_header->name);
- if (file_header->link_target) {
+ if (file_header->link_target && !S_ISLNK(file_header->mode)) {
/* GNU tar 1.34 examples:
* tar: Removing leading '/' from hard link targets
* tar: Removing leading '../' from hard link targets
--
2.52.0