icu-config is an autogenerated script tuned for the shell used by configure at build time. Autoconf-generated configure scripts normally use bash and hence we most often have the following: # grep ^ECHO_N /usr/bin/icu-config ECHO_N="-n" But if "echo" builtin in the /bin/sh shell behaves differently, then the output is broken. For example /bin/sh -> dash: <dash-0.5.8.1-r2 (OK): vm3020 ~ # icu-config --ldflags-icuio -licuio # dash-0.5.8.1-r2 ("echo" builtin doesn't support "-n" and "-e" options): vm3020 ~ # icu-config --ldflags-icuio -n -licuio #
it should use `printf` everywhere and not use `echo` at all
(In reply to Alexander Tsoy from comment #0) > icu-config is an autogenerated script tuned for the shell used by configure > at build time. Autoconf-generated configure scripts normally use bash and > hence we most often have the following: > > # grep ^ECHO_N /usr/bin/icu-config > ECHO_N="-n" 1. The above statement not entirely correct. configure in icu uses custom test for newline option which ignores CONFIG_SHELL and always use /bin/sh. From configure.ac: # Use custom echo test for newline option # Current autoconf (2.65) gives incorrect echo newline option # for icu-config # This may be removed later - mow (June 17, 2010) ICU_ECHO_C= ICU_ECHO_N= ICU_ECHO_T= case `/bin/sh -c "echo -n x"` in -n*) case `/bin/sh -c "echo 'x\c'"` in *c*) ICU_ECHO_T=' ';; # ECHO_T is single tab character. *) ICU_ECHO_C='\c';; esac;; *) ICU_ECHO_N='-n';; esac AC_SUBST(ICU_ECHO_N) AC_SUBST(ICU_ECHO_C) AC_SUBST(ICU_ECHO_T) 2. icu-config is not compatible with dash-0.5.8.1-r2 in any case. It always adds extra newline to the output. For example, it breaks compilation of dev-tex/bibtexu: # sed -n '216,218p' /var/tmp/portage/dev-tex/bibtexu-3.71_p20120701/work/texlive-20120701-source/texk/bibtexu/Makefile ICU_LIBS = -L/usr/lib64 -licuio -licui18n -licuuc -licudata -lpthread -ldl -lm So I get the following error: >>> Compiling source in /var/tmp/portage/dev-tex/bibtexu-3.71_p20120701/work/texlive-20120701-source/texk/bibtexu ... make -j8 Makefile:217: *** missing separator. Stop
Also causes issue with grub2-mkconfig from sys-boot/grub-2.02_beta2-r2: # grub2-mkconfig -o grub/grub.cfg Generating grub configuration file ... Found linux image: -n basename: invalid option -- 'n' Try 'basename --help' for more information. echo -n used in /etc/grub.d/10_linux: machine=`uname -m` case "x$machine" in xi?86 | xx86_64) list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi done` ;; *) list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi done` ;; esac man dash has: echo [-n ] args... Print the arguments on the standard output, separated by spaces. Unless the -n option is present, a newline is output following the arguments.
*** Bug 529224 has been marked as a duplicate of this bug. ***
*** Bug 530184 has been marked as a duplicate of this bug. ***
*** Bug 529376 has been marked as a duplicate of this bug. ***
(In reply to Chris Mayo from comment #3) > Also causes issue with grub2-mkconfig from sys-boot/grub-2.02_beta2-r2: Unrelated, I know, but the grub problem should be fixed upstream: https://savannah.gnu.org/bugs/index.php?43668
Confirming. I'm working on a patch.
Created attachment 392612 [details, diff] Replace 'echo -n'/'echo \c' with printf The heart of this patch is in config/icu-config-bottom where I've replaced all uses of echo/ECHO_N/ECHO_C with `printf "%s"`. The rest of the changes are cleanups since the ECHO_{N,C} variables were only used in icu-config.
May I commit directly?
(In reply to Rémi Cardona from comment #10) > May I commit directly? I guess yes, lgtm. Please also try to submit this upstream.
+*icu-53.1-r1 (07 Jan 2015) + + 07 Jan 2015; Rémi Cardona <remi@gentoo.org> +icu-53.1-r1.ebuild, + +files/icu-remove-bashisms.patch: + Add patch to fix icu-config with non-bash /bin/sh, see bug #528022. + Revbump because 1) it's not a build failure per se 2) it changes on-disk files 3) -r0 already is already stable on a couple of arches. FTR, the patch is already submitted in upstream's trac (see URL field) and has been acknowledged as valid, though I can't tell how and when it will be applied. Thanks
$ icu-config --ldflags-libsonly --ldflags-system -licui18n -licuuc -licudata-lpthread -ldl -lm
"-licudata-lpthread" wrong and fail app-text/texlive-core
The patch removes the blanks after each Variable, e.g: - echo $ECHO_N "${CFLAGS} ${ECHO_C}" + printf "%s" "${CFLAGS}" I've workaround this issue by adding a blank after %s. "icu-config --ldflags-libsonly --ldflags-system" output is now: -licui18n -licuuc -licudata -lpthread -ldl -lm
I've added the missing spaces back to the patch (without a revbump, should we do one?) Sorry for breaking things.
(In reply to Rémi Cardona from comment #16) > (without a revbump, should we do one?) yes please
(In reply to Alexis Ballier from comment #17) > (In reply to Rémi Cardona from comment #16) > > (without a revbump, should we do one?) > > yes please Yes, please, otherwise depending bugs such as bug #535924 won't get fixed. Rebuilding icu by hand fixed bug #535924 here for me.
Revbumped.