This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=33ac0c17d9d1e211fb45c5cc0e7d5edb8d4c107d commit 33ac0c17d9d1e211fb45c5cc0e7d5edb8d4c107d Author: Guillem Jover <[email protected]> AuthorDate: Mon Sep 11 05:45:05 2023 +0200 Dpkg::Source::Patch: Warn when patching hard linked files Patching hard linked files can end up unlinking them, and patching only one of the directory entries, which means the result might not be as expected due to missing changes in all instances of the file. --- scripts/Dpkg/Source/Patch.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/Dpkg/Source/Patch.pm b/scripts/Dpkg/Source/Patch.pm index 0da35b9e5..c454feb8c 100644 --- a/scripts/Dpkg/Source/Patch.pm +++ b/scripts/Dpkg/Source/Patch.pm @@ -509,10 +509,18 @@ sub analyze { $dirtocreate{$dirname} = 1; } - if (-e $fn and not -f _) { - error(g_("diff '%s' patches something which is not a plain file"), - $diff); - } + if (-e $fn) { + if (not -f _) { + error(g_("diff '%s' patches something which is not a plain file"), + $diff); + } + # Note: We cannot use "stat _" due to Time::HiRes. + my $nlink = (stat $fn)[3]; + if ($nlink > 1) { + warning(g_("diff '%s' patches hard link %s which can have " . + 'unintended consequences'), $diff, $fn); + } + } if ($filepatched{$fn}) { $filepatched{$fn}++; -- Dpkg.Org's dpkg

