Re: Space in dirs break `make install`

2020-11-04 Thread Ole Tange
On Wed, Oct 28, 2020 at 2:19 PM Zack Weinberg  wrote:
:
> 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.

You are absolutely right. I copied that from an example in 2014,
though I have no ideas where from.

Thanks for your help.

/Ole



Re: Space in dirs break `make install`

2020-10-28 Thread Zack Weinberg
On Wed, Oct 28, 2020 at 8:40 AM Ole Tange  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



Fwd: Space in dirs break `make install`

2020-10-28 Thread Ole Tange
I use autoconf for GNU Parallel.

$ autoconf --version
autoconf (GNU Autoconf) 2.69

If I create a user with a homedir: "/home/  space  " and use

  ./configure --prefix "$HOME"

Then "make install" fails:

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 problem is most likely never going to happen on real Unix systems,
but I have seen similar problems on Microsoft Windows where dirs with
spaces are quite common.

I have not determined the root cause, but I think you may have
problems if the dirs contain multiple consecutive spaces.


/Ole