Re: Space in dirs break `make install`

Zack Weinberg <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <CAKCAbMjH7oo7V+-DYw=9b+U81a3gOY-ieXXH=jhHcMjkjR+jXQ@mail.gmail.com>
On Wed, Oct 28, 2020 at 8:40 AM Ole Tange <[email protected]> wrote:
>
> make[3]: Entering directory '/home/  space  /parallel-20200922/src'
> rm /home/  space  /bin/sem || true
> rm: cannot remove '/home/': Is a directory
> rm: cannot remove 'space': No such file or directory
> rm: cannot remove '/bin/sem': No such file or directory
> ln -s parallel /home/  space  /bin/sem
> ln: target '/bin/sem' is not a directory

The commands that can't handle spaces in $(prefix) are coming from the
install-exec-hook in src/Makefile.am:

install-exec-hook:
        rm $(DESTDIR)$(bindir)/sem || true
        $(LN_S) parallel $(DESTDIR)$(bindir)/sem

Compare the installation rules generated by Automake (src/Makefile.in):

install-binSCRIPTS: $(bin_SCRIPTS)
        @$(NORMAL_INSTALL)
        @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
        if test -n "$$list"; then \
          echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
          $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
        fi; \
...
        while read type dir files; do \
             if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
             test -z "$$files" || { \
               echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
               $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" ||
exit $$?; \
             } \
        ; done

This is a mess, but see how it _always_ expands $(DESTDIR)$(bindir)
inside shell quotes?  To handle spaces in installation directories
correctly, you have to do the same thing in every rule you write
yourself.

(Even this is not enough to handle installation directories with
quotes in their names.  I think that one's just hopeless.)

zw
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.