Good but ... mk-origtargz Allow more files to be deleted than can fit inside argv (`getconf ARG_MAX`)
Osamu Aoki
osamu at debian.org
Wed Jan 24 13:57:52 UTC 2018
Hi,
On Tue, Jan 23, 2018 at 03:58:11PM +0100, Mattia Rizzolo wrote:
> On Tue, Jan 23, 2018 at 10:58:53PM +0900, Osamu Aoki wrote:
> > This looks a reasonable patch. But I don't know why you chose
> > 16384=0x400 as the max figure.
... (It's ARG_MAX is in BYTEs but ...)
> Jan 13 21:39:31 <jamessan[m]> infinity0: why a magic number in the mk-origtargz patch?
> Jan 13 21:43:10 <mapreri> (instead of running a getconf and getting the value and use it, I suppose)
> Jan 13 21:45:38 <mapreri> (and then doing some computation to turn number in something usable)
> Jan 13 21:50:07 <infinity0> jamessan[m]: it's `getconf ARG_MAX` / 128 which i felt was a reasonable path length for source filenames
> Jan 13 21:50:33 <infinity0> and worked in practise for me (larger values like 30000 broke)
> Jan 13 21:56:52 <mapreri> infinity0: yes, but why not detecting it at runtime (and a comment explaining why 128 is better than NAME_MAX=255)
> Jan 13 21:57:09 <infinity0> because it would involve more perl code
>
>
> So I agree. Please don't merge that as it is until somebody does what's
> written here ↑.
Maybe before discussing technical solutions, we should know what issues
we are addressing by this modification. Is there a real cases which you
need to have this patch?
I don't know perl at all but in rough idea in perl/python mix pseudo
code:
# suppose @args has all the filename paths
$max = `getconf ARG_MAX`;
$file = shift;
while #args > 0
$cmdline = "command ";
while (total_length($cmdline) + len($file) -2 < $max) {
$cmdline = $cmdline . " " . $file;
$file = shift;
}
if ("command " != $cmdline ) {
shell_out_code($cmdline);
} else {
error_message;
}
Then it is guaranteed to be within ARG_MAX. But is these such case?
Osamu
> --
> regards,
> Mattia Rizzolo
>
> GPG Key: 66AE 2B4A FCCF 3F52 DA18 4D18 4B04 3FCD B944 4540 .''`.
> more about me: https://mapreri.org : :' :
> Launchpad user: https://launchpad.net/~mapreri `. `'`
> Debian QA page: https://qa.debian.org/developer.php?login=mattia `-
More information about the devscripts-devel
mailing list