git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Dale Worley <worley@c-66-31-108-177.hsd1.ma.comcast.net>
To: git@vger.kernel.org
Cc: Thomas Rast <trast@inf.ethz.ch>
Subject: Re: Bug:  Failure if stdin is closed.
Date: Thu, 11 Jul 2013 13:21:44 -0400	[thread overview]
Message-ID: <201307111721.r6BHLiXD013670@freeze.ariadne.com> (raw)
In-Reply-To: <87r4f52jjf.fsf@linux-k42r.v.cablecom.net> (trast@inf.ethz.ch)

> From: Thomas Rast <trast@inf.ethz.ch>

> May I ask why you need this, and to what extent this problem cannot be
> solved by instead redirecting from/to /dev/null?

The situation in which the problem arose is described here:

> worley@alum.mit.edu (Dale R. Worley) writes:
> 
> > (The original problem and the discussion that ensued is on the
> > git-users mailing list:
> > https://groups.google.com/forum/#!topic/git-users/lNQ7Cn35EqA)

It involves invoking git from Apache.  I haven't read up on the
details because I didn't need to in order to debug the problem.

> Closing 2 usually has even funkier consequences if the program proceeds
> to open some other file, it ends up as fd 2, and it then dies with an
> error.  In that sense it might be saner to simply die whenever open()
> gives an FD in the 0..2 range (and we weren't explicitly trying to
> reopen one of them).

True...  But fd 2 may be needed under many unpredictable
circumstances.  In regard to fd 0, we can predict that standard input
(per se) will not be needed, so it's anti-robust to require that it be
open for the code to function at all.

> However, does it fully fix the issue you describe?  What if you then run
> 'git checkout -F -' to read the message from stdin?

Obviously, if the git command explicitly requires use of
standard-input, then standard-input needs to be open.

> > However, when looking at the code, I noticed that few of the functions
> > have comments describing what they do, and none describe their input
> > and output values.  In particular, there are no comments specifying
> > what the error return values are.  This is appalling for a supposedly
> > professional-quality project!
> 
> You are touching on a sore point of the git code base.  Some
> contributors have made a point of adding comments where appropriate, so
> we're improving, but round tuits are in short supply as always.  If you
> can supply such tuits, they would be appreciated.

I will try to put my money where my mouth is.

Dale

      reply	other threads:[~2013-07-11 17:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11 15:11 Bug: Failure if stdin is closed Dale R. Worley
2013-07-11 15:39 ` Thomas Rast
2013-07-11 17:21   ` Dale Worley [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=201307111721.r6BHLiXD013670@freeze.ariadne.com \
    --to=worley@c-66-31-108-177.hsd1.ma.comcast.net \
    --cc=git@vger.kernel.org \
    --cc=trast@inf.ethz.ch \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).