Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Very big hat off to the real wizard on google groups "git for human beings" who solved this conundrum (I wont say who as I haven't asked for permission - but you can find the thread under the title 'frustrations trying to control git through apache'). Here is an extract of his diagnosis:

So we see that:

1) The Git code is poorly documented, and there is no coding control to ensure that the code is internally documented.

2) The test "if (fd > 0) return fd;" is incorrect. It should be "(fd >= 0)".

3) The error is triggered if fd 0 (standard-input) is closed when Git starts and Git needs to put a file into the object store. In your situation, that is determined by the particular Git operation and the details of how Git is invoked by Apache.

From this, we can construct a simple test case that demonstrates the bug:

$ git --version git version $ git status # On branch master nothing to commit (working directory clean) $ echo This is a test >ffff $ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # ffff nothing added to commit but untracked files present (use "git add" to +track) $ git add ffff $ # The notation "0<&-" means "close standard input (fd 0) in the proc +ess that $ # executes this command. It may be specific to bash. $ git commit -m xxxx 0<&- error: unable to create temporary sha1 filename : No such file or dire +ctory error: Error building trees $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: ffff # $ git commit -m xxxx [master 54c146c] xxxx 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 ffff $ git status # On branch master # Your branch is ahead of 'origin/master' by 1 commit. # nothing to commit (working directory clean) $

So there you have it. Nothing to do with environment variables, and mod_perl was a red herring

The fix?

Add </dev/null to any (bash) line being executed that involves a write (or otherwise ensure standard input is not closed when git tries to open the file). Unfortunately this appears to mean *any* git module (Git::Wrapper, Git::Repository... ) is unusable for me (and I would be surprised if not for other people aswell?), and I must use home grown code...

Btw the bug has been reported

And now it works! I am so happy =D

In reply to Update: problem solved = bug in Git by tomgracey
in thread is there a way to (temporarily) switch off mod_perl caching/variable storing? by tomgracey

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (12)
    As of 2018-06-21 13:16 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (118 votes). Check out past polls.