{"thread":{"id":"9408","subject":"[PATCH] Documentation/Makefile: remove cmd-list.made before redirecting to it.","startedAt":"2007-08-06T13:05:56Z","lastAt":"2007-08-07T10:29:23Z","messageCount":3,"participants":["David Kastrup","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"50017","messageId":"86vebsby27.fsf@lola.quinscape.zz","threadId":"9408","inReplyTo":null,"subject":"[PATCH] Documentation/Makefile: remove cmd-list.made before redirecting to it.","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-06T13:05:56Z","receivedAt":"2007-08-06T13:05:56Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"\n\nIf cmd-list.made has been created by a previous run as root, output\nredirection to it will fail.  So remove it before regeneration.\n\nSigned-off-by: David Kastrup <dak@gnu.org>\n---\n Documentation/Makefile |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/Makefile b/Documentation/Makefile\nindex 97ee067..120e7c0 100644\n--- a/Documentation/Makefile\n+++ b/Documentation/Makefile\n@@ -120,6 +120,7 @@ $(cmds_txt): cmd-list.made\n \n cmd-list.made: cmd-list.perl $(MAN1_TXT)\n \tperl ./cmd-list.perl\n+\t$(RM) $@\n \tdate >$@\n \n git.7 git.html: git.txt core-intro.txt\n-- \n1.5.3.rc4.21.ga63eb\n"},{"id":"50094","messageId":"7vlkcn97ll.fsf@assigned-by-dhcp.cox.net","threadId":"9408","inReplyTo":"86vebsby27.fsf@lola.quinscape.zz","subject":"Re: [PATCH] Documentation/Makefile: remove cmd-list.made before redirecting to it.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-07T06:33:42Z","receivedAt":"2007-08-07T06:33:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Kastrup <dak@gnu.org> writes:\n\n> If cmd-list.made has been created by a previous run as root, output\n> redirection to it will fail.  So remove it before regeneration.\n>\n> Signed-off-by: David Kastrup <dak@gnu.org>\n> ---\n>  Documentation/Makefile |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>\n> diff --git a/Documentation/Makefile b/Documentation/Makefile\n> index 97ee067..120e7c0 100644\n> --- a/Documentation/Makefile\n> +++ b/Documentation/Makefile\n> @@ -120,6 +120,7 @@ $(cmds_txt): cmd-list.made\n>  \n>  cmd-list.made: cmd-list.perl $(MAN1_TXT)\n>  \tperl ./cmd-list.perl\n> +\t$(RM) $@\n>  \tdate >$@\n>  \n>  git.7 git.html: git.txt core-intro.txt\n\nAlthough I understand that it would be a problem if you built as\nroot earlier, which would have left files unmodifyable by you, I\nthink this is getting out of hand.  The cmd-list.perl script\nitself, for example, does \"creat in $out+, if the contents have\nchanged from the last round then rename $out+ to $out\" sequence\nin order to avoid unnecessary rebuild of files that depend on\nthe generated command list.  If it is interrupted in the middle\nwhile running as root, and then you try to do another build, I\nsuspect \"creat in $out+\" part would fail.\n\nMaybe you can simply recover from such an error with a \"make\nclean\"?\n\nAlso I'd prefer $(RM) before actually running the command to\ngenerate the list, but that is just the matter of taste.\n"},{"id":"50112","messageId":"868x8n8wos.fsf@lola.quinscape.zz","threadId":"9408","inReplyTo":"7vlkcn97ll.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Documentation/Makefile: remove cmd-list.made before redirecting to it.","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-07T10:29:23Z","receivedAt":"2007-08-07T10:29:23Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Although I understand that it would be a problem if you built as\n> root earlier, which would have left files unmodifyable by you, I\n> think this is getting out of hand.  The cmd-list.perl script itself,\n> for example, does \"creat in $out+, if the contents have changed from\n> the last round then rename $out+ to $out\" sequence in order to avoid\n> unnecessary rebuild of files that depend on the generated command\n> list.  If it is interrupted in the middle while running as root, and\n> then you try to do another build, I suspect \"creat in $out+\" part\n> would fail.\n\nNo, creat is only interested in the directory permissions.  It is\nopen(..., O_TRUNC) that causes the problem.  There are not many\nprograms that actually use that for their output files, but shell\noutput redirection is one of them, and some editors tend to do this as\nwell in order to easily preserve permissions.\n\nThere are no other shell output redirections to an undeleted file in\nthe Makefile.\n\n-- \nDavid Kastrup\n"}]}