Re: git-daemon serving repos with repo.git/git-daemon-export-ok

Previous thread: clone --bare vs push by Levend Sayar on Monday, January 3, 2011 - 11:24 am. (5 messages)

Next thread: by Pán Peter Wong Shun Tung on Monday, January 3, 2011 - 3:14 pm. (1 message)
From: John Griessen
Date: Monday, January 3, 2011 - 2:49 pm

I would like to serving repos with repo.git/git-daemon-export-ok from a debian linux server installation,
but I am getting symptoms of clone failing.

john@toolbench:~/EEProjects/test$ git clone git://ecosensory.com/tek_7k_ext.git
Cloning into tek_7k_ext...
fatal: protocol error: bad line length character: fata

I've read that that is due to the shell at the client end putting out extra characters...
but other testers on other machines get it the same way...


Next I tried changing my command that runs git-daemon
from

exec 2>&1
echo 'git-daemon starting.'
exec chpst -ugitdaemon \
   "$(git --exec-path)"/git-daemon --verbose --base-path=/var/cache /var/cache/git

to

exec 2>&1
echo 'git-daemon starting.'
exec chpst -ugitdaemon \
   "$(git --exec-path)"/git-daemon --verbose --base-path=/srv/gitosis /srv/gitosis/repositories

and results are:

john@toolbench:~/EEProjects/test$  git clone git://ecosensory.com/tek_7k_ext.git
Cloning into tek_7k_ext...
fatal: protocol error: bad line length character: fata
john@toolbench:~/EEProjects/test$  git clone git://ecosensory.com/repositories/tek_7k_ext.git
Cloning into tek_7k_ext...
fatal: protocol error: bad line length character: fata


What can I do to simplify this testing and pin point the problem?

Or is gitweb recommended?

thanks,

John Griessen
--

From: John Griessen
Date: Monday, January 3, 2011 - 3:47 pm

on a  virtual server (openVZ) --  I've read there is something bad about virtual servers and git-daemon?

John G
--

From: Jonathan Nieder
Date: Monday, January 3, 2011 - 4:11 pm

Hi John,


Worrisome.  Based on /usr/share/doc/git-daemon-run/README.Debian,
I would be interested in:

	git --version
	dpkg -l git-daemon-run
	sv stat git-daemon
	cat /var/log/git-daemon/current

It looks like the daemon is sending a malformed reply starting with
"fatal: ", similar to the bug fixed by v1.7.0.3~7 (daemon:
parse_host_and_port SIGSEGV if port is specified, 2010-03-20).

It the error message does not provide any insight, I'd also suggest
using strace or ltrace to attach to the running git-daemon process to
see what's going on.

Thanks for reporting,
Jonathan
--

From: John Griessen
Date: Monday, January 3, 2011 - 4:38 pm

server:
vking@mail:/etc/sv$ git --version
git version 1.7.2.3

client:
john@toolbench:~/EEProjects/tek_7k_ext$ git version 1.7.2.3

dpkg -l git-daemon-run
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name                           Version                        Description
+++-==============================-==============================-============================================================================
vking@mail:/etc/sv$ sv stat git-daemon
fail: git-daemon: unable to change to service directory: file does not exist

I uninstalled it  so I could run a command line like:

sudo /usr/lib/git-core/git-daemon --verbose --strict-paths --user=git --group=gitosis /srv/gitosis/repositories
or
sudo strace -o strace.out /usr/lib/git-core/git-daemon --verbose --strict-paths --user=git --group=gitosis /srv/gitosis/repositories

I can push to these repos with gitosis, and the permissions are:

vking@mail:/srv/gitosis/repositories$ ll
total 16
drwxr-xr-x 7 gitosis gitosis 4096 Dec 30 12:32 extrudator.data.git
drwxr-xr-x 7 gitosis gitosis 4096 Nov  7 15:23 extrudator.git
drwxr-xr-x 8 gitosis gitosis 4096 Jan  3 14:42 gitosis-admin.git
drwxr-xr-x 7 gitosis gitosis 4096 Jan  2 23:46 tek_7k_ext.git

/etc/group on server
git:x:111:
gitosis:x:115:git

/etc/passwd on server
git:x:106:111:git version control,,,:/home/git:/bin/shh
gitlog:x:108:65534::/nonexistent:/bin/false

john@toolbench:~/EEProjects/tek_7k_ext$ cat /var/log/git-daemon/current
cat: /var/log/git-daemon/current: No such file or directory


Thanks for looking at this.

John Griessen

===================================strace output================
vking@mail:/etc/sv$ cat strace.out
execve("/usr/lib/git-core/git-daemon", ["/usr/lib/git-core/git-daemon", "--verbose", "--strict-paths", "--user=git", 
"--group=gitosis", "/srv/gitosis/repositories"], [/* ...
From: Jonathan Nieder
Date: Monday, January 3, 2011 - 4:55 pm

So the gitdaemon user (used by git-daemon-run) wouldn't be able to

In this case simple --verbose output would probably be more useful.
(That's what cat-ing /var/log/git-daemon/current would have given
if git-daemon-run were still installed.)

Thanks for the strace.  I should have mentioned that strace -f can
help by following child processes, though that doesn't seem to be
an issue here.  It looks like another git-daemon process is running at
the same time?  (One can check with "netstat -t -a".)
--

From: John Griessen
Date: Monday, January 3, 2011 - 6:58 pm

It would be able, since I used
sudo strace -o strace.out /usr/lib/git-core/git-daemon --verbose --strict-paths --user=git --group=gitosis /srv/gitosis/repositories

git-daemon was asked to run as --user=git --group=gitosis, so it had read permissions and

I tried this

sudo /usr/lib/git-core/git-daemon --verbose --strict-paths --user=git --group=gitosis /srv/gitosis/repositories  &>git-daemon-err.log

vking@mail:~$ cat git-daemon-err.log

and git-daemon-err.log was empty.  Not the same as the /etc/sv/run script.  Should I reinstall

Nope, not as far as I can see.  What suggests that?

vking@mail:/etc/sv$ netstat -t -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:discard               *:*                     LISTEN
tcp        0      0 *:git                   *:*                     LISTEN
tcp        0      0 localhost:mysql         *:*                     LISTEN
tcp        0      0 *:daytime               *:*                     LISTEN
tcp        0      0 localhost:sunrpc        *:*                     LISTEN
tcp        0      0 *:www                   *:*                     LISTEN
tcp        0      0 localhost:690           *:*                     LISTEN
tcp        0      0 cottagematic.com:domain *:*                     LISTEN
tcp        0      0 mail.cibolo.us:domain   *:*                     LISTEN
tcp        0      0 localhost:domain        *:*                     LISTEN
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 *:telnet                *:*                     LISTEN
tcp        0      0 localhost:postgresql    *:*                     LISTEN
tcp        0      0 *:smtp                  *:*                     LISTEN
tcp        0      0 *:time                  *:*                     LISTEN
tcp        0      0 *:ldap                  *:*                     LISTEN
tcp        0      0 mail.cibolo.us:ssh      ...
From: Jonathan Nieder
Date: Monday, January 3, 2011 - 7:11 pm

bind(3, {sa_family=AF_INET, sin_port=htons(9418), sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)
--

From: Jonathan Nieder
Date: Monday, January 3, 2011 - 8:09 pm

Also because the repositories are world readable.  I don't know what
I was thinking; I should get some sleep.

Thanks again for reporting and good luck.

Jonathan
--

Previous thread: clone --bare vs push by Levend Sayar on Monday, January 3, 2011 - 11:24 am. (5 messages)

Next thread: by Pán Peter Wong Shun Tung on Monday, January 3, 2011 - 3:14 pm. (1 message)