git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets
@ 2018-02-15  2:14 SZEDER Gábor
  2018-02-15  8:52 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 3+ messages in thread
From: SZEDER Gábor @ 2018-02-15  2:14 UTC (permalink / raw)
  To: git; +Cc: Ævar Arnfjörð Bjarmason, SZEDER Gábor

Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with
simple make rules, 2017-12-10), the Git(3pm) man page is only
generated as an indirect dependency of the 'install-doc' and
'install-man' Makefile targets.  Consequently, if someone runs 'make
man && sudo make install-man' (or their 'doc' counterparts), then
Git(3pm) will be generated as root, and the resulting root-owned files
and directories will in turn cause the next user-run 'make clean' to
fail.  This was not an issue in the past, because Git(3pm) was
generated when 'make all' descended into 'perl/', which is usually not
run as root.

List Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,
too, so it gets generated by targets that are usually built as
ordinary users.

While at it, add 'install-man-perl' to the list of .PHONY targets.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 Makefile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 5bcd83ddf3..8d2bf4de59 100644
--- a/Makefile
+++ b/Makefile
@@ -2214,13 +2214,15 @@ $(VCSSVN_LIB): $(VCSSVN_OBJS)
 
 export DEFAULT_EDITOR DEFAULT_PAGER
 
-.PHONY: doc man html info pdf
-doc:
+.PHONY: doc man man-perl html info pdf
+doc: man-perl
 	$(MAKE) -C Documentation all
 
-man:
+man: man-perl
 	$(MAKE) -C Documentation man
 
+man-perl: perl/build/man/man3/Git.3pm
+
 html:
 	$(MAKE) -C Documentation html
 
@@ -2618,7 +2620,7 @@ endif
 	done && \
 	./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
 
-.PHONY: install-gitweb install-doc install-man install-html install-info install-pdf
+.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
 .PHONY: quick-install-doc quick-install-man quick-install-html
 install-gitweb:
 	$(MAKE) -C gitweb install
@@ -2629,7 +2631,7 @@ install-doc: install-man-perl
 install-man: install-man-perl
 	$(MAKE) -C Documentation install-man
 
-install-man-perl: perl/build/man/man3/Git.3pm
+install-man-perl: man-perl
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
 	(cd perl/build/man/man3 && $(TAR) cf - .) | \
 	(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
-- 
2.16.1.354.g266d823471


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets
  2018-02-15  2:14 [PATCH] Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets SZEDER Gábor
@ 2018-02-15  8:52 ` Ævar Arnfjörð Bjarmason
  2018-02-15 18:05   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-02-15  8:52 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: git, Junio C Hamano


On Thu, Feb 15 2018, SZEDER Gábor jotted:

> Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with
> simple make rules, 2017-12-10), the Git(3pm) man page is only
> generated as an indirect dependency of the 'install-doc' and
> 'install-man' Makefile targets.  Consequently, if someone runs 'make
> man && sudo make install-man' (or their 'doc' counterparts), then
> Git(3pm) will be generated as root, and the resulting root-owned files
> and directories will in turn cause the next user-run 'make clean' to
> fail.  This was not an issue in the past, because Git(3pm) was
> generated when 'make all' descended into 'perl/', which is usually not
> run as root.
>
> List Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,
> too, so it gets generated by targets that are usually built as
> ordinary users.
>
> While at it, add 'install-man-perl' to the list of .PHONY targets.

Thanks for the fixup of my crappy 'make' skills. I tested this before
the patch and it indeed has the problem you describe, and this fixes
it. Thanks! CC-ing Junio because I think it makes sense to pick this up
as-is.

Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets
  2018-02-15  8:52 ` Ævar Arnfjörð Bjarmason
@ 2018-02-15 18:05   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2018-02-15 18:05 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: SZEDER Gábor, git

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> On Thu, Feb 15 2018, SZEDER Gábor jotted:
>
>> Since commit 20d2a30f8f (Makefile: replace perl/Makefile.PL with
>> simple make rules, 2017-12-10), the Git(3pm) man page is only
>> generated as an indirect dependency of the 'install-doc' and
>> 'install-man' Makefile targets.  Consequently, if someone runs 'make
>> man && sudo make install-man' (or their 'doc' counterparts), then
>> Git(3pm) will be generated as root, and the resulting root-owned files
>> and directories will in turn cause the next user-run 'make clean' to
>> fail.  This was not an issue in the past, because Git(3pm) was
>> generated when 'make all' descended into 'perl/', which is usually not
>> run as root.
>>
>> List Git(3pm) as a dependency of the 'doc' and 'man' Makefile targets,
>> too, so it gets generated by targets that are usually built as
>> ordinary users.
>>
>> While at it, add 'install-man-perl' to the list of .PHONY targets.
>
> Thanks for the fixup of my crappy 'make' skills. I tested this before
> the patch and it indeed has the problem you describe, and this fixes
> it. Thanks! CC-ing Junio because I think it makes sense to pick this up
> as-is.
>
> Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>

Thanks.  

It is better late than never to have fixes like this, but I am a bit
disturbed to notice that for the last few batches, we see fixes to
topics after they land 'master', not while they are in 'next'.

Will apply.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-15 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-15  2:14 [PATCH] Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets SZEDER Gábor
2018-02-15  8:52 ` Ævar Arnfjörð Bjarmason
2018-02-15 18:05   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).