{"thread":{"id":"19283","subject":"Cross-directory hard links","startedAt":"2009-05-11T10:41:31Z","lastAt":"2009-05-11T20:05:32Z","messageCount":6,"participants":["Cedric Staniewski","Johannes Schindelin","Tony Finch"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"113530","messageId":"loom.20090511T101424-212@post.gmane.org","threadId":"19283","inReplyTo":null,"subject":"Cross-directory hard links","fromName":"Cedric Staniewski","fromEmail":"cedric@gmx.ca","sentAt":"2009-05-11T10:41:31Z","receivedAt":"2009-05-11T10:41:31Z","isPatch":false,"sender":{"key":"cedric@gmx.ca","avatar":null},"body":"Hi everybody,\n\ngit commit 6a0861 [1] made bin/git the target of the builtins hard links which\nresults in 'cross-directory' hard links. While the Makefile always works fine\nfor the local installation via 'make install', these links can raise trouble\nwhen installing git via package manager.\n\nThe problem only occurs on systems where git's bin and lib directories will be\ninstalled on different file systems, e.g. if /usr and /usr/lib are different\nmount points. If you attempt to install a git package which was built with\nDESTDIR=/usr and contains such hard links, tar will fail to extract either\nbin/git or the builtins (depending on how tar resolves the hard links)\ncomplaining about a 'Invalid cross-device link'.\n\nI know such a setup is probably quite rare, but the problem can easily be fixed\nby always copying bin/git to lib/git-add instead of hard linking it.\n\nCheers,\nCedric\n\n[1]\nhttp://git.kernel.org/?p=git/git.git;a=commit;h=6a0861a8a3295395238c8126c6e74c66b715c595\n"},{"id":"113531","messageId":"alpine.DEB.1.00.0905111256580.4973@intel-tinevez-2-302","threadId":"19283","inReplyTo":"loom.20090511T101424-212@post.gmane.org","subject":"[PATCH] Add NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-05-11T11:02:18Z","receivedAt":"2009-05-11T11:02:18Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWhen the installed programs are tar'ed up and installed on a system where\nbin/ and libexec/git-core/ live on different file systems, we do not want\nlibexec/git-core/git-* to be hardlinks to bin/git.\n\nNoticed by Cedric Staniewski.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Mon, 11 May 2009, Cedric Staniewski wrote:\n\n\t> git commit 6a0861 [1] made bin/git the target of the builtins \n\t> hard links which results in 'cross-directory' hard links. While the \n\t> Makefile always works fine for the local installation via 'make \n\t> install', these links can raise trouble when installing git via\n\t> package manager.\n\n\tI do not understand how this commit could be responsible, but here \n\tis an attempt to fix things.\n\n Makefile |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 6e21643..b00e22d 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -175,6 +175,9 @@ all::\n # Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems\n # when hardlinking a file to another name and unlinking the original file right\n # away (some NTFS drivers seem to zero the contents in that scenario).\n+#\n+# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed\n+# programs as a tar, where bin/ and libexec/ might be on different file systems.\n \n GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE\n \t@$(SHELL_PATH) ./GIT-VERSION-GEN\n@@ -1549,6 +1552,7 @@ endif\n \tbindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \\\n \texecdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \\\n \t{ $(RM) \"$$execdir/git-add$X\" && \\\n+\t\ttest -z \"$(NO_CROSS_DIRECTORY_HARDLINKS)\" && \\\n \t\tln \"$$bindir/git$X\" \"$$execdir/git-add$X\" 2>/dev/null || \\\n \t\tcp \"$$bindir/git$X\" \"$$execdir/git-add$X\"; } && \\\n \t{ for p in $(filter-out git-add$X,$(BUILT_INS)); do \\\n-- \n1.6.3.49.g4d15.dirty\n"},{"id":"113552","messageId":"4A085280.3090501@gmx.ca","threadId":"19283","inReplyTo":"alpine.DEB.1.00.0905111256580.4973@intel-tinevez-2-302","subject":"Re: [PATCH] Add NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile","fromName":"Cedric Staniewski","fromEmail":"cedric@gmx.ca","sentAt":"2009-05-11T16:29:52Z","receivedAt":"2009-05-11T16:29:52Z","isPatch":true,"sender":{"key":"cedric@gmx.ca","avatar":null},"body":"Johannes Schindelin wrote:\n> \tI do not understand how this commit could be responsible, but here \n> \tis an attempt to fix things.\n\nThe important difference is that before this commit, git-add was\nhardlinked to a file outside of DESTDIR. Thus, when the build directory\nwas removed or you tar'ed DESTDIR, git-add was just a regular file and\nall the other builtins were hardlinked to it.\n\nBehavior before commit:\n$ touch git git-add && mkdir bin libexec && cp git bin &&\nln git-add libexec/ &&                      ###  the relevant line\ntar caf git.tar.gz bin libexec && tar tfv git.tar.gz\n\nbin/\nbin/git\nlibexec/\nlibexec/git-add\n\n\nBehavior after commit:\n$ touch git git-add && mkdir bin libexec && cp git bin &&\nln bin/git libexec/git-add &&               ### the relevant line\ntar caf git.tar.gz bin libexec && tar tfv git.tar.gz\n\nbin/\nbin/git\nlibexec/\nlibexec/git-add link to bin/git\n"},{"id":"113550","messageId":"alpine.LSU.2.00.0905111738440.7187@hermes-2.csi.cam.ac.uk","threadId":"19283","inReplyTo":"loom.20090511T101424-212@post.gmane.org","subject":"Re: Cross-directory hard links","fromName":"Tony Finch","fromEmail":"dot@dotat.at","sentAt":"2009-05-11T16:40:15Z","receivedAt":"2009-05-11T16:40:15Z","isPatch":false,"sender":{"key":"dot@dotat.at","avatar":"https://avatars.githubusercontent.com/u/68429?v=4"},"body":"On Mon, 11 May 2009, Cedric Staniewski wrote:\n>\n> The problem only occurs on systems where git's bin and lib directories will be\n> installed on different file systems, e.g. if /usr and /usr/lib are different\n> mount points.\n\nSome filesystems (a.g. AFS) do not support cross-directory hardlinks\neven when they are under the same mount point.\n\nTony.\n-- \nf.anthony.n.finch  <dot@dotat.at>  http://dotat.at/\nGERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.\nMODERATE OR GOOD.\n"},{"id":"113561","messageId":"alpine.DEB.1.00.0905112107420.27348@pacific.mpi-cbg.de","threadId":"19283","inReplyTo":"4A085280.3090501@gmx.ca","subject":"Re: [PATCH] Add NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-05-11T19:08:15Z","receivedAt":"2009-05-11T19:08:15Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 11 May 2009, Cedric Staniewski wrote:\n\n> Johannes Schindelin wrote:\n> > \tI do not understand how this commit could be responsible, but here \n> > \tis an attempt to fix things.\n> \n> The important difference is that before this commit, git-add was\n> hardlinked to a file outside of DESTDIR. Thus, when the build directory\n> was removed or you tar'ed DESTDIR, git-add was just a regular file and\n> all the other builtins were hardlinked to it.\n\nAh.\n\nBut you did not say if you like/tested the patch or not.\n\nCiao,\nDscho\n"},{"id":"113580","messageId":"4A08850C.10502@gmx.ca","threadId":"19283","inReplyTo":"alpine.DEB.1.00.0905112107420.27348@pacific.mpi-cbg.de","subject":"Re: [PATCH] Add NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile","fromName":"Cedric Staniewski","fromEmail":"cedric@gmx.ca","sentAt":"2009-05-11T20:05:32Z","receivedAt":"2009-05-11T20:05:32Z","isPatch":true,"sender":{"key":"cedric@gmx.ca","avatar":null},"body":"Johannes Schindelin wrote:\n> But you did not say if you like/tested the patch or not.\n\nOh, sorry. Of course, it works as intended and I'm fine with applying it.\n\nThanks for your work.\n"}]}