Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Update: problem solved = bug in Git

by tomgracey (Beadle)
on Jul 12, 2013 at 09:18 UTC ( #1043917=note: print w/replies, xml ) Need Help??

in reply to Re^4: is there a way to (temporarily) switch off mod_perl caching/variable storing? (contrast compare)
in thread is there a way to (temporarily) switch off mod_perl caching/variable storing?

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043917]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2017-02-22 09:26 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (325 votes). Check out past polls.