{"thread":{"id":"15768","subject":"Re: [PATCH] Do not rename read-only files during a push","startedAt":"2008-09-22T17:20:29Z","lastAt":"2008-10-03T14:19:18Z","messageCount":4,"participants":["Petr Baudis","Shawn O. Pearce","Miklos Vajna"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"299065","messageId":"1222104029-28366-1-git-send-email-pasky@suse.cz","threadId":"15768","inReplyTo":null,"subject":"[PATCH] Do not rename read-only files during a push","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-09-22T17:20:29Z","receivedAt":"2008-09-22T17:20:29Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Win32 does not allow renaming read-only files (at least on a Samba\nshare), making push into a local directory to fail. Thus, defer\nthe chmod() call in index-pack.c:final() only after\nmove_temp_to_file() was called.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\n index-pack.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/index-pack.c b/index-pack.c\nindex a6e91fe..2af72d6 100644\n--- a/index-pack.c\n+++ b/index-pack.c\n@@ -786,7 +786,6 @@ static void final(const char *final_pack_name, const char *curr_pack_name,\n \t\terr = close(output_fd);\n \t\tif (err)\n \t\t\tdie(\"error while closing pack file: %s\", strerror(errno));\n-\t\tchmod(curr_pack_name, 0444);\n \t}\n \n \tif (keep_msg) {\n@@ -820,8 +819,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name,\n \t\tif (move_temp_to_file(curr_pack_name, final_pack_name))\n \t\t\tdie(\"cannot store pack file\");\n \t}\n+\tchmod(final_pack_name, 0444);\n \n-\tchmod(curr_index_name, 0444);\n \tif (final_index_name != curr_index_name) {\n \t\tif (!final_index_name) {\n \t\t\tsnprintf(name, sizeof(name), \"%s/pack/pack-%s.idx\",\n@@ -831,6 +830,7 @@ static void final(const char *final_pack_name, const char *curr_pack_name,\n \t\tif (move_temp_to_file(curr_index_name, final_index_name))\n \t\t\tdie(\"cannot store index file\");\n \t}\n+\tchmod(final_index_name, 0444);\n \n \tif (!from_stdin) {\n \t\tprintf(\"%s\\n\", sha1_to_hex(sha1));\n-- \ntg: (fe33b33..) t/pack/rdonly (depends on: vanilla/master)\n"},{"id":"92233","messageId":"20081003102043.GR10544@machine.or.cz","threadId":"15768","inReplyTo":"1222104029-28366-1-git-send-email-pasky@suse.cz","subject":"Re: [PATCH] Do not rename read-only files during a push","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-10-03T10:20:43Z","receivedAt":"2008-10-03T10:20:43Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Mon, Sep 22, 2008 at 07:20:29PM +0200, Petr Baudis wrote:\n> Win32 does not allow renaming read-only files (at least on a Samba\n> share), making push into a local directory to fail. Thus, defer\n> the chmod() call in index-pack.c:final() only after\n> move_temp_to_file() was called.\n> \n> Signed-off-by: Petr Baudis <pasky@suse.cz>\n\nPing?\n\n\t\t\t\tPetr \"Pasky\" Baudis\n"},{"id":"92251","messageId":"20081003141628.GV21310@spearce.org","threadId":"15768","inReplyTo":"20081003102043.GR10544@machine.or.cz","subject":"Re: [PATCH] Do not rename read-only files during a push","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-03T14:16:28Z","receivedAt":"2008-10-03T14:16:28Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Petr Baudis <pasky@suse.cz> wrote:\n> On Mon, Sep 22, 2008 at 07:20:29PM +0200, Petr Baudis wrote:\n> > Win32 does not allow renaming read-only files (at least on a Samba\n> > share), making push into a local directory to fail. Thus, defer\n> > the chmod() call in index-pack.c:final() only after\n> > move_temp_to_file() was called.\n> > \n> > Signed-off-by: Petr Baudis <pasky@suse.cz>\n> \n> Ping?\n\nHmmph.  It got dropped by accident.  I don't remember seeing this\npatch via email, and its not on GMane.  I found it on marc and am\napplying it right now.  Thanks for the reminder.\n\n-- \nShawn.\n"},{"id":"92252","messageId":"20081003141918.GR23137@genesis.frugalware.org","threadId":"15768","inReplyTo":"20081003141628.GV21310@spearce.org","subject":"Re: [PATCH] Do not rename read-only files during a push","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-10-03T14:19:18Z","receivedAt":"2008-10-03T14:19:18Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Fri, Oct 03, 2008 at 07:16:28AM -0700, \"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> Hmmph.  It got dropped by accident.  I don't remember seeing this\n> patch via email, and its not on GMane.\n\nIt has a duplicated To: header, probably it was filtered out as spam.\n"}]}