Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Jan 2013 15:38:51 +0100 (CET)
From:      Romain Tartiere <romain@FreeBSD.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/175561: [patch] [bsd.pkgng.mk] Enhancement to avoid pkgng "/bin/sh: Argument list too long"
Message-ID:  <20130125143851.48A49CC16@marvin.blogreen.org>
Resent-Message-ID: <201301251440.r0PEe0tQ005361@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         175561
>Category:       ports
>Synopsis:       [patch] [bsd.pkgng.mk] Enhancement to avoid pkgng "/bin/sh: Argument list too long"
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 25 14:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Romain Tartiere
>Release:        FreeBSD 9.1-STABLE amd64
>Organization:
>Environment:
System: FreeBSD marvin.blogreen.org 9.1-STABLE FreeBSD 9.1-STABLE #4 r245578: Fri Jan 18 00:14:39 CET 2013 root@marvin.blogreen.org:/usr/obj/usr/src/sys/MARVIN amd64


	
>Description:

When trying to register a port with many dependencies (2141 ports in my case)
using pkgng, it fails with error:

===>   Registering installation for texlive-scheme-full-20110217,1
/bin/sh: Argument list too long
pkg: Invalid manifest format
*** [fake-pkg] Error code 74

Stop in /usr/ports/print/texlive-scheme-full.


The ${ACTUAL-PACKAGE-DEPENDS} generated snippet is too long and this result in
an invalid metadata file to be generated, thus making pkg fail a bit later.

In my case, ${_LIB_RUN_DEPENDS} is 204172 bytes long while the max commandline
length is 262144 bytes, there is therefore no much room for the rest of the
arguments.  However, the " " argument passed to `pkg query` prevent it from
failing if ${_LIB_RUN_DEPENDS} where empty, so the test to "protect" it against
that is useless.

>How-To-Repeat:

One can get the TeXLive ports from
http://code.google.com/p/freebsd-texlive/

and try to install print/texlive-scheme-full with WITH_PKGNG=yes in
/etc/make.conf.

>Fix:

The following patch helps avoiding this situation.

--- bsd.pkgng.mk.diff begins here ---
--- bsd.pkgng.mk.orig	2013-01-25 14:59:31.000000000 +0100
+++ bsd.pkgng.mk	2013-01-25 15:17:32.000000000 +0100
@@ -21,10 +21,8 @@
 PLIST_REINPLACE:=	${PLIST_REINPLACE:Nstopdaemon}
 
 ACTUAL-PACKAGE-DEPENDS?= \
-	if [ "${_LIB_RUN_DEPENDS}" != "  " ]; then \
-		${PKG_QUERY} "%n: {origin: %o, version: \"%v\"}" " " ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,:C,${PORTSDIR}/,,} ; \
-		${PKG_QUERY} "%dn: {origin: %do, version: \"%dv\"}" " " ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,:C,${PORTSDIR}/,,} ; \
-	fi
+	${PKG_QUERY} "%n: {origin: %o, version: \"%v\"}" " " ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,:C,${PORTSDIR}/,,} ; \
+	${PKG_QUERY} "%dn: {origin: %do, version: \"%dv\"}" " " ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,:C,${PORTSDIR}/,,}
 
 
 .if !target(fake-pkg)
--- bsd.pkgng.mk.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130125143851.48A49CC16>