[Bug 295029] 'make makesum' fails with '/usr/bin/env: Argument list too long' when there are too many distfiles

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 05 May 2026 17:15:37 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295029

            Bug ID: 295029
           Summary: 'make makesum' fails with '/usr/bin/env: Argument list
                    too long' when there are too many distfiles
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Ports Framework
          Assignee: portmgr@FreeBSD.org
          Reporter: yuri@freebsd.org
                CC: ports-bugs@FreeBSD.org

Testcase: graphics/py-kornia-rs

How to reproduce:
> $ cd /usr/ports/graphics/py-kornia-rs && make makesum
> ===>  License APACHE20 accepted by the user
> ===>  License APACHE20 accepted by the user
> ===>   py311-kornia-rs-0.1.11 depends on file: /usr/local/sbin/pkg - found
> /tmp/makeQEBorT: /usr/bin/env: Argument list too long
> *** Error code 126

The reason of failure:
The do-fetch target in Mk/bsd.port.mk puts master sites of all distfiles into
environment (${_MASTER_SITES_ENV}) and it also calls ${SCRIPTSDIR}/do-fetch.sh
with the large set of arguments based on the large ${DISTFILES} variable.

execve fails with "Argument list too long" when the combined size of
environment and arguments exceeds a certain limit.

Rust projects tend to have large sets of distfiles, and kornia-rs happens to
exceed this limit.

The do-fetch target and shell script rely on environment and arguments by
design. This design is fundamentally flawed in that it has a limit on the size
of distfiles.

Easy fixes do not work: it looks like do-fetch needs to be reworked and the
arguments need to be passed either through streaming to stdin of do-fetch.sh,
or through a temp file. Streaming is probably preferable.

-- 
You are receiving this mail because:
You are on the CC list for the bug.