What does the merge request do?
Backport for master MR 7899. Adds a workaround for the command-line length limit that prevents extensions from running on very large selections. When the argument list would overflow the platform's command-line limit, Script::_change_extension now spills all arguments into a temp file and passes a single --arg-file=<path> argument in their place. The companion change in inkex (extensions!724 (merged)) parses the file as an arguments file.
Together with extensions!724 (merged), closes #2627 (closed). Since the backport cannot use the current version of Inkex, it now throws an unrecognized arguments: --arg-file whenever too many items are selected. This is still better than the current behavior, which fails silently. Also, extensions that ship a copy of Inkex can patch it themselves, if desired.
Implementation notes
The spill is cross-platform. The threshold comes from a get_cmdline_budget() helper:
- Windows: returns 28,701 chars. The limit is 32,767 characters, but the assembled command line also contains the interpreter path, script path, input SVG path, etc. The 28,701 budget leaves overhead for those.
- Unix: returns
sysconf(_SC_ARG_MAX) − 32768, floored at_POSIX_ARG_MAX.ARG_MAXis actually complicated since it covers the argument, environment, pointer arrays, etc., so 32,768 are reserved for the extras. The floor handlessysconffailure and pathologically small return values (_POSIX_ARG_MAX is 4,096). Practically speaking, this seems to be ~2M on modern Unix systems, so it is rarely encountered.
All arguments are written to the spill file regardless of name so future renames can't silently break the workaround. The temp file is created via Inkscape::IO::TempFilename, which handles cleanup. Note that this MR requires the corresponding update to inkex; without it, inkex cannot handle the --arg-file=<path> argument. (Currently, it just fails silently when the command-line length limit is exceeded.)
Summary for release notes
Fixed a bug where running an extension (e.g. one that operates on every selected object) on a very large selection of objects on Windows would silently fail to launch with an "Invalid argument" error. Extensions can now be run on selections of arbitrary size on all platforms.





















