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

binutils.sh throws an error if path to directory contains a blank #64

Open
roboklon opened this issue May 31, 2022 · 3 comments
Open

binutils.sh throws an error if path to directory contains a blank #64

roboklon opened this issue May 31, 2022 · 3 comments

Comments

@roboklon
Copy link

binutils.sh fails, if the path to the directory contains a blank.

Example:
Compiling binutils in this directory fails:
/home/user/Documents/My Documents/123elf

Compiling binutils in this directory works for me (on the same system, Debian Bullseye 11):
/home/user/Documents/123elf

@dtwilliamson
Copy link

What's the error? This issue can come from unquoted variables, but I don't see any in the script. Unless the problem is in the binutils tarball from GNU which will be hard to track down without a specific error message.

@taviso
Copy link
Owner

taviso commented May 31, 2022

Hmm, that's unfortunate - I just confirmed that binutils can't be built in a directory with a space.

I guess we could mktemp -d -p /tmp or whatever.

@roboklon Is this using WSL2? Another user told me they had to use the "short path", like cd /mnt/c/Documents/mydocu~1/123elf, but I didn't understand it was because of the space until your report.

@vrza
Copy link
Contributor

vrza commented May 31, 2022

The bug is upstream, in the binutils Makefile. Shell scripts used to configure sub-components use unqoted variables. Example:

.PHONY: configure-zlib maybe-configure-zlib
maybe-configure-zlib:
maybe-configure-zlib: configure-zlib
configure-zlib: 
	@r=`${PWD_COMMAND}`; export r; \
	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
	test ! -f $(HOST_SUBDIR)/zlib/Makefile || exit 0; \
	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib; \
	$(HOST_EXPORTS)  \
	echo Configuring in $(HOST_SUBDIR)/zlib; \
	cd "$(HOST_SUBDIR)/zlib" || exit 1; \
	case $(srcdir) in \
	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
	  *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \
		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
	esac; \
	module_srcdir=zlib; \
	$(SHELL) \
	  $$s/$$module_srcdir/configure \
	  --srcdir=$${topdir}/$$module_srcdir \
	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
	  --target=${target_alias}  \
	  || exit 1

You can see e.g. unquoted $(srcdir) etc.

This bug should be reported (and eventually fixed) upstream, in GNU binutils.

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

4 participants