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=bf0b6a281e0e73526de7b22a1269929104a541b3

commit bf0b6a281e0e73526de7b22a1269929104a541b3
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Sun Feb 19 00:40:54 2023 +0100

    Dpkg::Source::Archive: Reflow regex match in _add_entry()
    
    Reflow the code so that it does not trigger the perlcritic check,
    and improve the regex match operator and comment.
    
    Warned-by: perlcritic
    Addresses: RegularExpressions::ProhibitCaptureWithoutTest
---
 scripts/Dpkg/Source/Archive.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/Dpkg/Source/Archive.pm b/scripts/Dpkg/Source/Archive.pm
index 54dd7199f..fac10175d 100644
--- a/scripts/Dpkg/Source/Archive.pm
+++ b/scripts/Dpkg/Source/Archive.pm
@@ -80,7 +80,10 @@ sub _add_entry {
     my ($self, $file) = @_;
     my $cwd = *$self->{cwd};
     croak 'call create() first' unless *$self->{tar_input};
-    $file = $1 if ($file =~ /^\Q$cwd\E\/(.+)$/); # Relative names
+    if ($file =~ m{^\Q$cwd\E/(.+)$}) {
+        # Make pathname relative to the source root directory.
+        $file = $1;
+    }
     print({ *$self->{tar_input} } "$file\0")
         or syserr(g_('write on tar input'));
 }

-- 
Dpkg.Org's dpkg

Reply via email to