git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Michal Vrana <mivra1@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Submodule init uses STDERR output
Date: Sat, 23 May 2020 23:23:24 +0000
Message-ID: <20200523232324.GB1915090@camp.crustytoothpaste.net> (raw)
In-Reply-To: <CA+sZKRqMaSZqj3PdpRz3xrruTbz1CJV=W9s_ox4BrhCAuQqhKA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1815 bytes --]

On 2020-05-23 at 22:44:59, Michal Vrana wrote:
> Hello,
> I've come across an issue that seems like a bug to me. If I clone a
> repository with a submodule but want to initialize it separately, then
> the error output is used during this initialization for what seems to
> be a standard message.
> Motivation:
> Cannot use - Fail on standard error setting in a devops pipeline

In general, this is not a good setting to use with Git.  Git uses
standard error for many progress outputs if standard output is
potentially scriptable.  You're better off checking exit codes to
determine success or failure.

Git is also not the only tool to do this; other tools such as Docker do
as well.

> Steps to reproduce:
> 1. git clone
> 2. git submodule init 2>err.txt
> 
> The err.txt contains a message like
> Submodule 'xyz' (xyz.git) registered for path 'abc'
> From what I've read this is the standard output in this case. And if
> not then why when I use "quiet" mode then the error output is empty.
> So why is the error output even used?

c66410ed32a gives us the answer:

  Reroute the output of stdout to stderr as it is just informative
  messages, not to be consumed by machines.

  This should not regress any scripts that try to parse the
  current output, as the output is already internationalized
  and therefore unstable.

  We want to init submodules from the helper for `submodule update`
  in a later patch and the stdout output of said helper is consumed
  by the parts of `submodule update` which are still written in shell.
  So we have to be careful which messages are on stdout.

I haven't looked to see if we could change it back, but that's the
reason it was written that way.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23 22:44 Michal Vrana
2020-05-23 23:23 ` brian m. carlson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200523232324.GB1915090@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=mivra1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror http://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git