#6602 `make install` attempts to write outside configure prefix
Closed: wontfix Opened by cheimes.

As a developer I expect that make install does not attempt to install any files outside a given prefix.

$ ./configure --prefix=/tmp/freeipa
$ make
$ make install
Making install in dnssec
make[2]: Entering directory '/home/heimes/redhat/freeipa/daemons/dnssec'
make[3]: Entering directory '/home/heimes/redhat/freeipa/daemons/dnssec'
make[3]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/tmp/freeipa/libexec/ipa/'
 /usr/bin/install -c ipa-dnskeysyncd ipa-dnskeysync-replica ipa-ods-exporter '/tmp/freeipa/libexec/ipa/'
 /usr/bin/mkdir -p '/usr/lib/systemd/system'
 /usr/bin/install -c -m 644 ipa-dnskeysyncd.service ipa-ods-exporter.service ipa-ods-exporter.socket '/usr/lib/systemd/system'
/usr/bin/install: cannot create regular file '/usr/lib/systemd/system/ipa-dnskeysyncd.service': Permission denied
/usr/bin/install: cannot create regular file '/usr/lib/systemd/system/ipa-ods-exporter.service': Permission denied
/usr/bin/install: cannot create regular file '/usr/lib/systemd/system/ipa-ods-exporter.socket': Permission denied
Makefile:470: recipe for target 'install-systemdsystemunitDATA' failed
make[3]: *** [install-systemdsystemunitDATA] Error 1
make[3]: Leaving directory '/home/heimes/redhat/freeipa/daemons/dnssec'
Makefile:540: recipe for target 'install-am' failed
make[2]: *** [install-am] Error 2
make[2]: Leaving directory '/home/heimes/redhat/freeipa/daemons/dnssec'
Makefile:470: recipe for target 'install-recursive' failed
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory '/home/heimes/redhat/freeipa/daemons'
Makefile:604: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1

Assuming this is removed would you expect the resulting bits be usable? There are a lot of other hardcoded paths. IPA is not relocatable. IIRC there was a ticket on this at one point but I cannot find it now.

It depends how you define usable. I certainly don't expect that I will be able to run FreeIPA from that installation. But I expect that I can make install FreeIPA into a directory and do something like rsync -av /tmp/freeipa/ somehost:/ to run FreeIPA on somehost.

At the end it's a philosophical issue. Should --prefix also influence systemd unit files' prefix or not?

Christian, the use case you describe is documented at http://www.freeipa.org/page/V4/Build_system_refactoring#Developer (second part).

$ mkdir /tmp/vm
$ sshfs -o transform_symlinks root@<vm>:/ /tmp/vm
$ make install DESTDIR=/tmp/vm

I don't know if it works correctly, but AFAIK Tomas was using it.

If your use case is to simply install FreeIPA to a chosen directory, you can use the DESTDIR option as mentioned above.

I'm not sure what is the purpose of --prefix option for ./configure, but using DESTDIR seems to be a standard automake way to achieve the behavior you want.

https://www.gnu.org/software/automake/manual/html_node/DESTDIR.html

./configure --prefix=/PATH is the canonical way to configure an installation prefix and have make install install all files with that prefix. DESTDIR has a slightly different meaning.

By the way FreeIPA configure.ac tries to support prefix for systemdsystemunitdir and systemdtmpfilesdir. Somehow it's broken and doesn't work as designed.

systemdsystemunitdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' --variable=systemdsystemunitdir systemd)

I found a related discussion on StackOverflow: http://stackoverflow.com/questions/11307465/destdir-and-prefix-of-make

It seems DESTDIR is a correct usage for your use case (as a developer). While I agree --prefix should be supported eventually, I think it's a rather low priority item. We have a way to build and install IPA into a specific directory using DESTDIR, which is good enough solution for developers.

Yes, it's a minor annoyance only.

I found the culprit of the issue. Systemd's /usr/share/pkgconfig/systemd.pc file defines prefix but doesn't use it. Our override of prefix has no effect. I'll investigate the issue next week.

prefix=/usr
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system
...

For the record, make install PREFIX on its own doesn't work either:

$ ./autogen.sh
$ ./configure
$ make
$ make install PREFIX=/tmp/freeipa
...
make[1]: Entering directory '/home/heimes/redhat/freeipa/client'
Making install in man
make[2]: Entering directory '/home/heimes/redhat/freeipa/client/man'
make[3]: Entering directory '/home/heimes/redhat/freeipa/client/man'
make[3]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/local/share/man/man1'
 /usr/bin/install -c -m 644 ipa-getkeytab.1 ipa-rmkeytab.1 ipa-client-install.1 ipa-client-automount.1 ipa-certupdate.1 ipa-join.1 ipa.1 '/usr/local/share/man/man1'
/usr/bin/install: cannot create regular file '/usr/local/share/man/man1/ipa-getkeytab.1': Permission denied
/usr/bin/install: cannot create regular file '/usr/local/share/man/man1/ipa-rmkeytab.1': Permission denied
/usr/bin/install: cannot create regular file '/usr/local/share/man/man1/ipa-client-install.1': Permission denied
/usr/bin/install: cannot create regular file '/usr/local/share/man/man1/ipa-client-automount.1': Permission denied
/usr/bin/install: cannot create regular file '/usr/local/share/man/man1/ipa-certupdate.1': Permission denied
/usr/bin/install: cannot create regular file '/usr/local/share/man/man1/ipa-join.1': Permission denied
/usr/bin/install: cannot create regular file '/usr/local/share/man/man1/ipa.1': Permission denied
Makefile:427: recipe for target 'install-man1' failed
make[3]: *** [install-man1] Error 1

It works if I specify both ./configure --prefix and make install PREFIX with the same target directory, though.

I'm not familiar with the {{{PREFIX}}} variable for {{{make install}}}. When using {{{DESTDIR}}}, you do not have to set {{{./configure --prefix}}}.

If you want RHEL/Fedora paths, however, you need to run {{{./configure}}} and specify the desired directories. The easiest way to achieve this is to run {{{./makerpms.sh}}} once. Then you can simply keep using {{make}} and {{make install DESTDIR=/tmp/freeipa}}}.

$ ./makerpms.sh
...
$ ./config.status --version
freeipa config.status 4.4.90.dev201701171306+git9b07762
configured by ./configure, generated by GNU Autoconf 2.69,
  with options "'--enable-silent-rules' '--host=x86_64-redhat-linux-gnu' '--build=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu'"
$ make
$ make install DESTDIR=/tmp/freeipa

Metadata Update from @cheimes:
- Issue assigned to someone
- Issue set to the milestone: FreeIPA 4.5

Metadata Update from @pvoborni:
- Issue close_status updated to: None
- Issue set to the milestone: FreeIPA 4.7 (was: FreeIPA 4.5)

Closing my own ticket. It's not critical.

Metadata Update from @cheimes:
- Issue close_status updated to: wontfix
- Issue status updated to: Closed (was: Open)

Metadata