[HN Gopher] Reordering Arguments (2016)
___________________________________________________________________
Reordering Arguments (2016)
Author : gbrown_
Score : 22 points
Date : 2021-06-23 10:05 UTC (1 days ago)
(HTM) web link (hardtoc.com)
(TXT) w3m dump (hardtoc.com)
| tingletech wrote:
| 2016
| lpapez wrote:
| Tangential to the article; can anyone here think of a use-case
| for providing thousands of command line arguments to a program?
| user982 wrote:
| du -chs *
| [deleted]
| jolmg wrote:
| find $file_filters -type f -exec grep $pattern {} +
| wahern wrote:
| find will only pass up to ARG_MAX arguments to each
| invocation of grep.
|
| > If the primary expression is punctuated by a <plus-sign>,
| the primary shall always evaluate as true, and the pathnames
| for which the primary is evaluated shall be aggregated into
| sets. The utility utility_name shall be invoked once for each
| set of aggregated pathnames. [...] The size of any set of two
| or more pathnames shall be limited such that execution of the
| utility does not cause the system's {ARG_MAX} limit to be
| exceeded. [....]
|
| https://pubs.opengroup.org/onlinepubs/9699919799/utilities/f.
| ..
| jolmg wrote:
| That limit is not specific to `find`. It applies to the
| `exec` family of functions. There's no way around it, so it
| also applies to globbing, command substitution, etc.
|
| Also, it's not ARG_MAX arguments; it's ARG_MAX byte length
| for the argument list, in addition to, on Linux, the
| environment list.
|
| A modern Linux machine has it set over 2,000,000, so it can
| easily fit 1,000 arguments.
| [deleted]
| nonameiguess wrote:
| Fun fact: We had an issue with a testing system I worked on
| years back, and it turned out SoaTest logging every single xml
| request it sent a mock response to as a separate file in the
| same directory made it impossible to delete the files with rm *
| because '*' overflowed the shell buffer for maximum string
| length. I think it was something like 60 million files that had
| accumulated.
|
| There was actually a tangentially similar case where we had to
| log all of the queued tips that get sent to the Navy's maritime
| domain awareness system that get purged because they aren't
| positively adjudicated in time, and this queue could get so
| large in testing environments because the system kept
| automatically filling the queue but no one was around to
| adjudicate, that the log message would grow larger than the
| JVM's maximum string length.
|
| Yet another where our regression test suite did a pixel-by-
| pixel bytewise diff of before and after images and printed to
| an html report. Eventually, the diffs grew so big as images
| kept getting larger that you couldn't open the report without
| crashing Firefox.
| inoffensivename wrote:
| borg is a commonly-run binary at google, --helpfull prints all
| the arguments available to it: borg --helpfull
| | grep -- '^ --' | wc -l 3794
|
| Not saying that you would need to use all of those arguments,
| but they are there!
| [deleted]
___________________________________________________________________
(page generated 2021-06-24 23:01 UTC)