{"thread":{"id":"15157","subject":"[PATCH] Don't fail when an existing directory can't be created.","startedAt":"2008-08-22T08:08:46Z","lastAt":"2008-08-23T14:29:27Z","messageCount":3,"participants":["David Kågedal","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"88103","messageId":"87pro1pj3l.fsf@lysator.liu.se","threadId":"15157","inReplyTo":null,"subject":"[PATCH] Don't fail when an existing directory can't be created.","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2008-08-22T08:08:46Z","receivedAt":"2008-08-22T08:08:46Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"This makes it possible to install in a writable directory not owned by\nthe current user.\n---\n Documentation/Makefile |    8 ++++----\n Makefile               |    4 ++--\n gitk-git/Makefile      |    2 +-\n templates/Makefile     |   10 +++++-----\n 4 files changed, 12 insertions(+), 12 deletions(-)\n\nI install git in /usr/local/*, to which I have write permission, but\nI'm not necessarily the owner of. The permissions may look something\nlike this:\n\n  drwxrwxr-x 2 root adm 4096 2008-08-07 17:54 /usr/local/bin/\n\nTo do this I set prefix=/usr/local and run \"make install\".\nUnfortunately, this fails miserably because the install rules insist\non changing the permissions on any directory it installs to to\n755. This of course fails because I'm not the owner. And even if it\nworked, I wouldn't want it to do that.\n\nThis patch is just a simple fix to make the install not abort when it\nfails to modify the directory permissions, but I have to ask why it\ntries to do this at all? Most other programs I have built and\ninstalled do not try to do this.\n\ndiff --git a/Documentation/Makefile b/Documentation/Makefile\nindex 7a2130a..e6271d8 100644\n--- a/Documentation/Makefile\n+++ b/Documentation/Makefile\n@@ -87,15 +87,15 @@ man7: $(DOC_MAN7)\n info: git.info gitman.info\n \n install: man\n-\t$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)\n-\t$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)\n-\t$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)\n+\t-$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)\n+\t-$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)\n+\t-$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)\n \t$(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)\n \t$(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)\n \t$(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)\n \n install-info: info\n-\t$(INSTALL) -d -m 755 $(DESTDIR)$(infodir)\n+\t-$(INSTALL) -d -m 755 $(DESTDIR)$(infodir)\n \t$(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)\n \tif test -r $(DESTDIR)$(infodir)/dir; then \\\n \t  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\\\ndiff --git a/Makefile b/Makefile\nindex e8712e0..e6bb411 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1341,8 +1341,8 @@ gitexec_instdir_SQ = $(subst ','\\'',$(gitexec_instdir))\n export gitexec_instdir\n \n install: all\n-\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n-\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n+\t-$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n+\t-$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n \t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n \t$(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X '$(DESTDIR_SQ)$(bindir_SQ)'\n \t$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install\ndiff --git a/gitk-git/Makefile b/gitk-git/Makefile\nindex e1b6045..117b841 100644\n--- a/gitk-git/Makefile\n+++ b/gitk-git/Makefile\n@@ -41,7 +41,7 @@ all:: gitk-wish $(ALL_MSGFILES)\n \n install:: all\n \t$(INSTALL) -m 755 gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk\n-\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(msgsdir_SQ)'\n+\t-$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(msgsdir_SQ)'\n \t$(foreach p,$(ALL_MSGFILES), $(INSTALL) -m 644 $p '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true\n \n uninstall::\ndiff --git a/templates/Makefile b/templates/Makefile\nindex 67be379..58f2bdd 100644\n--- a/templates/Makefile\n+++ b/templates/Makefile\n@@ -26,10 +26,10 @@ boilerplates.made : $(bpsrc)\n \t$(QUIET)ls *--* 2>/dev/null | \\\n \twhile read boilerplate; \\\n \tdo \\\n-\t\tcase \"$$boilerplate\" in *~) continue ;; esac && \\\n-\t\tdst=`echo \"$$boilerplate\" | sed -e 's|^this|.|;s|--|/|g'` && \\\n-\t\tdir=`expr \"$$dst\" : '\\(.*\\)/'` && \\\n-\t\t$(INSTALL) -d -m 755 blt/$$dir && \\\n+\t\tcase \"$$boilerplate\" in *~) continue ;; esac ; \\\n+\t\tdst=`echo \"$$boilerplate\" | sed -e 's|^this|.|;s|--|/|g'` ; \\\n+\t\tdir=`expr \"$$dst\" : '\\(.*\\)/'` ; \\\n+\t\t$(INSTALL) -d -m 755 blt/$$dir ; \\\n \t\tcase \"$$boilerplate\" in \\\n \t\t*--) ;; \\\n \t\t*) cp -p $$boilerplate blt/$$dst ;; \\\n@@ -46,6 +46,6 @@ clean:\n \t$(RM) -r blt boilerplates.made\n \n install: all\n-\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n+\t-$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'\n \t(cd blt && $(TAR) cf - .) | \\\n \t(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xf -)\n-- \n1.6.0.rc2.7.gbf8a\n\n\n-- \nDavid Kågedal\n"},{"id":"88215","messageId":"7vbpzk7k5x.fsf@gitster.siamese.dyndns.org","threadId":"15157","inReplyTo":"87pro1pj3l.fsf@lysator.liu.se","subject":"Re: [PATCH] Don't fail when an existing directory can't be created.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-22T22:35:22Z","receivedAt":"2008-08-22T22:35:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Kågedal <davidk@lysator.liu.se> writes:\n\n> This makes it possible to install in a writable directory not owned by\n> the current user.\n> ---\n\nSign-off?\n\n> diff --git a/Documentation/Makefile b/Documentation/Makefile\n> index 7a2130a..e6271d8 100644\n> --- a/Documentation/Makefile\n> +++ b/Documentation/Makefile\n> @@ -87,15 +87,15 @@ man7: $(DOC_MAN7)\n>  info: git.info gitman.info\n>  \n>  install: man\n> -\t$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)\n> -\t$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)\n> -\t$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)\n> +\t-$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)\n> +\t-$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)\n> +\t-$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)\n\nMakes me wonder what happens if you failed to create the target\ndirectory.  Is it deemed to be Ok because the later step of installing the\ncontents will fail anyway?\n"},{"id":"88294","messageId":"87prnzoldk.fsf@lysator.liu.se","threadId":"15157","inReplyTo":"7vbpzk7k5x.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Don't fail when an existing directory can't be created.","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2008-08-23T14:29:27Z","receivedAt":"2008-08-23T14:29:27Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"[this is a resend, since the first one didn't reach the list]\n\nJunio C Hamano <gitster@pobox.com> writes:\n\n> David Kågedal <davidk@lysator.liu.se> writes:\n>\n>> This makes it possible to install in a writable directory not owned by\n>> the current user.\n>> ---\n>\n> Sign-off?\n\nI can sign it off, but I was more expecting to start a discussions, I suppose.\n\n-- \nDavid Kågedal\n"}]}