]> code.ossystems Code Review - openembedded-core.git/blob
7eb7defcde13e9a5ffe60546e16fe6a3b4c08f5e
[openembedded-core.git] /
1 From b200d4bcffc86bb08fd3898bc7cde00f0686f62d Mon Sep 17 00:00:00 2001
2 From: Robert Yang <liezhi.yang@windriver.com>
3 Date: Fri, 13 Sep 2013 22:01:02 -0400
4 Subject: [PATCH] scripts/Makefile.headersinst: install headers from scratch file
5
6 If headers_install is executed from a deep/long directory structure, the
7 shell's maximum argument length can be execeeded, which breaks the operation
8 with:
9
10 | make[2]: execvp: /bin/sh: Argument list too long
11 | make[2]: ***
12
13 By dumping the input files to a scratch file and using xargs to read the
14 input list from the scratch file, we can avoid blowing out the maximum
15 argument size and install headers in a long path name environment.
16
17 Robert:
18 Use "$(foreach ,,$(shell echo))" rather than "echo" to make it work when
19 len(TMPDIR) <= 410.
20
21 Upstream-Status: Inappropriate [oe-specific]
22
23 Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
24 Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
25 ---
26 RP: Refreshed for 3.10 as the problem still exists there on the autobuilders
27  scripts/Makefile.headersinst |    9 ++++++++-
28  1 file changed, 8 insertions(+), 1 deletion(-)
29
30 diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
31 --- a/scripts/Makefile.headersinst
32 +++ b/scripts/Makefile.headersinst
33 @@ -72,7 +72,7 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
34  quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
35                              file$(if $(word 2, $(all-files)),s))
36        cmd_install = \
37 -        $(CONFIG_SHELL) $< $(installdir) $(input-files); \
38 +        xargs $(CONFIG_SHELL) $< $(installdir) < $(INSTALL_HDR_PATH)/.input-files; \
39          for F in $(wrapper-files); do                                   \
40                  echo "\#include <asm-generic/$$F>" > $(installdir)/$$F;    \
41          done;                                                           \
42 @@ -98,10 +98,17 @@ __headersinst: $(subdirs) $(install-file)
43         @:
44  
45  targets += $(install-file)
46 +# Use the $(foreach ,,$(shell echo)) to avoid the "Argument list too
47 +# long" error, and use the "$(shell echo)" rather than "echo" to keep
48 +# the order.
49  $(install-file): scripts/headers_install.sh $(input-files) FORCE
50         $(if $(unwanted),$(call cmd,remove),)
51         $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
52 +       $(shell echo -n > $(INSTALL_HDR_PATH)/.input-files)
53 +       $(foreach f,$(input-files),$(shell echo -n "$(f) " >> \
54 +                       $(INSTALL_HDR_PATH)/.input-files))
55         $(call if_changed,install)
56 +       @rm $(INSTALL_HDR_PATH)/.input-files
57  
58  else
59  __headerscheck: $(subdirs) $(check-file)