Correction to avoid 'Argument list too long' error when creating packages with many files #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The error was found when running
rocks create packageon a software installation that had a lot of files.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.
Those changes were tested on a virtual machine installation of Rocks 7.0 and worked fine producing an installable and fully functional package. We tested with 12 different softwares.