* [PATCH] fetch-pack: make the ssh connection quiet
@ 2010-10-27 14:27 Jan Stępień
2010-10-27 15:24 ` Drew Northup
2010-10-27 22:35 ` Junio C Hamano
0 siblings, 2 replies; 5+ messages in thread
From: Jan Stępień @ 2010-10-27 14:27 UTC (permalink / raw)
To: git; +Cc: Jan Stępień
The --quiet option passed to fetch-pack did not affect the ssh child
process. When an ssh server sent a motd it was displayed because the ssh
client wasn't launched with the -q option. This patch makes ssh run quietly
when fetch-pack is called with -q.
An analogous change should be made to other commands which accept --quiet
and connect to remotes using ssh.
Signed-off-by: Jan Stępień <jstepien@users.sourceforge.net>
---
builtin/fetch-pack.c | 3 ++-
cache.h | 1 +
connect.c | 2 ++
3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index dbd8b7b..ede1c34 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -876,7 +876,8 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
fd[1] = 1;
} else {
conn = git_connect(fd, (char *)dest, args.uploadpack,
- args.verbose ? CONNECT_VERBOSE : 0);
+ (args.verbose ? CONNECT_VERBOSE : 0) |
+ (args.quiet ? CONNECT_QUIET : 0));
}
get_remote_heads(fd[0], &ref, 0, NULL, 0, NULL);
diff --git a/cache.h b/cache.h
index 33decd9..8622a78 100644
--- a/cache.h
+++ b/cache.h
@@ -938,6 +938,7 @@ struct ref {
extern struct ref *find_ref_by_name(const struct ref *list, const char *name);
#define CONNECT_VERBOSE (1u << 0)
+#define CONNECT_QUIET (1u << 1)
extern char *git_getpass(const char *prompt);
extern struct child_process *git_connect(int fd[2], const char *url, const char *prog, int flags);
extern int finish_connect(struct child_process *conn);
diff --git a/connect.c b/connect.c
index 57dc20c..709601e 100644
--- a/connect.c
+++ b/connect.c
@@ -585,6 +585,8 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
*arg++ = putty ? "-P" : "-p";
*arg++ = port;
}
+ if (!putty && flags & CONNECT_QUIET)
+ *arg++ = "-q";
*arg++ = host;
}
else {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] fetch-pack: make the ssh connection quiet
2010-10-27 14:27 [PATCH] fetch-pack: make the ssh connection quiet Jan Stępień
@ 2010-10-27 15:24 ` Drew Northup
2010-10-27 18:40 ` Jan Stępień
2010-10-27 22:35 ` Junio C Hamano
1 sibling, 1 reply; 5+ messages in thread
From: Drew Northup @ 2010-10-27 15:24 UTC (permalink / raw)
To: Jan Stępień; +Cc: git
On Wed, 2010-10-27 at 16:27 +0200, Jan Stępień wrote:
> The --quiet option passed to fetch-pack did not affect the ssh child
> process. When an ssh server sent a motd it was displayed because the ssh
> client wasn't launched with the -q option. This patch makes ssh run quietly
> when fetch-pack is called with -q.
>
> An analogous change should be made to other commands which accept --quiet
> and connect to remotes using ssh.
I'm not so sure that's a good idea. Quoting from the (Open)SSH man page:
-q Quiet mode. Causes all warning and diagnostic messages to be suppressed.
Somehow I doubt that's what you intended or a good idea.
--
-Drew Northup N1XIM
AKA RvnPhnx on OPN
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fetch-pack: make the ssh connection quiet
2010-10-27 15:24 ` Drew Northup
@ 2010-10-27 18:40 ` Jan Stępień
0 siblings, 0 replies; 5+ messages in thread
From: Jan Stępień @ 2010-10-27 18:40 UTC (permalink / raw)
To: Drew Northup; +Cc: git
On Wed, 27 Oct 2010 11:24:29 -0400
Drew Northup <drew.northup@maine.edu> wrote:
> On Wed, 2010-10-27 at 16:27 +0200, Jan Stępień wrote:
> > The --quiet option passed to fetch-pack did not affect the ssh child
> > process. When an ssh server sent a motd it was displayed because the ssh
> > client wasn't launched with the -q option. This patch makes ssh run quietly
> > when fetch-pack is called with -q.
> >
> > An analogous change should be made to other commands which accept --quiet
> > and connect to remotes using ssh.
>
> I'm not so sure that's a good idea. Quoting from the (Open)SSH man page:
>
> -q Quiet mode. Causes all warning and diagnostic messages to be suppressed.
>
> Somehow I doubt that's what you intended or a good idea.
That's right, but according to the same source all fatal error messages
still get displayed. It's a question of how quiet should fetch-pack be
when --quiet is enabled.
Thanks for the comment,
--
Jan Stępień <jan@stepien.cc>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fetch-pack: make the ssh connection quiet
2010-10-27 14:27 [PATCH] fetch-pack: make the ssh connection quiet Jan Stępień
2010-10-27 15:24 ` Drew Northup
@ 2010-10-27 22:35 ` Junio C Hamano
2010-10-28 9:14 ` Jan Stępień
1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2010-10-27 22:35 UTC (permalink / raw)
To: Jan Stępień; +Cc: git
Jan Stępień <jstepien@users.sourceforge.net> writes:
> The --quiet option passed to fetch-pack did not affect the ssh child
> process. When an ssh server sent a motd it was displayed because the ssh
> client wasn't launched with the -q option.
This is curious for a couple of reasons:
1. "-q" option to "ssh" is not meant to supress "motd"; it is about
warning and diagnostics. From man ssh(1):
-q Quiet mode. Causes most warning and diagnostic messages to be
suppressed. Only fatal errors are displayed. If a second -q is
given then even fatal errors are suppressed, except for those
produced due solely to bad argu‐ ments.
2. "PrintMotd" defaults to "yes" but it is to specify whether the daemon
should print /etc/motd when a user logs in interactively. I didn't
think fetch-pack logged in interactively, so why should this matter?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fetch-pack: make the ssh connection quiet
2010-10-27 22:35 ` Junio C Hamano
@ 2010-10-28 9:14 ` Jan Stępień
0 siblings, 0 replies; 5+ messages in thread
From: Jan Stępień @ 2010-10-28 9:14 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, 27 Oct 2010 15:35:41 -0700
Junio C Hamano <gitster@pobox.com> wrote:
> Jan Stępień <jstepien@users.sourceforge.net> writes:
> > The --quiet option passed to fetch-pack did not affect the ssh child
> > process. When an ssh server sent a motd it was displayed because the ssh
> > client wasn't launched with the -q option.
>
> This is curious for a couple of reasons:
>
> 1. "-q" option to "ssh" is not meant to supress "motd"; it is about
> warning and diagnostics. From man ssh(1):
>
> -q Quiet mode. Causes most warning and diagnostic messages to be
> suppressed. Only fatal errors are displayed. If a second -q is
> given then even fatal errors are suppressed, except for those
> produced due solely to bad argu‐ ments.
>
> 2. "PrintMotd" defaults to "yes" but it is to specify whether the daemon
> should print /etc/motd when a user logs in interactively. I didn't
> think fetch-pack logged in interactively, so why should this matter?
>
You're right, fetch-pack doesn't log in interactively so the actual motd
is not displayed. I made some research and it turned out that what I
described in the commit message as the "motd" was in fact the Banner.
Quoting man sshd_config(5):
Banner The contents of the specified file are sent to the remote
user before authentication is allowed. If the argument is
“none” then no banner is displayed. This option is only
available for protocol version 2. By default, no banner
is displayed.
From what I've read it seems that the Banner is generally used to
display some legal information, such as "this system can be used by
authorised personnel only, others will be prosecuted".
I'd say that suppressing such information along with diagnostic
messages might be expected after adding the "-q" flag to fetch-pack
and other similar commands. Fatal errors will be printed anyway. The
question is whether "--quiet" should suppress warnings as well. From my
point of view it is reasonable or at least acceptable. An alternative
solution might be to add another level of verbosity, namely "--silent".
Thanks,
--
Jan Stępień <jan@stepien.cc>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-10-28 9:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-27 14:27 [PATCH] fetch-pack: make the ssh connection quiet Jan Stępień
2010-10-27 15:24 ` Drew Northup
2010-10-27 18:40 ` Jan Stępień
2010-10-27 22:35 ` Junio C Hamano
2010-10-28 9:14 ` Jan Stępień
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).