taviso / 123elf

A native port of Lotus 1-2-3 to Linux.
1.17k stars 59 forks source link

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

Open roboklon opened 2 years ago

roboklon commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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.