Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2eb4ca0f authored by James Sullins's avatar James Sullins Committed by Gerrit Code Review
Browse files

core/Makefile: avoid exceeding MAX_ARG_STRLEN

The current method of generating the apkcerts file can fail with
a "make: execvp: /bin/bash: Argument list too long" when the path
to the toplevel directory is long enough.

In my case, the MAX_ARG_STRLEN of 131072 was exceeded with a toplevel
directory length of 52 (with 427 apkcerts).

This reduces the length of the command-line string generated by not
repeating the output path for each entry (it cd's there first).

Change-Id: I9739f9aefdf5e0febed66517c7b418a4041f49f6
parent 747461c1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -260,12 +260,12 @@ $(APKCERTS_FILE):
	@echo APK certs list: $@
	@mkdir -p $(dir $@)
	@rm -f $@
	$(hide) $(foreach p,$(PACKAGES),\
	$(hide) cd $(dir $@) && $(foreach p,$(PACKAGES),\
          $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
	    echo 'name="$(p).apk" certificate="EXTERNAL" \
	         private_key=""' >> $@;,\
	         private_key=""' >> $(notdir $@);,\
	    echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
	         private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;))
	         private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $(notdir $@);))
	# In case $(PACKAGES) is empty.
	$(hide) touch $@