Presume I have hardlinked files in my $STAGEDIR, say, sbin/example and usr/local/sbin/example. I can package them into the tarball (examplepkg-1.2.3_4,5.txz), and tar xvf properly shows them as "link to". Installing the package however can fail with "cross-device link" errors. pkg should copy the file in that case. We can't make a global decision as to where and how a package user will split their file systems, so we need to prepare for unexpected device crossings. also, in that situation, pkg then removes all files, but still tries to run POST-INSTALL, which it should not. The port shown to error as given below is not committed to any trees yet: ===> Installing for e2fsprogs-1.45.6_4 ===> Checking if e2fsprogs is already installed ===> Switching to root credentials for 'install' target ===> Registering installation for e2fsprogs-1.45.6_4 Installing e2fsprogs-1.45.6_4... pkg-static: Fail to create hardlink: /usr/local/sbin/.pkgtemp.e2fsck.S4cGKN1JKu2i:Cross-device link cp: /usr/local/etc/mke2fs.conf.dist: No such file or directory pkg-static: POST-INSTALL script failed *** Error code 70
Created attachment 218008 [details] minimal port for /usr/ports/sysutils/ to demonstrate the issue attached a port to show the issue. In order to reproduce the problem, make sure that /etc and /usr/local/etc are on different file systems. (Untested: Just copy/rsync your /usr/local/etc somewhere else and mount by NFS, for instance, should do.)
the demo port prints: ===> Installing for failport-0.0 ===> Checking if failport is already installed ===> Switching to root credentials for 'install' target ===> Registering installation for failport-0.0 Installing failport-0.0... /bin/sh failport-0.0 PRE-INSTALL [...environment dump here, omitted from PR...] pkg-static: Fail to create hardlink: /usr/local/etc/.pkgtemp.example.timestamp.sfTyw84qY7mt:Cross-device link /bin/sh failport-0.0 POST-INSTALL [...environment dump here, omitted from PR...] /bin/sh pkg-install failport-0.0 POST-INSTALL should _NOT_ be run, but was pkg-static: POST-INSTALL script failed *** Error code 70 Stop. make[1]: stopped in /usr/ports.svn/sysutils/failport *** Error code 1 Stop. make: stopped in /usr/ports.svn/sysutils/failport