public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v3] Use builtin sort instead of shell sort
@ 2019-04-20  7:23 Émeric Dupont
  2019-04-20  8:55 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Émeric Dupont @ 2019-04-20  7:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: Émeric Dupont

Some build environments and configuration options may lead to the make
variable PLUGIN_HEADERS being too long to be passed as parameters to the
shell `echo` command, leading to a "write error" message when making the
target install-plugin.

The following patch fixes this issue by using the [Make $(sort list)][1]
function instead to remove duplicates from the list of headers. There is
no functional change, the value assigned to the shell variable is the
same.

Tested in production on x86 and armv7 cross-compilation toolchains.
    - The length of the headers variable goes from 80000+ chars to 7500+

Tested with make bootstrap and make check on host-x86_64-pc-linux-gnu
    - make bootstrap successful
    - make check fails even before the patch is applied

        WARNING: program timed out.
        FAIL: libgomp.c/../libgomp.c-c++-common/cancel-parallel-1.c execution test
        ...
        make[4]: *** [Makefile:479: check-DEJAGNU] Error 1

2019-04-15  Emeric Dupont  <emeric.dupont@zii.aero>

        * Makefile.in: Use builtin sort instead of shell sort

Signed-off-by: Emeric Dupont <emeric.dupont@zii.aero>

[1]: https://www.gnu.org/software/make/manual/html_node/Text-Functions.html#index-sorting-words
---
 gcc/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index d186d71c91e..3196e774a26 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3538,7 +3538,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
 # We keep the directory structure for files in config or c-family and .def
 # files. All other files are flattened to a single directory.
 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
-headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
+headers=$(sort $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def)); \
 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
 for file in $$headers; do \
   if [ -f $$file ] ; then \
--
2.21.0


________________________________

TriaGnoSys GmbH, Registergericht: München HRB 141647, Vat.: DE 813396184 Geschäftsführer: Núria Riera Díaz, Peter Lewalter

________________________________

This email and any files transmitted with it are confidential & proprietary to Zodiac Inflight Innovations. This information is intended solely for the use of the individual or entity to which it is addressed. Access or transmittal of the information contained in this e-mail, in full or in part, to any other organization or persons is not authorized.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] Use builtin sort instead of shell sort
  2019-04-20  7:23 [PATCH v3] Use builtin sort instead of shell sort Émeric Dupont
@ 2019-04-20  8:55 ` Andreas Schwab
  2019-05-27  8:28   ` Émeric Dupont
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2019-04-20  8:55 UTC (permalink / raw)
  To: Émeric Dupont; +Cc: gcc-patches

On Apr 20 2019, Émeric Dupont <emeric.dupont@zii.aero> wrote:

> The following patch fixes this issue by using the [Make $(sort list)][1]
> function instead to remove duplicates from the list of headers. There is
> no functional change, the value assigned to the shell variable is the
> same.

Is it?

> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index d186d71c91e..3196e774a26 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -3538,7 +3538,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
>  # We keep the directory structure for files in config or c-family and .def
>  # files. All other files are flattened to a single directory.
>  $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
> -headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
> +headers=$(sort $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def)); \

This sorts the words $(PLUGIN_HEADERS) '$(cd' $(srcdir); echo '*.h'
'*.def)' and produces a command line that doesn't make sense.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] Use builtin sort instead of shell sort
  2019-04-20  8:55 ` Andreas Schwab
@ 2019-05-27  8:28   ` Émeric Dupont
  0 siblings, 0 replies; 3+ messages in thread
From: Émeric Dupont @ 2019-05-27  8:28 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches

The 20.04.2019 09:23, Andreas Schwab wrote:
>On Apr 20 2019, Émeric Dupont <emeric.dupont@zii.aero> wrote:
>> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
>> index d186d71c91e..3196e774a26 100644
>> --- a/gcc/Makefile.in
>> +++ b/gcc/Makefile.in
>> @@ -3538,7 +3538,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
>>  # We keep the directory structure for files in config or c-family and .def
>>  # files. All other files are flattened to a single directory.
>>  $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
>> -headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
>> +headers=$(sort $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def)); \
>
>This sorts the words $(PLUGIN_HEADERS) '$(cd' $(srcdir); echo '*.h'
>'*.def)' and produces a command line that doesn't make sense.
>
Thanks for pointing this out! I will provide an updated patch as soon as
I made sure the unwanted mail footer disappears (Sorry it took so long,
it had to go through the legal department first.)



--
Emeric Dupont
Zodiac Inflight Innovations
P +49815388678207
Argelsrieder Feld, 22 - 82234 Wessling
www.safran-aerosystems.com

________________________________

TriaGnoSys GmbH, Registergericht: München HRB 141647, Vat.: DE 813396184 Geschäftsführer: Núria Riera Díaz, Peter Lewalter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-27  8:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-20  7:23 [PATCH v3] Use builtin sort instead of shell sort Émeric Dupont
2019-04-20  8:55 ` Andreas Schwab
2019-05-27  8:28   ` Émeric Dupont

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).