From: Bruce Ashfield <bruce.ashfield@windriver.com>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: mmarek@suse.cz, sam@ravnborg.org, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] fix make headers_install when path is too long
Date: Fri, 26 Apr 2013 14:14:42 -0400 [thread overview]
Message-ID: <517AC412.9020505@windriver.com> (raw)
In-Reply-To: <1366994198-30550-1-git-send-email-nicolas.dichtel@6wind.com>
On 13-04-26 12:36 PM, Nicolas Dichtel wrote:
> If headers_install is executed from a deep/long directory structure, the
> shell's maximum argument length can be execeeded, which breaks the operation
> with:
>
> | make[2]: execvp: /bin/sh: Argument list too long
> | make[2]: ***
>
> Instead of passing each files name with the entire path, I give only the file
> name without the source path and give this path as a new argument to
> headers_install.pl.
This will work. I considered the same option when I solved the similar
problem for Yocto installs, but managed to avoid it with a shorter
term fixed.
>
> Because there is three possible path, I have tree input-files list, one per
> path.
>
> Signed-off-by: Nicolas Dichtel<nicolas.dichtel@6wind.com>
Tested-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Bruce
> ---
>
> I come back to this issue. Here is another proposal to fix this pb.
> Comments are welcome.
>
> scripts/Makefile.headersinst | 20 ++++++++++++++------
> scripts/headers_install.pl | 8 ++++----
> 2 files changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
> index 477d137..fbadfc3 100644
> --- a/scripts/Makefile.headersinst
> +++ b/scripts/Makefile.headersinst
> @@ -47,18 +47,24 @@ header-y := $(filter-out $(generic-y), $(header-y))
> all-files := $(header-y) $(genhdr-y) $(wrapper-files)
> output-files := $(addprefix $(installdir)/, $(all-files))
>
> -input-files := $(foreach hdr, $(header-y), \
> +input-files1 := $(foreach hdr, $(header-y), \
> $(if $(wildcard $(srcdir)/$(hdr)), \
> - $(wildcard $(srcdir)/$(hdr)), \
> + $(wildcard $(srcdir)/$(hdr))) \
> + )
> +input-files1-name := $(notdir $(input-files1))
> +input-files2 := $(foreach hdr, $(header-y), \
> + $(if $(wildcard $(srcdir)/$(hdr)),, \
> $(if $(wildcard $(oldsrcdir)/$(hdr)), \
> $(wildcard $(oldsrcdir)/$(hdr)), \
> $(error Missing UAPI file $(srcdir)/$(hdr))) \
> - )) \
> - $(foreach hdr, $(genhdr-y), \
> + ))
> +input-files2-name := $(notdir $(input-files2))
> +input-files3 := $(foreach hdr, $(genhdr-y), \
> $(if $(wildcard $(gendir)/$(hdr)), \
> $(wildcard $(gendir)/$(hdr)), \
> $(error Missing generated UAPI file $(gendir)/$(hdr)) \
> ))
> +input-files3-name := $(notdir $(input-files3))
>
> # Work out what needs to be removed
> oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
> @@ -72,7 +78,9 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
> quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
> file$(if $(word 2, $(all-files)),s))
> cmd_install = \
> - $(PERL) $< $(installdir) $(SRCARCH) $(input-files); \
> + $(PERL) $< $(installdir) $(SRCARCH) $(srcdir) $(input-files1-name); \
> + $(PERL) $< $(installdir) $(SRCARCH) $(oldsrcdir) $(input-files2-name); \
> + $(PERL) $< $(installdir) $(SRCARCH) $(gendir) $(input-files3-name); \
> for F in $(wrapper-files); do \
> echo "\#include<asm-generic/$$F>"> $(installdir)/$$F; \
> done; \
> @@ -98,7 +106,7 @@ __headersinst: $(subdirs) $(install-file)
> @:
>
> targets += $(install-file)
> -$(install-file): scripts/headers_install.pl $(input-files) FORCE
> +$(install-file): scripts/headers_install.pl $(input-files1) $(input-files2) $(input-files3) FORCE
> $(if $(unwanted),$(call cmd,remove),)
> $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
> $(call if_changed,install)
> diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
> index 581ca99..87d9700 100644
> --- a/scripts/headers_install.pl
> +++ b/scripts/headers_install.pl
> @@ -3,7 +3,7 @@
> # headers_install prepare the listed header files for use in
> # user space and copy the files to their destination.
> #
> -# Usage: headers_install.pl readdir installdir arch [files...]
> +# Usage: headers_install.pl readdir installdir arch srcdir [files...]
> # installdir: dir to install the files to
> # arch: current architecture
> # arch is used to force a reinstallation when the arch
> @@ -17,7 +17,7 @@
>
> use strict;
>
> -my ($installdir, $arch, @files) = @ARGV;
> +my ($installdir, $arch, $srcdir, @files) = @ARGV;
>
> my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
>
> @@ -27,8 +27,8 @@ foreach my $filename (@files) {
>
> my $tmpfile = "$installdir/$file.tmp";
>
> - open(my $in, '<', $filename)
> - or die "$filename: $!\n";
> + open(my $in, '<', "$srcdir/$filename")
> + or die "$srcdir/$filename: $!\n";
> open(my $out, '>', $tmpfile)
> or die "$tmpfile: $!\n";
> while (my $line =<$in>) {
next prev parent reply other threads:[~2013-04-26 18:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 11:16 make headers_install fail when path is too long Nicolas Dichtel
2013-03-06 16:10 ` Sam Ravnborg
2013-03-06 16:24 ` Michal Marek
2013-03-06 16:27 ` Nicolas Dichtel
2013-03-06 16:50 ` Bruce Ashfield
2013-03-07 8:26 ` Michal Marek
2013-03-07 13:28 ` Bruce Ashfield
2013-04-26 16:36 ` [PATCH] fix make headers_install " Nicolas Dichtel
2013-04-26 18:14 ` Bruce Ashfield [this message]
2013-04-26 18:57 ` Sam Ravnborg
2013-04-29 12:13 ` Michal Marek
2013-04-29 12:17 ` Nicolas Dichtel
2013-04-29 12:15 ` [PATCH linux-next v2] " Nicolas Dichtel
2013-04-29 12:34 ` Bruce Ashfield
2013-05-06 8:19 ` Nicolas Dichtel
2013-05-17 9:12 ` Nicolas Dichtel
2013-05-17 20:08 ` Michal Marek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=517AC412.9020505@windriver.com \
--to=bruce.ashfield@windriver.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=mmarek@suse.cz \
--cc=nicolas.dichtel@6wind.com \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.