Good but ... mk-origtargz Allow more files to be deleted than can fit inside argv (`getconf ARG_MAX`)
Osamu Aoki
osamu at debian.org
Tue Jan 23 13:58:53 UTC 2018
Hi,
On Sat, Jan 13, 2018 at 04:23:34PM +0000, Ximin Luo wrote:
> This is an automated email from the git hooks/post-receive script.
>
> infinity0 pushed a commit to branch pu/mk-origtargz-argmax
> in repository devscripts.
>
> commit 3fa9a36bb4f352c07a3537cb597aaf734ce936f1
> Author: Ximin Luo <infinity0 at debian.org>
> Date: Sat Jan 13 17:22:02 2018 +0100
>
> Allow more files to be deleted than can fit inside argv (`getconf ARG_MAX`)
> ---
> scripts/mk-origtargz.pl | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/mk-origtargz.pl b/scripts/mk-origtargz.pl
> index 4299b93..4533899 100644
> --- a/scripts/mk-origtargz.pl
> +++ b/scripts/mk-origtargz.pl
> @@ -571,11 +571,13 @@ 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);
> + while (my @next_n = splice @to_delete, 0, 16384) {
> + 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);
This looks a reasonable patch. But I don't know why you chose
16384=0x400 as the max figure.
Following your comment, I tried on my local machine
$ getconf ARG_MAX
2097152
This is bigger than 16384.
If this is different on different system, why not dynamically check and
set it with some safety margin like `getconf ARG_MAX` - 16 etc.?
Osamu
More information about the devscripts-devel
mailing list