> From: Thomas Rast <trast@xxxxxxxxxxx> > 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@xxxxxxxxxxxx (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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html