Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bashism in Makefile.am #257

Open
eli-schwartz opened this issue Nov 26, 2024 · 0 comments
Open

bashism in Makefile.am #257

eli-schwartz opened this issue Nov 26, 2024 · 0 comments

Comments

@eli-schwartz
Copy link

lrzip/lzma/C/Makefile.am

Lines 47 to 63 in 15f5621

## hack to force asm compilation and to trick libtool with .lo file
if USE_ASM
liblzma_la_LIBADD = $(ASM_7z).lo
7ZIPASMLOFILE := \
\# $(ASM_7z).lo - a libtool object file\
\n\# Generated by libtool -- hack to allow asm linking\
\n\# Peter Hyman\
\npic_object='.libs/$(ASM_7z).o'\
\nnon_pic_object='$(ASM_7z).o'
$(ASM_7z).lo: $(ASM_S)
$(ASM_PROG) $(ASM_OPT) -o $(ASM_7z).o $(ASM_S)
mkdir -p .libs
cp $(ASM_7z).o .libs/
@echo -e "$(7ZIPASMLOFILE)" > $(ASM_7z).lo
endif

This uses echo -e which doesn't have predictable or reliable behavior e.g. when your /bin/sh is the dash shell rather than GNU Bash. The resulting libtool script ends up with an -e at the start of the file because -e isn't an option depending on the echo implementation.

There are some notes about reliability of the echo command at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html including a warning that for reliability and robustness reasons one should always prefer to use printf unless echoing a string that doesn't begin with a dash and which contains no escape sequences whatsoever.

See e.g. https://bugs.gentoo.org/923990

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant