diff mbox series

Use builtin sort instead of shell sort

Message ID 20190417193525.8540-1-emeric.dupont@zii.aero
State New
Headers show
Series Use builtin sort instead of shell sort | expand

Commit Message

Émeric Dupont April 17, 2019, 7:36 p.m. UTC
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

Signed-off-by: Emeric Dupont <emeric.dupont@zii.aero>
---
 gcc/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.21.0

Comments

Émeric Dupont April 17, 2019, 7:52 p.m. UTC | #1
The 17.04.2019 21:36, Emeric Dupont wrote:
<... Unwanted legalese ...>

Sorry, please disregard the unwanted footer added against my will. I am
actively trying to have out admins get rid of it where it is not
applicable.

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

Patch

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 \