{"thread":{"id":"25558","subject":"[PATCH] fetch-pack: make the ssh connection quiet","startedAt":"2010-10-27T14:27:08Z","lastAt":"2010-10-28T09:14:03Z","messageCount":5,"participants":["Jan Stępień","Drew Northup","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"154493","messageId":"1288189628-4883-1-git-send-email-jstepien@users.sourceforge.net","threadId":"25558","inReplyTo":null,"subject":"[PATCH] fetch-pack: make the ssh connection quiet","fromName":"Jan Stępień","fromEmail":"jstepien@users.sourceforge.net","sentAt":"2010-10-27T14:27:08Z","receivedAt":"2010-10-27T14:27:08Z","isPatch":true,"sender":{"key":"jstepien@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/39084?v=4"},"body":"The --quiet option passed to fetch-pack did not affect the ssh child\nprocess. When an ssh server sent a motd it was displayed because the ssh\nclient wasn't launched with the -q option. This patch makes ssh run quietly\nwhen fetch-pack is called with -q.\n\nAn analogous change should be made to other commands which accept --quiet\nand connect to remotes using ssh.\n\nSigned-off-by: Jan Stępień <jstepien@users.sourceforge.net>\n---\n builtin/fetch-pack.c |    3 ++-\n cache.h              |    1 +\n connect.c            |    2 ++\n 3 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c\nindex dbd8b7b..ede1c34 100644\n--- a/builtin/fetch-pack.c\n+++ b/builtin/fetch-pack.c\n@@ -876,7 +876,8 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)\n \t\tfd[1] = 1;\n \t} else {\n \t\tconn = git_connect(fd, (char *)dest, args.uploadpack,\n-\t\t\t\t   args.verbose ? CONNECT_VERBOSE : 0);\n+\t\t\t\t   (args.verbose ? CONNECT_VERBOSE : 0) |\n+\t\t\t\t   (args.quiet ? CONNECT_QUIET : 0));\n \t}\n \n \tget_remote_heads(fd[0], &ref, 0, NULL, 0, NULL);\ndiff --git a/cache.h b/cache.h\nindex 33decd9..8622a78 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -938,6 +938,7 @@ struct ref {\n extern struct ref *find_ref_by_name(const struct ref *list, const char *name);\n \n #define CONNECT_VERBOSE       (1u << 0)\n+#define CONNECT_QUIET         (1u << 1)\n extern char *git_getpass(const char *prompt);\n extern struct child_process *git_connect(int fd[2], const char *url, const char *prog, int flags);\n extern int finish_connect(struct child_process *conn);\ndiff --git a/connect.c b/connect.c\nindex 57dc20c..709601e 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -585,6 +585,8 @@ struct child_process *git_connect(int fd[2], const char *url_orig,\n \t\t\t*arg++ = putty ? \"-P\" : \"-p\";\n \t\t\t*arg++ = port;\n \t\t}\n+\t\tif (!putty && flags & CONNECT_QUIET)\n+\t\t\t*arg++ = \"-q\";\n \t\t*arg++ = host;\n \t}\n \telse {\n-- \n1.7.0.4\n"},{"id":"154543","messageId":"1288193069.15518.40.camel@drew-northup.unet.maine.edu","threadId":"25558","inReplyTo":"1288189628-4883-1-git-send-email-jstepien@users.sourceforge.net","subject":"Re: [PATCH] fetch-pack: make the ssh connection quiet","fromName":"Drew Northup","fromEmail":"drew.northup@maine.edu","sentAt":"2010-10-27T15:24:29Z","receivedAt":"2010-10-27T15:24:29Z","isPatch":true,"sender":{"key":"drew.northup@maine.edu","avatar":"https://avatars.githubusercontent.com/u/18331571?v=4"},"body":"\nOn Wed, 2010-10-27 at 16:27 +0200, Jan Stępień wrote:\n> The --quiet option passed to fetch-pack did not affect the ssh child\n> process. When an ssh server sent a motd it was displayed because the ssh\n> client wasn't launched with the -q option. This patch makes ssh run quietly\n> when fetch-pack is called with -q.\n> \n> An analogous change should be made to other commands which accept --quiet\n> and connect to remotes using ssh.\n\nI'm not so sure that's a good idea. Quoting from the (Open)SSH man page:\n\n-q      Quiet mode.  Causes all warning and diagnostic messages to be suppressed.\n\nSomehow I doubt that's what you intended or a good idea.\n\n-- \n-Drew Northup N1XIM\n   AKA RvnPhnx on OPN\n________________________________________________\n\"As opposed to vegetable or mineral error?\"\n-John Pescatore, SANS NewsBites Vol. 12 Num. 59\n"},{"id":"154566","messageId":"20101027204023.729808c8.jan@stepien.cc","threadId":"25558","inReplyTo":"1288193069.15518.40.camel@drew-northup.unet.maine.edu","subject":"Re: [PATCH] fetch-pack: make the ssh connection quiet","fromName":"Jan Stępień","fromEmail":"jan@stepien.cc","sentAt":"2010-10-27T18:40:23Z","receivedAt":"2010-10-27T18:40:23Z","isPatch":true,"sender":{"key":"jan@stepien.cc","avatar":"https://gravatar.com/avatar/3b33886a822d755985d46e0fe448703bf3bd15e9822b1a7fed71f48b23d1a49c?d=mp&s=160"},"body":"On Wed, 27 Oct 2010 11:24:29 -0400\nDrew Northup <drew.northup@maine.edu> wrote:\n> On Wed, 2010-10-27 at 16:27 +0200, Jan Stępień wrote:\n> > The --quiet option passed to fetch-pack did not affect the ssh child\n> > process. When an ssh server sent a motd it was displayed because the ssh\n> > client wasn't launched with the -q option. This patch makes ssh run quietly\n> > when fetch-pack is called with -q.\n> > \n> > An analogous change should be made to other commands which accept --quiet\n> > and connect to remotes using ssh.\n> \n> I'm not so sure that's a good idea. Quoting from the (Open)SSH man page:\n> \n> -q      Quiet mode.  Causes all warning and diagnostic messages to be suppressed.\n> \n> Somehow I doubt that's what you intended or a good idea.\n\nThat's right, but according to the same source all fatal error messages\nstill get displayed. It's a question of how quiet should fetch-pack be\nwhen --quiet is enabled.\n\nThanks for the comment,\n-- \nJan Stępień <jan@stepien.cc>\n"},{"id":"154582","messageId":"7v1v7bclhe.fsf@alter.siamese.dyndns.org","threadId":"25558","inReplyTo":"1288189628-4883-1-git-send-email-jstepien@users.sourceforge.net","subject":"Re: [PATCH] fetch-pack: make the ssh connection quiet","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-10-27T22:35:41Z","receivedAt":"2010-10-27T22:35:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jan Stępień  <jstepien@users.sourceforge.net> writes:\n\n> The --quiet option passed to fetch-pack did not affect the ssh child\n> process. When an ssh server sent a motd it was displayed because the ssh\n> client wasn't launched with the -q option.\n\nThis is curious for a couple of reasons:\n\n1. \"-q\" option to \"ssh\" is not meant to supress \"motd\"; it is about\n   warning and diagnostics.  From man ssh(1):\n\n     -q Quiet mode.  Causes most warning and diagnostic messages to be\n        suppressed.  Only fatal errors are displayed.  If a second -q is\n        given then even fatal errors are suppressed, except for those\n        produced due solely to bad argu‐ ments.\n\n2. \"PrintMotd\" defaults to \"yes\" but it is to specify whether the daemon\n   should print /etc/motd when a user logs in interactively.  I didn't\n   think fetch-pack logged in interactively, so why should this matter?\n"},{"id":"154617","messageId":"20101028111403.db0f8593.jan@stepien.cc","threadId":"25558","inReplyTo":"7v1v7bclhe.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] fetch-pack: make the ssh connection quiet","fromName":"Jan Stępień","fromEmail":"jan@stepien.cc","sentAt":"2010-10-28T09:14:03Z","receivedAt":"2010-10-28T09:14:03Z","isPatch":true,"sender":{"key":"jan@stepien.cc","avatar":"https://gravatar.com/avatar/3b33886a822d755985d46e0fe448703bf3bd15e9822b1a7fed71f48b23d1a49c?d=mp&s=160"},"body":"On Wed, 27 Oct 2010 15:35:41 -0700\nJunio C Hamano <gitster@pobox.com> wrote:\n> Jan Stępień  <jstepien@users.sourceforge.net> writes:\n> > The --quiet option passed to fetch-pack did not affect the ssh child\n> > process. When an ssh server sent a motd it was displayed because the ssh\n> > client wasn't launched with the -q option.\n> \n> This is curious for a couple of reasons:\n> \n> 1. \"-q\" option to \"ssh\" is not meant to supress \"motd\"; it is about\n>    warning and diagnostics.  From man ssh(1):\n> \n>      -q Quiet mode.  Causes most warning and diagnostic messages to be\n>         suppressed.  Only fatal errors are displayed.  If a second -q is\n>         given then even fatal errors are suppressed, except for those\n>         produced due solely to bad argu‐ ments.\n> \n> 2. \"PrintMotd\" defaults to \"yes\" but it is to specify whether the daemon\n>    should print /etc/motd when a user logs in interactively.  I didn't\n>    think fetch-pack logged in interactively, so why should this matter?\n> \n\nYou're right, fetch-pack doesn't log in interactively so the actual motd\nis not displayed. I made some research and it turned out that what I\ndescribed in the commit message as the \"motd\" was in fact the Banner.\nQuoting man sshd_config(5):\n\n  Banner  The contents of the specified file are sent to the remote\n          user before authentication is allowed.  If the argument is\n          “none” then no banner is displayed.  This option is only\n          available for protocol version 2.  By default, no banner\n          is displayed.\n\nFrom what I've read it seems that the Banner is generally used to\ndisplay some legal information, such as \"this system can be used by\nauthorised personnel only, others will be prosecuted\".\n\nI'd say that suppressing such information along with diagnostic\nmessages might be expected after adding the \"-q\" flag to fetch-pack\nand other similar commands. Fatal errors will be printed anyway. The\nquestion is whether \"--quiet\" should suppress warnings as well. From my\npoint of view it is reasonable or at least acceptable. An alternative\nsolution might be to add another level of verbosity, namely \"--silent\".\n\nThanks,\n-- \nJan Stępień <jan@stepien.cc>\n"}]}