git-daemon: needs /root/.config/git/config?
Hi again,
Due to the earlier problem I upgraded git on all machines and eneded up with a ubunut machine running in to problems.
I started getting errors like:
"fatal: protocol error: bad line length character: fata"
Which after some head scratching caused me to tell xinetd to directly launch git-daemon, eventually it worked fine, but i did get this error message:
Jun 4 16:12:05 xyz git-daemon[10246]: unable to access
'/root/.config/git/config': Permission denied
It's not the first time i've seen it but i've been able to ignore it before. This is running as a local user (as in not root) and this user shouldn't have access to /root. But i eventually had to do chown o+x /root to workaround this error.
Now, this must be wrong somehow? Or does --user work in inetd mode now?
So... comments, ideas?
Quoted 9 lines · Ian Kumlien
Due to the earlier problem I upgraded git on all machines and eneded up with a ubunut machine running in to problems.
I started getting errors like:
"fatal: protocol error: bad line length character: fata"Which after some head scratching caused me to tell xinetd to directly launch git-daemon, eventually it worked fine, but i did get this error message:
Looks like your stderr was being redirected to your stdout; this particular error aside, that is likely to cause weird protocol problems for any error that git outputs.
Quoted 7 lines
Jun 4 16:12:05 xyz git-daemon[10246]: unable to access'
/root/.config/git/config': Permission deniedIt's not the first time i've seen it but i've been able to ignore it before. This is running as a local user (as in not root) and this user shouldn't have access to /root. But i eventually had to do chown o+x /root to workaround this error.
The problem is that you have presumably dropped privileges in the daemon instance, but your $HOME environment variable still points to /root. Git cannot read all of its config files (nor even find out if they exist), so it bails rather than continue.
Older versions of git silently ignored errors reading config files, but it was tightened in v1.8.1.1, as there can be quite serious implications to failing to read expected config (e.g., imagine transfer.fsckobjects, or receive.deny* is ignored).
However, since changing user id and leaving $HOME is so common, there is a patch under consideration to loosen the check only for the case of EACCES on files in $HOME. That commit is 4698c8f (config: allow inaccessible configuration under $HOME, 2013-04-12); it's not yet in any released version of git, though.
In the meantime, the suggested workaround is to set $HOME for the git-daemon user, rather than loosening /root.
-Peff
Quoted 8 lines · Jeff King
Quoted 6 lines · Ian Kumlien
Due to the earlier problem I upgraded git on all machines and eneded up with a ubunut machine running in to problems.
I started getting errors like:
"fatal: protocol error: bad line length character: fata"
Quoted 7 lines
Quoted 3 lines
Which after some head scratching caused me to tell xinetd to directly launch git-daemon, eventually it worked fine, but i did get this error message:
Looks like your stderr was being redirected to your stdout; this particular error aside, that is likely to cause weird protocol problems for any error that git outputs.
Yeah =)
Quoted 8 lines
Quoted 7 lines
Jun 4 16:12:05 xyz git-daemon[10246]: unable to access'
/root/.config/git/config': Permission deniedIt's not the first time i've seen it but i've been able to ignore it before. This is running as a local user (as in not root) and this user shouldn't have access to /root. But i eventually had to do chown o+x /root to workaround this error.
Quoted 4 lines
The problem is that you have presumably dropped privileges in the daemon instance, but your $HOME environment variable still points to /root. Git cannot read all of its config files (nor even find out if they exist), so it bails rather than continue.
Yeah, assumed =P
Quoted 4 lines
Older versions of git silently ignored errors reading config files, but it was tightened in v1.8.1.1, as there can be quite serious implications to failing to read expected config (e.g., imagine transfer.fsckobjects, or receive.deny* is ignored).
Yes, i agree, it's suboptimal but I for one would use getpwuid to get the home directory of the executing user to avoid this - though i don't know how portable it is (or if there is any other issues)
It's a bit hard to control this with xinetd doing it behind the scenes...
Quoted 5 lines
However, since changing user id and leaving $HOME is so common, there is a patch under consideration to loosen the check only for the case of EACCES on files in $HOME. That commit is 4698c8f (config: allow inaccessible configuration under $HOME, 2013-04-12); it's not yet in any released version of git, though.
Ah, ok, thanks, I'll have a look - maybe i can actually contribute something for once =)
Quoted 2 lines
In the meantime, the suggested workaround is to set $HOME for the git-daemon user, rather than loosening /root.
Well, I have no idea of how to control HOME in xinetd - access to the machine is limited and x doesn't give that much access (nothing really important is actually stored in /root)
For now, this is the workaround we have =P
Quoted 1 line
-Peff
On Wed, 05 Jun 2013 13:19:18 +0000, Ian Kumlien wrote:
...
Quoted 3 lines
Well, I have no idea of how to control HOME in xinetd - access to the machine is limited and x doesn't give that much access (nothing really important is actually stored in /root)
Make xinetd execute '/usr/bin/env HOME=/home/yourstruly git ...' instead of 'git ...'.
Andreas
Signature · 3 lines
"Totally trivial. Famous last words." From: Linus Torvalds <torvalds@*.org> Date: Fri, 22 Jan 2010 07:29:21 -0800
Quoted 8 lines · Ian Kumlien
Quoted 4 lines
Older versions of git silently ignored errors reading config files, but it was tightened in v1.8.1.1, as there can be quite serious implications to failing to read expected config (e.g., imagine transfer.fsckobjects, or receive.deny* is ignored).
Yes, i agree, it's suboptimal but I for one would use getpwuid to get the home directory of the executing user to avoid this - though i don't know how portable it is (or if there is any other issues)
We considered having git-daemon's "--user" option do that, but:
1. It would be a regression for people who are intentionally setting HOME to get different config profiles. And it would be a surprise to admins, as other user-switching daemons (e.g., inetd) do not tweak HOME.
2. It would not have covered all cases, including yours. xinetd is the one doing the user-switching here.
-Peff
Quoted 3 lines · Ian Kumlien
Yes, i agree, it's suboptimal but I for one would use getpwuid to get the home directory of the executing user to avoid this - though i don't know how portable it is (or if there is any other issues)
It's not only suboptimal but simply wrong. getpwuid gives at best the initial home directory, and even there it is only a guess. (If you are looking for some home directory of a different user it might be a good guess). But using getpwuid(getuid())->pw_dir if HOME is set is a serious mistake, as you throw out the good value for some almost but not quite totally unrelated value.
Bernhard R. Link
Quoted 11 lines · Bernhard R. Link
Quoted 3 lines · Ian Kumlien
Yes, i agree, it's suboptimal but I for one would use getpwuid to get the home directory of the executing user to avoid this - though i don't know how portable it is (or if there is any other issues)
It's not only suboptimal but simply wrong. getpwuid gives at best the initial home directory, and even there it is only a guess. (If you are looking for some home directory of a different user it might be a good guess). But using getpwuid(getuid())->pw_dir if HOME is set is a serious mistake, as you throw out the good value for some almost but not quite totally unrelated value.
Well i never intended for it to replace the environment variable, it was more intended as a fallback - if there will be a "less strict" mode then perhaps a fallback would be a more controled way of doing it.
Quoted 1 line
Bernhard R. Link
Am 04.06.2013 18:08, schrieb Jeff King:
Quoted 5 lines
Older versions of git silently ignored errors reading config files, but it was tightened in v1.8.1.1, as there can be quite serious implications to failing to read expected config (e.g., imagine transfer.fsckobjects, or receive.deny* is ignored).
Quoted 8 lines
However, since changing user id and leaving $HOME is so common, there is a patch under consideration to loosen the check only for the case of EACCES on files in $HOME. That commit is 4698c8f (config: allow inaccessible configuration under $HOME, 2013-04-12); it's not yet in any released version of git, though.
In the meantime, the suggested workaround is to set $HOME for the git-daemon user, rather than loosening /root.
I've a PHP script in ~/public_html that runs git. Without the mentioned patch, the script bails out due to this error. This time it's Apache that gets me into trouble because at the time the PHP script and git run, $HOME is still /root, but the user identity is not root anymore. The patch is direly needed; without it, I need to use 'env HOME=/home/j6t /usr/local/bin/git' in my script.
-- Hannes
Quoted 7 lines · Johannes Sixt
Am 04.06.2013 18:08, schrieb Jeff King:
Quoted 5 lines
However, since changing user id and leaving $HOME is so common, there is a patch under consideration to loosen the check only for the case of EACCES on files in $HOME. That commit is 4698c8f (config: allow inaccessible configuration under $HOME, 2013-04-12); it's not yet in any released version of git, though.
[...]
Quoted 6 lines
I've a PHP script in ~/public_html that runs git. Without the mentioned patch, the script bails out due to this error. This time it's Apache that gets me into trouble because at the time the PHP script and git run, $HOME is still /root, but the user identity is not root anymore. The patch is direly needed; without it, I need to use 'env HOME=/home/j6t
/usr/local/bin/git' in my script.
I could be remembering wrong, but I thought it was not so much "under consideration" as "accepted for 1.8.4". I haven't heard any compelling reasons not to apply it.
Would it would make sense against earlier releases as well?
Thanks,
Jonathan
Quoted 13 lines · Jonathan Nieder
Quoted 5 lines
Quoted 5 lines
However, since changing user id and leaving $HOME is so common, there is a patch under consideration to loosen the check only for the case of EACCES on files in $HOME. That commit is 4698c8f (config: allow inaccessible configuration under $HOME, 2013-04-12); it's not yet in any released version of git, though.
[...]
Quoted 6 lines
I've a PHP script in ~/public_html that runs git. Without the mentioned patch, the script bails out due to this error. This time it's Apache that gets me into trouble because at the time the PHP script and git run, $HOME is still /root, but the user identity is not root anymore. The patch is direly needed; without it, I need to use 'env HOME=/home/j6t
/usr/local/bin/git' in my script.
Quoted 5 lines
I could be remembering wrong, but I thought it was not so much "under consideration" as "accepted for 1.8.4". I haven't heard any compelling reasons not to apply it.
Would it would make sense against earlier releases as well?
Yeah, I think it would. I only said "under consideration" because I saw that it was in "next" and not elsewhere, and did not hunt down the exact status in "What's Cooking".
-Peff
Quoted 19 lines · Jeff King
Quoted 17 lines · Jonathan Nieder
Quoted 5 lines
Quoted 5 lines
However, since changing user id and leaving $HOME is so common, there is a patch under consideration to loosen the check only for the case of EACCES on files in $HOME. That commit is 4698c8f (config: allow inaccessible configuration under $HOME, 2013-04-12); it's not yet in any released version of git, though.
[...]
Quoted 6 lines
I've a PHP script in ~/public_html that runs git. Without the mentioned patch, the script bails out due to this error. This time it's Apache that gets me into trouble because at the time the PHP script and git run, $HOME is still /root, but the user identity is not root anymore. The patch is direly needed; without it, I need to use 'env HOME=/home/j6t
/usr/local/bin/git' in my script.I could be remembering wrong, but I thought it was not so much "under consideration" as "accepted for 1.8.4". I haven't heard any compelling reasons not to apply it.
Quoted 5 lines
Quoted 1 line
Would it would make sense against earlier releases as well?
Yeah, I think it would. I only said "under consideration" because I saw that it was in "next" and not elsewhere, and did not hunt down the exact status in "What's Cooking".
Sorry about that; it is in 'master' but "What's cooking" for that pushout hasn't been published yet (the description of what I did yesterday will be rolled into today's issue together with the description of what I did today at the end of day).
Quoted 5 lines · Jonathan Nieder
I could be remembering wrong, but I thought it was not so much "under consideration" as "accepted for 1.8.4". I haven't heard any compelling reasons not to apply it.
Would it would make sense against earlier releases as well?
True; the patch is queued on a topic that forks from maint-1.8.2 exactly for this reason.