{"thread":{"id":"14859","subject":"[TopGit PATCH] tg.sh: Check for read permissions of help files","startedAt":"2008-08-06T08:02:51Z","lastAt":"2008-08-09T08:24:36Z","messageCount":3,"participants":["Bert Wesarg","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"86323","messageId":"1218009771-30358-1-git-send-email-bert.wesarg@googlemail.com","threadId":"14859","inReplyTo":null,"subject":"[TopGit PATCH] tg.sh: Check for read permissions of help files","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2008-08-06T08:02:51Z","receivedAt":"2008-08-06T08:02:51Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"We currently check only for '-f' but we need to have read permissions as well.\n\nAnd help files don't need the execution bit set.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n Makefile |    2 +-\n tg.sh    |    2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 238d07d..f9dbe6e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -35,7 +35,7 @@ install:: all\n \tinstall -d -m 755 \"$(hooksdir)\"\n \tinstall $(hooks_out) \"$(hooksdir)\"\n \tinstall -d -m 755 \"$(sharedir)\"\n-\tinstall $(help_out) \"$(sharedir)\"\n+\tinstall -m 644 $(help_out) \"$(sharedir)\"\n \n clean::\n \trm -f tg $(commands_out) $(hooks_out) $(help_out)\ndiff --git a/tg.sh b/tg.sh\nindex 03a392b..edac006 100644\n--- a/tg.sh\n+++ b/tg.sh\n@@ -154,7 +154,7 @@ do_help()\n \tif [ -z \"$1\" ] ; then\n \t\techo \"TopGit v0.1 - A different patch queue manager\"\n \t\techo \"Usage: tg (create|delete|info|patch|summary|update|help) ...\"\n-\telif [ -f \"@sharedir@/tg-$1.txt\" ] ; then\n+\telif [ -f \"@sharedir@/tg-$1.txt\" -a -r \"@sharedir@/tg-$1.txt\" ] ; then\n \t\tcat \"@sharedir@/tg-$1.txt\"\n \telse\n \t\techo \"`basename $0`: no help for $1\" 1>&2\n-- \ntg: (e311d15..) t/check-read-permissions-of-help-files (depends on: master)\n"},{"id":"86580","messageId":"36ca99e90808090035r6331a118k5a26486de1acf002@mail.gmail.com","threadId":"14859","inReplyTo":"1218009771-30358-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH] tg.sh: Check for read permissions of help files","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2008-08-09T07:35:19Z","receivedAt":"2008-08-09T07:35:19Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Petr,\n\nOn Wed, Aug 6, 2008 at 10:02, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n> -       elif [ -f \"@sharedir@/tg-$1.txt\" ] ; then\n> +       elif [ -f \"@sharedir@/tg-$1.txt\" -a -r \"@sharedir@/tg-$1.txt\" ] ; then\nI saw your simplified commit for this, but you should know, that '-r'\ntests only for read permissions, not for a regular file, so this test\nsucceed also for a pipe/socket for which do you have read permissions.\n\nBert\n\n>                cat \"@sharedir@/tg-$1.txt\"\n>        else\n>                echo \"`basename $0`: no help for $1\" 1>&2\n> --\n> tg: (e311d15..) t/check-read-permissions-of-help-files (depends on: master)\n>\n"},{"id":"86585","messageId":"20080809082436.GU10151@machine.or.cz","threadId":"14859","inReplyTo":"36ca99e90808090035r6331a118k5a26486de1acf002@mail.gmail.com","subject":"Re: [TopGit PATCH] tg.sh: Check for read permissions of help files","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-08-09T08:24:36Z","receivedAt":"2008-08-09T08:24:36Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Sat, Aug 09, 2008 at 09:35:19AM +0200, Bert Wesarg wrote:\n> Petr,\n> \n> On Wed, Aug 6, 2008 at 10:02, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n> > -       elif [ -f \"@sharedir@/tg-$1.txt\" ] ; then\n> > +       elif [ -f \"@sharedir@/tg-$1.txt\" -a -r \"@sharedir@/tg-$1.txt\" ] ; then\n> I saw your simplified commit for this, but you should know, that '-r'\n> tests only for read permissions, not for a regular file, so this test\n> succeed also for a pipe/socket for which do you have read permissions.\n\nIs that a problem? :-)\n\n\t\t\t\tPetr \"Pasky\" Baudis\n"}]}