{"thread":{"id":"47852","subject":"[PATCH] Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets","startedAt":"2018-02-15T02:14:31Z","lastAt":"2018-02-15T18:05:19Z","messageCount":3,"participants":["SZEDER Gábor","Ævar Arnfjörð Bjarmason","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"339429","messageId":"20180215021410.14045-1-szeder.dev@gmail.com","threadId":"47852","inReplyTo":null,"subject":"[PATCH] Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-02-15T02:14:10Z","receivedAt":"2018-02-15T02:14:31Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with\nsimple make rules, 2017-12-10), the Git(3pm) man page is only\ngenerated as an indirect dependency of the 'install-doc' and\n'install-man' Makefile targets.  Consequently, if someone runs 'make\nman && sudo make install-man' (or their 'doc' counterparts), then\nGit(3pm) will be generated as root, and the resulting root-owned files\nand directories will in turn cause the next user-run 'make clean' to\nfail.  This was not an issue in the past, because Git(3pm) was\ngenerated when 'make all' descended into 'perl/', which is usually not\nrun as root.\n\nList Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,\ntoo, so it gets generated by targets that are usually built as\nordinary users.\n\nWhile at it, add 'install-man-perl' to the list of .PHONY targets.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n Makefile | 12 +++++++-----\n 1 file changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 5bcd83ddf3..8d2bf4de59 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2214,13 +2214,15 @@ $(VCSSVN_LIB): $(VCSSVN_OBJS)\n \n export DEFAULT_EDITOR DEFAULT_PAGER\n \n-.PHONY: doc man html info pdf\n-doc:\n+.PHONY: doc man man-perl html info pdf\n+doc: man-perl\n \t$(MAKE) -C Documentation all\n \n-man:\n+man: man-perl\n \t$(MAKE) -C Documentation man\n \n+man-perl: perl/build/man/man3/Git.3pm\n+\n html:\n \t$(MAKE) -C Documentation html\n \n@@ -2618,7 +2620,7 @@ endif\n \tdone && \\\n \t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n \n-.PHONY: install-gitweb install-doc install-man install-html install-info install-pdf\n+.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf\n .PHONY: quick-install-doc quick-install-man quick-install-html\n install-gitweb:\n \t$(MAKE) -C gitweb install\n@@ -2629,7 +2631,7 @@ install-doc: install-man-perl\n install-man: install-man-perl\n \t$(MAKE) -C Documentation install-man\n \n-install-man-perl: perl/build/man/man3/Git.3pm\n+install-man-perl: man-perl\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'\n \t(cd perl/build/man/man3 && $(TAR) cf - .) | \\\n \t(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)\n-- \n2.16.1.354.g266d823471\n\n"},{"id":"339453","messageId":"87vaeyfxdu.fsf@evledraar.gmail.com","threadId":"47852","inReplyTo":"20180215021410.14045-1-szeder.dev@gmail.com","subject":"Re: [PATCH] Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-02-15T08:52:13Z","receivedAt":"2018-02-15T08:52:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Feb 15 2018, SZEDER Gábor jotted:\n\n> Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with\n> simple make rules, 2017-12-10), the Git(3pm) man page is only\n> generated as an indirect dependency of the 'install-doc' and\n> 'install-man' Makefile targets.  Consequently, if someone runs 'make\n> man && sudo make install-man' (or their 'doc' counterparts), then\n> Git(3pm) will be generated as root, and the resulting root-owned files\n> and directories will in turn cause the next user-run 'make clean' to\n> fail.  This was not an issue in the past, because Git(3pm) was\n> generated when 'make all' descended into 'perl/', which is usually not\n> run as root.\n>\n> List Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,\n> too, so it gets generated by targets that are usually built as\n> ordinary users.\n>\n> While at it, add 'install-man-perl' to the list of .PHONY targets.\n\nThanks for the fixup of my crappy 'make' skills. I tested this before\nthe patch and it indeed has the problem you describe, and this fixes\nit. Thanks! CC-ing Junio because I think it makes sense to pick this up\nas-is.\n\nReviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n"},{"id":"339479","messageId":"xmqqo9kq9lii.fsf@gitster-ct.c.googlers.com","threadId":"47852","inReplyTo":"87vaeyfxdu.fsf@evledraar.gmail.com","subject":"Re: [PATCH] Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-02-15T18:05:09Z","receivedAt":"2018-02-15T18:05:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> On Thu, Feb 15 2018, SZEDER Gábor jotted:\n>\n>> Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with\n>> simple make rules, 2017-12-10), the Git(3pm) man page is only\n>> generated as an indirect dependency of the 'install-doc' and\n>> 'install-man' Makefile targets.  Consequently, if someone runs 'make\n>> man && sudo make install-man' (or their 'doc' counterparts), then\n>> Git(3pm) will be generated as root, and the resulting root-owned files\n>> and directories will in turn cause the next user-run 'make clean' to\n>> fail.  This was not an issue in the past, because Git(3pm) was\n>> generated when 'make all' descended into 'perl/', which is usually not\n>> run as root.\n>>\n>> List Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,\n>> too, so it gets generated by targets that are usually built as\n>> ordinary users.\n>>\n>> While at it, add 'install-man-perl' to the list of .PHONY targets.\n>\n> Thanks for the fixup of my crappy 'make' skills. I tested this before\n> the patch and it indeed has the problem you describe, and this fixes\n> it. Thanks! CC-ing Junio because I think it makes sense to pick this up\n> as-is.\n>\n> Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n\nThanks.  \n\nIt is better late than never to have fixes like this, but I am a bit\ndisturbed to notice that for the last few batches, we see fixes to\ntopics after they land 'master', not while they are in 'next'.\n\nWill apply.\n\n"}]}