Hi everybody,
git commit 6a0861 [1] made bin/git the target of the builtins hard links which
results in 'cross-directory' hard links. While the Makefile always works fine
for the local installation via 'make install', these links can raise trouble
when installing git via package manager.
The problem only occurs on systems where git's bin and lib directories will be
installed on different file systems, e.g. if /usr and /usr/lib are different
mount points. If you attempt to install a git package which was built with
DESTDIR=/usr and contains such hard links, tar will fail to extract either
bin/git or the builtins (depending on how tar resolves the hard links)
complaining about a 'Invalid cross-device link'.
I know such a setup is probably quite rare, but the problem can easily be fixed
by always copying bin/git to lib/git-add instead of hard linking it.
Cheers,
Cedric
[1]
http://git.kernel.org/?p=git/git.git;a=commit;h=6a0861a8a3295395238c8126c6e74c66b715c595
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:46:44
When the installed programs are tar'ed up and installed on a system where
bin/ and libexec/git-core/ live on different file systems, we do not want
libexec/git-core/git-* to be hardlinks to bin/git.
Noticed by Cedric Staniewski.
Signed-off-by: Johannes Schindelin <redacted>
---
On Mon, 11 May 2009, Cedric Staniewski wrote:
> git commit 6a0861 [1] made bin/git the target of the builtins
> hard links which results in 'cross-directory' hard links. While the
> Makefile always works fine for the local installation via 'make
> install', these links can raise trouble when installing git via
> package manager.
I do not understand how this commit could be responsible, but here
is an attempt to fix things.
Makefile | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
@@ -175,6 +175,9 @@ all::# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems# when hardlinking a file to another name and unlinking the original file right# away (some NTFS drivers seem to zero the contents in that scenario).+#+# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed+# programs as a tar, where bin/ and libexec/ might be on different file systems.GIT-VERSION-FILE:.FORCE-GIT-VERSION-FILE@$(SHELL_PATH)./GIT-VERSION-GEN
From: Tony Finch <dot@dotat.at> Date: 2016-06-15 22:46:44
On Mon, 11 May 2009, Cedric Staniewski wrote:
The problem only occurs on systems where git's bin and lib directories will be
installed on different file systems, e.g. if /usr and /usr/lib are different
mount points.
Some filesystems (a.g. AFS) do not support cross-directory hardlinks
even when they are under the same mount point.
Tony.
--
f.anthony.n.finch [off-list ref] http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.
I do not understand how this commit could be responsible, but here
is an attempt to fix things.
The important difference is that before this commit, git-add was
hardlinked to a file outside of DESTDIR. Thus, when the build directory
was removed or you tar'ed DESTDIR, git-add was just a regular file and
all the other builtins were hardlinked to it.
Behavior before commit:
$ touch git git-add && mkdir bin libexec && cp git bin &&
ln git-add libexec/ && ### the relevant line
tar caf git.tar.gz bin libexec && tar tfv git.tar.gz
bin/
bin/git
libexec/
libexec/git-add
Behavior after commit:
$ touch git git-add && mkdir bin libexec && cp git bin &&
ln bin/git libexec/git-add && ### the relevant line
tar caf git.tar.gz bin libexec && tar tfv git.tar.gz
bin/
bin/git
libexec/
libexec/git-add link to bin/git
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:46:44
Hi,
On Mon, 11 May 2009, Cedric Staniewski wrote:
Johannes Schindelin wrote:
quoted
I do not understand how this commit could be responsible, but here
is an attempt to fix things.
The important difference is that before this commit, git-add was
hardlinked to a file outside of DESTDIR. Thus, when the build directory
was removed or you tar'ed DESTDIR, git-add was just a regular file and
all the other builtins were hardlinked to it.
Ah.
But you did not say if you like/tested the patch or not.
Ciao,
Dscho