From 34dcee1c93dd28994cd965f6bc233944e2069f13 Mon Sep 17 00:00:00 2001 From: Vitor Peixoto Date: Thu, 22 Aug 2019 17:38:45 -0300 Subject: [PATCH] Correction to avoid 'Argument list too long' error when creating packages with many files. Me and @felipedreis found out that on packages that have many files an error is thrown when trying to write the list of files on the $(NAME).spec file. This happens because the rule $(NAME).spec on 'Rules-linux-centos.mk' tries to write the entire list of RPM.FILES at once using the printf command, and on big packages the argument list passed to printf overflow the shell constant ARG_MAX. This could be solved relying on the fact that the RPM.FILES list was already written on the 'version.mk' file. Using the tail command made possible to directly transfer the filelist from one file to another. Also, the tail command was piped through sequences of 'sed' commands that replaced the '\\n' character to the actually newline, and escaped each path with "". This was done to prevent another error that rose when the paths had spaces on them which were interpreted as separators. --- src/devel/devel/etc/Rules-linux-centos.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devel/devel/etc/Rules-linux-centos.mk b/src/devel/devel/etc/Rules-linux-centos.mk index b54eef7..d5ae109 100644 --- a/src/devel/devel/etc/Rules-linux-centos.mk +++ b/src/devel/devel/etc/Rules-linux-centos.mk @@ -458,7 +458,7 @@ ifeq ($(RPM.PREFIX),) ifeq ($(RPM.FILES),) @$(PF) "/\n" >> $@ else - @$(PF) "$(RPM.FILES)\n" >> $@ + tail -n 1 version.mk | sed -e 's/\\n/\n/g' | sed -e 's/RPM.FILES=//g'| sed -e 's/^/"/g' | sed -e 's/$$/"/g' >> $@ endif else @$(PF) "$(RPM.PREFIX)\n" >> $@