{"thread":{"id":"21008","subject":"[PATCH] Trivial fix: Display a more friendly message with git-shell.","startedAt":"2009-09-20T17:11:12Z","lastAt":"2009-09-22T08:17:18Z","messageCount":8,"participants":["Thiago Farina","Tay Ray Chuan","Johannes Sixt","Matthieu Moy","Heiko Voigt","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"123543","messageId":"1253466672-21051-1-git-send-email-tfransosi@gmail.com","threadId":"21008","inReplyTo":null,"subject":"[PATCH] Trivial fix: Display a more friendly message with git-shell.","fromName":"Thiago Farina","fromEmail":"tfransosi@gmail.com","sentAt":"2009-09-20T17:11:12Z","receivedAt":"2009-09-20T17:11:12Z","isPatch":true,"sender":{"key":"tfransosi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/970071?v=4"},"body":"Instead of simply die without give a helpful message, displays the usage\nstring that shows to the user how it can be used.\n\nSigned-off-by: Thiago Farina <tfransosi@gmail.com>\n---\n shell.c |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/shell.c b/shell.c\nindex e4864e0..aa7f47e 100644\n--- a/shell.c\n+++ b/shell.c\n@@ -3,6 +3,8 @@\n #include \"exec_cmd.h\"\n #include \"strbuf.h\"\n \n+static const char shell_usage[] = \"git shell -c <command> <argument>\";\n+\n static int do_generic_cmd(const char *me, char *arg)\n {\n \tconst char *my_argv[4];\n@@ -74,7 +76,7 @@ int main(int argc, char **argv)\n \t * where \"cmd\" is a very limited subset of git commands.\n \t */\n \telse if (argc != 3 || strcmp(argv[1], \"-c\"))\n-\t\tdie(\"What do you think I am? A shell?\");\n+\t\tusage(shell_usage);\n \n \tprog = argv[2];\n \tif (!strncmp(prog, \"git\", 3) && isspace(prog[3]))\n-- \n1.6.5.rc1.37.gf5c31.dirty\n"},{"id":"123556","messageId":"be6fef0d0909202121u1d7f843bx97f86eed8bf79618@mail.gmail.com","threadId":"21008","inReplyTo":"1253466672-21051-1-git-send-email-tfransosi@gmail.com","subject":"Re: [PATCH] Trivial fix: Display a more friendly message with git-shell.","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2009-09-21T04:21:54Z","receivedAt":"2009-09-21T04:21:54Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Hi,\n\nOn Mon, Sep 21, 2009 at 1:11 AM, Thiago Farina <tfransosi@gmail.com> wrote:\n> Instead of simply die without give a helpful message, displays the usage\n\ns/give/giving/.\n\nNot sure if the same should be done for die (like die()'ing).\n\n-- \nCheers,\nRay Chuan\n"},{"id":"123557","messageId":"4AB71A76.5010509@viscovery.net","threadId":"21008","inReplyTo":"1253466672-21051-1-git-send-email-tfransosi@gmail.com","subject":"Re: [PATCH] Trivial fix: Display a more friendly message with git-shell.","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-09-21T06:17:26Z","receivedAt":"2009-09-21T06:17:26Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Thiago Farina schrieb:\n> +static const char shell_usage[] = \"git shell -c <command> <argument>\";\n> +\n>  static int do_generic_cmd(const char *me, char *arg)\n>  {\n>  \tconst char *my_argv[4];\n> @@ -74,7 +76,7 @@ int main(int argc, char **argv)\n>  \t * where \"cmd\" is a very limited subset of git commands.\n>  \t */\n>  \telse if (argc != 3 || strcmp(argv[1], \"-c\"))\n> -\t\tdie(\"What do you think I am? A shell?\");\n> +\t\tusage(shell_usage);\n\nI don't think this is an improvement.\n\ngit-shell has a very limited use: It is to be used as the login-shell of\naccounts where the admin will allow ssh access, but only to git repositories.\n\nEvery other use of git-shell is an error, and the current error message\nsays exactly that, although in a very 31337 way (and, BTW, /me likes it :-)\n\nIf an naive user runs git-shell from the command line, then your new\nmessage will not be helpful because git-shell will accept only a very\nrestricted set of commands.\n\n-- Hannes\n"},{"id":"123558","messageId":"vpqeiq0ssn7.fsf@bauges.imag.fr","threadId":"21008","inReplyTo":"4AB71A76.5010509@viscovery.net","subject":"Re: [PATCH] Trivial fix: Display a more friendly message with git-shell.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2009-09-21T06:45:16Z","receivedAt":"2009-09-21T06:45:16Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Every other use of git-shell is an error, and the current error message\n> says exactly that, although in a very 31337 way (and, BTW, /me likes\n> it :-)\n\nWell, it's funny, but for a newcommer, trying \"git shell\" hoping to\nget, for example what \"bzr shell\" gives (an interactive shell with\nnormal shell commands plus bzr ones without the 'bzr' prefix), it's\nquite frustrating to be almost insulted by the tool for being curious.\n\n> If an naive user runs git-shell from the command line, then your new\n> message will not be helpful because git-shell will accept only a very\n> restricted set of commands.\n\nPerhaps one more line saying what 'man git-shell' says in addition\nwould help:\n\n$ git-shell\ngit-shell: Restricted login shell for GIT-only SSH access\nUsage: ...\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"123603","messageId":"a4c8a6d00909211345q593e673bo4964204afa5ce807@mail.gmail.com","threadId":"21008","inReplyTo":"vpqeiq0ssn7.fsf@bauges.imag.fr","subject":"Re: [PATCH] Trivial fix: Display a more friendly message with git-shell.","fromName":"Thiago Farina","fromEmail":"tfransosi@gmail.com","sentAt":"2009-09-21T20:45:50Z","receivedAt":"2009-09-21T20:45:50Z","isPatch":true,"sender":{"key":"tfransosi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/970071?v=4"},"body":"Hi Matthieu\nOn Mon, Sep 21, 2009 at 3:45 AM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> Perhaps one more line saying what 'man git-shell' says in addition\n> would help:\n>\n> $ git-shell\n> git-shell: Restricted login shell for GIT-only SSH access\n> Usage: ...\nI added this line to the output usage, but would be good to show the\ncommands that git-shell accept too?\n"},{"id":"123614","messageId":"vpqr5tzqvzm.fsf@bauges.imag.fr","threadId":"21008","inReplyTo":"a4c8a6d00909211345q593e673bo4964204afa5ce807@mail.gmail.com","subject":"Re: [PATCH] Trivial fix: Display a more friendly message with git-shell.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2009-09-22T07:28:13Z","receivedAt":"2009-09-22T07:28:13Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Thiago Farina <tfransosi@gmail.com> writes:\n\n> Hi Matthieu\n> On Mon, Sep 21, 2009 at 3:45 AM, Matthieu Moy\n> <Matthieu.Moy@grenoble-inp.fr> wrote:\n>> Perhaps one more line saying what 'man git-shell' says in addition\n>> would help:\n>>\n>> $ git-shell\n>> git-shell: Restricted login shell for GIT-only SSH access\n>> Usage: ...\n> I added this line to the output usage, but would be good to show the\n> commands that git-shell accept too?\n\nWell, at some point, I think the user will have to read the man page.\nI find it better to have a non-agressive error message, but I'm not\nsure it's relevant to try to give the complete manual here.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"123616","messageId":"20090922081544.GB48307@book.hvoigt.net","threadId":"21008","inReplyTo":"vpqr5tzqvzm.fsf@bauges.imag.fr","subject":"Re: Re: [PATCH] Trivial fix: Display a more friendly message with git-shell.","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-09-22T08:15:44Z","receivedAt":"2009-09-22T08:15:44Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"On Tue, Sep 22, 2009 at 09:28:13AM +0200, Matthieu Moy wrote:\n> Thiago Farina <tfransosi@gmail.com> writes:\n> \n> > On Mon, Sep 21, 2009 at 3:45 AM, Matthieu Moy\n> > <Matthieu.Moy@grenoble-inp.fr> wrote:\n> >> $ git-shell\n> >> git-shell: Restricted login shell for GIT-only SSH access\n> >> Usage: ...\n> > I added this line to the output usage, but would be good to show the\n> > commands that git-shell accept too?\n> \n> Well, at some point, I think the user will have to read the man page.\n> I find it better to have a non-agressive error message, but I'm not\n> sure it's relevant to try to give the complete manual here.\n\nWhy not simply like this? I liked the old output as well. And sometimes its\njust better to have commands behave like humans ;)\n\ndiff --git a/shell.c b/shell.c\nindex e4864e0..a0da191 100644\n--- a/shell.c\n+++ b/shell.c\n@@ -74,7 +74,8 @@ int main(int argc, char **argv)\n         * where \"cmd\" is a very limited subset of git commands.\n         */\n        else if (argc != 3 || strcmp(argv[1], \"-c\"))\n-               die(\"What do you think I am? A shell?\");\n+               die(\"What do you think I am? A shell?\\n\\\n+                    See: git help shell\");\n \n        prog = argv[2];\n        if (!strncmp(prog, \"git\", 3) && isspace(prog[3]))\n"},{"id":"123617","messageId":"m3fxafbdh0.fsf@localhost.localdomain","threadId":"21008","inReplyTo":"vpqr5tzqvzm.fsf@bauges.imag.fr","subject":"Re: [PATCH] Trivial fix: Display a more friendly message with git-shell.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-09-22T08:17:18Z","receivedAt":"2009-09-22T08:17:18Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n> Thiago Farina <tfransosi@gmail.com> writes:\n> \n>> Hi Matthieu\n>> On Mon, Sep 21, 2009 at 3:45 AM, Matthieu Moy\n>> <Matthieu.Moy@grenoble-inp.fr> wrote:\n>>> Perhaps one more line saying what 'man git-shell' says in addition\n>>> would help:\n>>>\n>>> $ git-shell\n>>> git-shell: Restricted login shell for GIT-only SSH access\n>>> Usage: ...\n>> I added this line to the output usage, but would be good to show the\n>> commands that git-shell accept too?\n> \n> Well, at some point, I think the user will have to read the man page.\n> I find it better to have a non-agressive error message, but I'm not\n> sure it's relevant to try to give the complete manual here.\n\nPerhaps:\n\n  $ git-shell\n  git-shell: Restricted login shell for GIT-only SSH access\n  This shell cannot be used as a login (interactive) shell\n\nand/or\n\n  $ ssh user@repo.example.com\n  This user is restricted to GIT-only SSH access\n\n(or something like that, especially in the second case).\n\nI don't think giving 'Usage:' here would be a good idea, as this\nprogram is not meant for end user, but for automatic use.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}