diff options
-rw-r--r-- | Debian/Debhelper/Dh_Lib.pm | 20 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rwxr-xr-x | dh_bugfiles | 4 | ||||
-rwxr-xr-x | dh_fixperms | 4 | ||||
-rwxr-xr-x | dh_gencontrol | 4 | ||||
-rwxr-xr-x | dh_installchangelogs | 2 | ||||
-rwxr-xr-x | dh_installdeb | 2 | ||||
-rwxr-xr-x | dh_makeshlibs | 2 | ||||
-rwxr-xr-x | dh_md5sums | 4 | ||||
-rwxr-xr-x | dh_strip | 2 |
10 files changed, 32 insertions, 14 deletions
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm index 56ebeaf2..744c9f15 100644 --- a/Debian/Debhelper/Dh_Lib.pm +++ b/Debian/Debhelper/Dh_Lib.pm @@ -430,8 +430,24 @@ sub rename_path { sub reset_perm_and_owner { my ($mode, @paths) = @_; - doit('chmod', $mode, '--', @paths); - doit('chown', '0:0', '--', @paths); + my $_mode; + # Dark goat blood to tell 0755 from "0755" + if (length( do { no warnings "numeric"; $mode & "" } ) ) { + # 0755, leave it alone. + $_mode = $mode; + } else { + # "0755" -> convert to 0755 + $_mode = oct($mode); + } + if ($dh{VERBOSE}) { + verbose_print(sprintf('chmod %#o -- %s', $_mode, escape_shell(@paths))); + verbose_print(sprintf('chown 0:0 -- %s', escape_shell(@paths))); + } + return if $dh{NO_ACT}; + for my $path (@paths) { + chmod($_mode, $path) or error(sprintf('chmod(%#o, %s): %s', $mode, $path, $!)); + chown(0, 0, $path) or error("chown(0, 0, $path): $!"); + } } # Run a command that may have a huge number of arguments, like xargs does. diff --git a/debian/changelog b/debian/changelog index 44807002..f6525fda 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ debhelper (10.6.4) UNRELEASED; urgency=medium where dh_installman would fail to remove the compressed manpage. With hardlinks involved, this could make dh_compress fail later. (Closes: #867846) + * Dh_lib.pm: Rewrite reset_perm_and_owner to it does chmod + chown + using perl built-ins rather than forking+exec. -- Niels Thykier <niels@thykier.net> Sun, 09 Jul 2017 12:30:20 +0000 diff --git a/dh_bugfiles b/dh_bugfiles index 62b9ac9f..552c1229 100755 --- a/dh_bugfiles +++ b/dh_bugfiles @@ -123,10 +123,10 @@ foreach my $package (@{$dh{DOPACKAGES}}) { # Ensure that the bug script is executable if (-f $dir) { - reset_perm_and_owner('0755', $dir); + reset_perm_and_owner(0755, $dir); } elsif (-f "$dir/script") { - reset_perm_and_owner('0755', "$dir/script"); + reset_perm_and_owner(0755, "$dir/script"); } } diff --git a/dh_fixperms b/dh_fixperms index 6f7017aa..923d174d 100755 --- a/dh_fixperms +++ b/dh_fixperms @@ -133,10 +133,10 @@ on_pkgs_in_parallel { "! -name 'script' ${find_exclude_options} -print0", "2>/dev/null | xargs -0r chmod 644"); if ( -f "$tmp/usr/share/bug/$package/script" ) { - reset_perm_and_owner('0755', "$tmp/usr/share/bug/$package/script"); + reset_perm_and_owner(0755, "$tmp/usr/share/bug/$package/script"); } } elsif ( -f "$tmp/usr/share/bug/$package" ) { - reset_perm_and_owner('0755', "$tmp/usr/share/bug/$package"); + reset_perm_and_owner(0755, "$tmp/usr/share/bug/$package"); } # Files in $tmp/etc/sudoers.d/ must be mode 0440. diff --git a/dh_gencontrol b/dh_gencontrol index aae4b222..790f733c 100755 --- a/dh_gencontrol +++ b/dh_gencontrol @@ -128,7 +128,7 @@ on_pkgs_in_parallel { doit("dpkg-gencontrol", "-p${package}", "-l$changelog", "-T$substvars", "-P${dbgsym_tmp}",@{$dh{U_PARAMS}}, @dbgsym_options); - reset_perm_and_owner('0644', "${dbgsym_tmp}/DEBIAN/control"); + reset_perm_and_owner(0644, "${dbgsym_tmp}/DEBIAN/control"); } elsif ($build_ids) { # Only include the build-id if there is no dbgsym package (if # there is a dbgsym package, the build-ids into the control @@ -147,7 +147,7 @@ on_pkgs_in_parallel { # This chmod is only necessary if the user sets the umask to # something odd. - reset_perm_and_owner('0644', "${tmp}/DEBIAN/control"); + reset_perm_and_owner(0644, "${tmp}/DEBIAN/control"); } }; diff --git a/dh_installchangelogs b/dh_installchangelogs index 18b9bc0a..3c377a5f 100755 --- a/dh_installchangelogs +++ b/dh_installchangelogs @@ -227,7 +227,7 @@ on_pkgs_in_parallel { $link_to='changelog.html'; if (! defined $upstream_text) { complex_doit("echo 'See changelog.html.gz' > $base/changelog"); - reset_perm_and_owner('0644',"$base/changelog"); + reset_perm_and_owner(0644,"$base/changelog"); } } if ($dh{K_FLAG}) { diff --git a/dh_installdeb b/dh_installdeb index 60b1fbb8..0472e540 100755 --- a/dh_installdeb +++ b/dh_installdeb @@ -184,7 +184,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) { rm_files("$tmp/DEBIAN/conffiles"); } else { - reset_perm_and_owner('0644', "$tmp/DEBIAN/conffiles"); + reset_perm_and_owner(0644, "$tmp/DEBIAN/conffiles"); } } } diff --git a/dh_makeshlibs b/dh_makeshlibs index 7f7bf59c..e44930f9 100755 --- a/dh_makeshlibs +++ b/dh_makeshlibs @@ -241,7 +241,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) { } if (-e "$tmp/DEBIAN/shlibs") { - reset_perm_and_owner('0644', "$tmp/DEBIAN/shlibs"); + reset_perm_and_owner(0644, "$tmp/DEBIAN/shlibs"); } # dpkg-gensymbols files @@ -87,7 +87,7 @@ on_pkgs_in_parallel { rm_files("$tmp/DEBIAN/md5sums"); } else { - reset_perm_and_owner('0644', "$tmp/DEBIAN/md5sums"); + reset_perm_and_owner(0644, "$tmp/DEBIAN/md5sums"); } if ( -d $dbgsym_tmp) { install_dir("${dbgsym_tmp}/DEBIAN"); @@ -100,7 +100,7 @@ on_pkgs_in_parallel { rm_files("${dbgsym_tmp}/DEBIAN/md5sums"); } else { - reset_perm_and_owner('0644', "${dbgsym_tmp}/DEBIAN/md5sums"); + reset_perm_and_owner(0644, "${dbgsym_tmp}/DEBIAN/md5sums"); } } } @@ -285,7 +285,7 @@ sub make_debug { } # No reason for this to be executable. - reset_perm_and_owner('0644', $debug_path); + reset_perm_and_owner(0644, $debug_path); return $debug_path; } |