[devscripts] 02/02: mk-origtargz: Split list of files to delete if the list gets too long to fit ARG_MAX.
Mattia Rizzolo
mattia at debian.org
Fri Feb 9 15:38:53 UTC 2018
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch master
in repository devscripts.
commit 67a69bd611538c56177234a3a64d832eeb7c3fe8
Author: Mattia Rizzolo <mattia at debian.org>
Date: Fri Feb 9 16:34:26 2018 +0100
mk-origtargz: Split list of files to delete if the list gets too long to fit ARG_MAX.
Closes: #855464
Thanks to Ximin Luo <infinity0> for the initial patch.
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
debian/changelog | 3 +++
scripts/mk-origtargz.pl | 23 ++++++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 159c61b..1b217cd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,9 @@ devscripts (2.18.1) UNRELEASED; urgency=medium
with an older pod as well.
* reproducible-check:
+ Instruct to install python3-xdg if missing. Closes: #888307
+ * mk-origtargz:
+ + Split list of files to delete if the list gets too long to fit ARG_MAX.
+ Thanks to Ximin Luo <infinity0> for the initial patch. Closes: #855464
[ Osamu Aoki ]
* uupdate:
diff --git a/scripts/mk-origtargz.pl b/scripts/mk-origtargz.pl
index 9d43020..5b91ab2 100644
--- a/scripts/mk-origtargz.pl
+++ b/scripts/mk-origtargz.pl
@@ -572,11 +572,24 @@ if ($do_repack || $deletecount) {
# We have to use piping because --delete is broken otherwise, as documented
# at https://www.gnu.org/software/tar/manual/html_node/delete.html
if (@to_delete) {
- spawn(exec => ['tar', '--delete', @to_delete ],
- from_file => $destfiletar,
- to_file => $destfiletar . ".tmp",
- wait_child => 1) if scalar(@to_delete) > 0;
- move ($destfiletar . ".tmp", $destfiletar);
+ # ARG_MAX: max number of bytes exec() can handle
+ my $arg_max;
+ spawn(
+ exec => ['getconf', 'ARG_MAX'],
+ to_string => \$arg_max,
+ wait_child => 1
+ );
+ # usually NAME_MAX=255, but here we use 128 to be on the safe side.
+ $arg_max = int($arg_max / 128);
+ # We use this lame splice on a totally arbitrary $arg_max because
+ # counting how many bytes there are in @to_delete is too inefficient.
+ while (my @next_n = splice @to_delete, 0, $arg_max) {
+ spawn(exec => ['tar', '--delete', @next_n ],
+ from_file => $destfiletar,
+ to_file => $destfiletar . ".tmp",
+ wait_child => 1) if scalar(@next_n) > 0;
+ move ($destfiletar . ".tmp", $destfiletar);
+ }
}
compress_archive($destfiletar, $destfile, $compression);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list