From 858524d5893f3f17bde2886dec8510f42712ed93 Mon Sep 17 00:00:00 2001 From: Rafid Bin Mostofa Date: Tue, 3 Dec 2024 13:06:35 +0600 Subject: [PATCH] test(deb): add test for multiple dangling hardlinks --- internal/deb/extract_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/internal/deb/extract_test.go b/internal/deb/extract_test.go index e3116ae8..f6a1cd66 100644 --- a/internal/deb/extract_test.go +++ b/internal/deb/extract_test.go @@ -410,6 +410,23 @@ var extractTests = []extractTest{{ }, }, error: `cannot extract from package "test-package": internal error: hard link target missing: /hardlink -> /non-existing-target`, +}, { + summary: "Multiple dangling hard links", + pkgdata: testutil.MustMakeDeb([]testutil.TarEntry{ + testutil.Dir(0755, "./"), + testutil.Hlk(0644, "./hardlink1", "./non-existing-target"), + testutil.Hlk(0644, "./hardlink2", "./non-existing-target"), + }), + options: deb.ExtractOptions{ + Extract: map[string][]deb.ExtractInfo{ + "/**": []deb.ExtractInfo{{ + Path: "/**", + }}, + }, + }, + error: `cannot extract from package "test-package": internal error: hard link targets missing:` + + `\n- /hardlink1 -> /non-existing-target` + + `\n- /hardlink2 -> /non-existing-target`, }, { summary: "Hard link is linked to the target file", pkgdata: testutil.MustMakeDeb([]testutil.TarEntry{