{"thread":{"id":"11585","subject":"[PATCH] git-relink.perl: warn() instead of die() on directory open failure","startedAt":"2008-01-11T18:11:41Z","lastAt":"2008-01-12T02:26:51Z","messageCount":3,"participants":["Brandon Casey","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"65042","messageId":"4787B15D.3070105@nrlssc.navy.mil","threadId":"11585","inReplyTo":null,"subject":"[PATCH] git-relink.perl: warn() instead of die() on directory open failure","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-01-11T18:11:41Z","receivedAt":"2008-01-11T18:11:41Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n\n\nSometimes the repository to link to is not under your control.\nIf it contains files or unreadable directories, git-relink will\ndie without this patch.\n\n-brandon\n\n\n git-relink.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-relink.perl b/git-relink.perl\nindex f6b4f6a..391b12d 100755\n--- a/git-relink.perl\n+++ b/git-relink.perl\n@@ -69,7 +69,7 @@ sub do_scan_directory($$$) {\n \tmy $dfulldir = sprintf(\"%sobjects/%s/\",$dstdir,$subdir);\n \n \topendir(S,$sfulldir)\n-\t\tor die \"Failed to opendir $sfulldir: $!\";\n+\t\tor (warn \"Failed to opendir $sfulldir: $!\" and return);\n \n \tforeach my $file (grep(!/\\.{1,2}$/, readdir(S))) {\n \t\tmy $sfilename = $sfulldir . $file;\n-- \n1.5.4.rc2.84.gf85fd-dirty\n"},{"id":"65110","messageId":"7vabnbzt6t.fsf@gitster.siamese.dyndns.org","threadId":"11585","inReplyTo":"4787B15D.3070105@nrlssc.navy.mil","subject":"Re: [PATCH] git-relink.perl: warn() instead of die() on directory open failure","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-12T02:14:18Z","receivedAt":"2008-01-12T02:14:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Casey <casey@nrlssc.navy.mil> writes:\n\n> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n> ---\n>\n>\n> Sometimes the repository to link to is not under your control.\n> If it contains files or unreadable directories, git-relink will\n> die without this patch.\n\nI am not so sure if dying is a bad behaviour, if it is because\nyou are trying to link against an object store that you may not\nbe able to read.  I actually think we should actively refuse to,\nin order to prevent future problems.  After seeing the command\ndie, you will talk to the owner of that \"master\" object store\nand ask him to fix permissions (or he may choose to say \"please\ndo not share with me\").\n\nHowever, if the \"master\" object store has pruned its loose\nobjects since you read @hashdirs out of it, that opendir() can\nfail, and we should silently ignore the whole $subdir.\n"},{"id":"65113","messageId":"4788256B.2080007@nrlssc.navy.mil","threadId":"11585","inReplyTo":"7vabnbzt6t.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-relink.perl: warn() instead of die() on directory open failure","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-01-12T02:26:51Z","receivedAt":"2008-01-12T02:26:51Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Junio C Hamano wrote:\n> Brandon Casey <casey@nrlssc.navy.mil> writes:\n> \n>> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n>> ---\n>>\n>>\n>> Sometimes the repository to link to is not under your control.\n>> If it contains files or unreadable directories, git-relink will\n>> die without this patch.\n> \n> I am not so sure if dying is a bad behaviour, if it is because\n> you are trying to link against an object store that you may not\n> be able to read.  I actually think we should actively refuse to,\n> in order to prevent future problems.  After seeing the command\n> die, you will talk to the owner of that \"master\" object store\n> and ask him to fix permissions (or he may choose to say \"please\n> do not share with me\").\n\nThe case for me was that the objects directory contained temporary\npack files. This is a perfectly valid state for a git repository,\nbut relink() currently aborts the whole effort when it encounters\na non-directory.\n\nStale tmp packs can remain if the user aborted a git command before\nit was finished. (hmm, maybe git-gc --prune could remove these too?)\n\nI only mentioned the unreadable directory case as another possibility.\nYou're probably right about that one.\n\n-brandon\n"}]}