{"thread":{"id":"6462","subject":"git-push through git protocol","startedAt":"2007-01-21T14:10:46Z","lastAt":"2007-01-22T14:41:11Z","messageCount":22,"participants":["Bill Lear","Jakub Narebski","Linus Torvalds","Johannes Schindelin","Martin Langhoff","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"32207","messageId":"17843.29798.866272.414435@lisa.zopyra.com","threadId":"6462","inReplyTo":null,"subject":"git-push through git protocol","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-21T14:10:46Z","receivedAt":"2007-01-21T14:10:46Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"We have a secure network in which we run all of our git-supported\ndevelopment activities.  We would like to be able to do git-push\nthrough the git protocol.  Reasons: 1) it seems more efficient; 2) we\nhave run into problems with developers having different umasks ---\nwhen run through ssh, we ran into file permissions problems and\ninstead of tracking down each umask issue the developer has (and,\nfrankly, not wanting to change their default), we resorted to fixing\nup the permissions inside of the update hook (chmod -R ug+w, I think);\n3) we would prefer a single protocol instead of sometimes pulling with\ngit and pushing with ssh.\n\nIt seems there should be a way to configure a repo or the git daemon\nto say \"Allow push operations\".\n\nI looked through the release notes Junio posted for 1.5.0-rc2, but\nfound no reference to the git daemon.\n\n\nBill\n"},{"id":"32212","messageId":"ep00nl$mop$1@sea.gmane.org","threadId":"6462","inReplyTo":"17843.29798.866272.414435@lisa.zopyra.com","subject":"Re: git-push through git protocol","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-21T15:27:28Z","receivedAt":"2007-01-21T15:27:28Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"[Cc: git@vger.kernel.org]\n\nBill Lear wrote:\n\n> We have a secure network in which we run all of our git-supported\n> development activities.  We would like to be able to do git-push\n> through the git protocol.  Reasons: 1) it seems more efficient; 2) we\n> have run into problems with developers having different umasks ---\n> when run through ssh, we ran into file permissions problems and\n> instead of tracking down each umask issue the developer has (and,\n> frankly, not wanting to change their default), we resorted to fixing\n> up the permissions inside of the update hook (chmod -R ug+w, I think);\n> 3) we would prefer a single protocol instead of sometimes pulling with\n> git and pushing with ssh.\n> \n> It seems there should be a way to configure a repo or the git daemon\n> to say \"Allow push operations\".\n> \n> I looked through the release notes Junio posted for 1.5.0-rc2, but\n> found no reference to the git daemon.\n\ngit:// protocol is not authenticated. git by design allow push only through\nauthenticated protocols, i.e. local, ssh:// (git+ssh://), http(s):// with\nWebDAV, probably in the future ftps://. \n\nrsync:// (deprecated) and git:// are fetch only (read-only) protocols.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"32219","messageId":"Pine.LNX.4.64.0701211034490.14248@woody.osdl.org","threadId":"6462","inReplyTo":"ep00nl$mop$1@sea.gmane.org","subject":"Re: git-push through git protocol","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2007-01-21T19:04:13Z","receivedAt":"2007-01-21T19:04:13Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 21 Jan 2007, Jakub Narebski wrote:\n> > \n> > It seems there should be a way to configure a repo or the git daemon\n> > to say \"Allow push operations\".\n> > \n> > I looked through the release notes Junio posted for 1.5.0-rc2, but\n> > found no reference to the git daemon.\n> \n> git:// protocol is not authenticated. git by design allow push only through\n> authenticated protocols, i.e. local, ssh:// (git+ssh://), http(s):// with\n> WebDAV, probably in the future ftps://. \n\nWell, it _should_ actually be truly fairly trivial to allow pushing over \nthe git:// protocol, and while it's not authenticated, I could well \nimagine that it would make sense from within a firewalled setup (where \nnobody but trusted internal people can reach the git port anyway).\n\nSo in that sense, I do think Bill's request makes some amount of sense.\n\nAt the same time, I suspect it's not a great idea, unless you also add \n*some* kind of logging facility to git-daemon.\n\nBut here is a trivial patch that *MAY* do what Bill wants.\n\nNOTE! \"git-receive-pack\" is disabled by default, so you need to enable it \nexplicitly by starting git-daemon with the \"--enable=receive-pack\" command  \nline argument, or by having your config enable it automatically.\n\nAnd a second note: I obviously didn't test it. I'm Linus. I don't do no \nsteenking testing..\n\n\t\tLinus\n\n---\ndiff --git a/daemon.c b/daemon.c\nindex f039534..9590372 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -372,9 +372,16 @@ static int upload_archive(void)\n \treturn -1;\n }\n \n+static int receive_pack(void)\n+{\n+\texecl_git_cmd(\"receive-pack\", \".\", NULL);\n+\treturn -1;\n+}\n+\n static struct daemon_service daemon_service[] = {\n \t{ \"upload-archive\", \"uploadarch\", upload_archive, 0, 1 },\n \t{ \"upload-pack\", \"uploadpack\", upload_pack, 1, 1 },\n+\t{ \"receive-pack\", \"receivepack\", receive_pack, 0, 1 },\n };\n \n static void enable_service(const char *name, int ena) {\n"},{"id":"32222","messageId":"17843.51311.784904.54317@lisa.zopyra.com","threadId":"6462","inReplyTo":"Pine.LNX.4.64.0701211034490.14248@woody.osdl.org","subject":"Re: git-push through git protocol","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-21T20:09:19Z","receivedAt":"2007-01-21T20:09:19Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"Interesting.  This is exactly (if memory serves) the patch that I\ntried myself, but in retrospect, I think I only tried it on the client\nside, for some idiotic reason (I'll plead cold weather here in\nAustin).  I'll see if I can get this installed and tested.\n\nThanks Linus.\n\n\nBill\n\nOn Sunday, January 21, 2007 at 11:04:13 (-0800) Linus Torvalds writes:\n>\n>\n>On Sun, 21 Jan 2007, Jakub Narebski wrote:\n>> > \n>> > It seems there should be a way to configure a repo or the git daemon\n>> > to say \"Allow push operations\".\n>> > \n>> > I looked through the release notes Junio posted for 1.5.0-rc2, but\n>> > found no reference to the git daemon.\n>> \n>> git:// protocol is not authenticated. git by design allow push only through\n>> authenticated protocols, i.e. local, ssh:// (git+ssh://), http(s):// with\n>> WebDAV, probably in the future ftps://. \n>\n>Well, it _should_ actually be truly fairly trivial to allow pushing over \n>the git:// protocol, and while it's not authenticated, I could well \n>imagine that it would make sense from within a firewalled setup (where \n>nobody but trusted internal people can reach the git port anyway).\n>\n>So in that sense, I do think Bill's request makes some amount of sense.\n>\n>At the same time, I suspect it's not a great idea, unless you also add \n>*some* kind of logging facility to git-daemon.\n>\n>But here is a trivial patch that *MAY* do what Bill wants.\n>\n>NOTE! \"git-receive-pack\" is disabled by default, so you need to enable it \n>explicitly by starting git-daemon with the \"--enable=receive-pack\" command  \n>line argument, or by having your config enable it automatically.\n>\n>And a second note: I obviously didn't test it. I'm Linus. I don't do no \n>steenking testing..\n"},{"id":"32225","messageId":"Pine.LNX.4.63.0701212215030.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6462","inReplyTo":"Pine.LNX.4.64.0701211034490.14248@woody.osdl.org","subject":"Re: git-push through git protocol","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-21T21:16:10Z","receivedAt":"2007-01-21T21:16:10Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 21 Jan 2007, Linus Torvalds wrote:\n\n> NOTE! \"git-receive-pack\" is disabled by default, so you need to enable \n> it explicitly by starting git-daemon with the \"--enable=receive-pack\" \n> command line argument, or by having your config enable it automatically.\n\nThis is not a great idea. At least a config variable should be responsible \nfor that.\n\n> And a second note: I obviously didn't test it. I'm Linus. I don't do no \n> steenking testing..\n\nWhy do you mention that? We know...\n\nCiao,\nDscho\n"},{"id":"32226","messageId":"17843.55730.456139.247155@lisa.zopyra.com","threadId":"6462","inReplyTo":"Pine.LNX.4.64.0701211034490.14248@woody.osdl.org","subject":"Re: git-push through git protocol","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-21T21:22:58Z","receivedAt":"2007-01-21T21:22:58Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"I did the steenking testing and it appears to fail.  This is with\n1.4.4.1 (applied the patch by hand to daemon.c, rebuilt and installed\non my local workstation).  I get this (clone worked fine) on my test\nrepo:\n\n% git push git://localhost/fongo\nupdating 'refs/heads/master'\n  from a54b51ffc155737d8ccebd645f0d2036072d669f\n  to   c5599ebdeae970eaa0163374a6c5d8b216fc390a\nfatal: read error (Bad file descriptor)\nGenerating pack...\nDone counting 5 objects.\nResult has 3 objects.\nDeltifying 3 objects.\n 100% (3/3) done\nWriting 3 objects.\n 100% (3/3) done\nfatal: sha1 file '<stdout>' write error (Bad file descriptor)\n\nMy /etc/xinet.d/git-daemon looks like this:\n\nservice git\n{\n        disable         = no\n        type            = UNLISTED\n        port            = 9418\n        socket_type     = stream\n        wait            = no\n        user            = nobody\n        server          = /usr/bin/git-daemon\n        server_args     = --enable=receive-pack --verbose --syslog --inetd --export-all --base-path=/repos/git\n        log_on_failure  += USERID\n}\n\nWill try to dig into this more if I can...\n\n\nBill\n\nOn Sunday, January 21, 2007 at 11:04:13 (-0800) Linus Torvalds writes:\n>\n>\n>On Sun, 21 Jan 2007, Jakub Narebski wrote:\n>> > \n>> > It seems there should be a way to configure a repo or the git daemon\n>> > to say \"Allow push operations\".\n>> > \n>> > I looked through the release notes Junio posted for 1.5.0-rc2, but\n>> > found no reference to the git daemon.\n>> \n>> git:// protocol is not authenticated. git by design allow push only through\n>> authenticated protocols, i.e. local, ssh:// (git+ssh://), http(s):// with\n>> WebDAV, probably in the future ftps://. \n>\n>Well, it _should_ actually be truly fairly trivial to allow pushing over \n>the git:// protocol, ...\n"},{"id":"32230","messageId":"Pine.LNX.4.64.0701211341300.14248@woody.osdl.org","threadId":"6462","inReplyTo":"17843.55730.456139.247155@lisa.zopyra.com","subject":"Re: git-push through git protocol","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2007-01-21T22:00:16Z","receivedAt":"2007-01-21T22:00:16Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 21 Jan 2007, Bill Lear wrote:\n>\n> I did the steenking testing and it appears to fail.\n\nOk, I did the test too. It does _appear_ to fail, where the keyword is \nactually the \"appear\". \n\nI get\n\n\t[torvalds@woody new-repo]$ git push\n\tupdating 'refs/heads/master'\n\t  from b66385f8f77014d9c3985b1ed1654401508392ad\n\t  to   2cd693b97b450378fa300ddf6b093aef236953cd\n\tGenerating pack...\n\tDone counting 4 objects.\n\tResult has 3 objects.\n\tDeltifying 3 objects.\n\t 100% (3/3) done\n\tWriting 3 objects.\n\t 100% (3/3) done\n\tTotal 3 (delta 0), reused 0 (delta 0)\n\tfatal: read error (Bad file descriptor)\n\nOn the pushing side, but it all did actually work fine, and trying to push \nagain gets you a\n\n\t[torvalds@woody new-repo]$ git push\n\tEverything up-to-date\n\nand the repo I pushed to did get the changes and checks out ok.\n\nSo the patch works, but yeah, there's a few issues:\n\n - the native git:// protocol doesn't open a stream for stderr like ssh \n   does, so all the nice status updates go to the _daemon_ stderr, and on \n   the daemon side I see:\n\n\tUnpacking 3 objects\n\t 100% (3/3) done\n\trefs/heads/master: b66385f8f77014d9c3985b1ed1654401508392ad -> 2cd693b97b450378fa300ddf6b093aef236953cd\n\n   which might actually be nice from a debugging and logging standpoint, \n   except it doesn't log enough to really be useful.\n\n - git-send-pack wants expects the status report, and doesn't get one. \n   That, in turn, seems to be because it expects \"out\" and \"in\" to be \n   different file descriptors, and with the git:// protocol they aren't \n   (they're the same file descriptor)\n\nThis attached patch should fix the second problem. Maybe.\n\n\t\tLinus\n---\ndiff --git a/send-pack.c b/send-pack.c\nindex cd478dd..3d3ca07 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -327,6 +327,8 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)\n \t}\n \n \tpacket_flush(out);\n+\tif (out == in)\n+\t\tout = dup(out);\n \tif (new_refs)\n \t\tret = pack_objects(out, remote_refs);\n \tclose(out);\n"},{"id":"32248","messageId":"46a038f90701211549v1e3dbb9dgf4eb810c8756b5d7@mail.gmail.com","threadId":"6462","inReplyTo":"17843.29798.866272.414435@lisa.zopyra.com","subject":"Re: git-push through git protocol","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2007-01-21T23:49:02Z","receivedAt":"2007-01-21T23:49:02Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 1/22/07, Bill Lear <rael@zopyra.com> wrote:\n> 2) we have run into problems\n> with developers having different umasks ---\n\nThis is a non-issue. Just do git-repo-config core.sharedrepository 1\non each repo.\n\n> 3) we would prefer a single protocol instead of sometimes pulling with\n> git and pushing with ssh.\n\nInternally we always use ssh+git. No problem.\n\ncheers\n\n\n\nm\n"},{"id":"32249","messageId":"17843.65339.528621.549961@lisa.zopyra.com","threadId":"6462","inReplyTo":"46a038f90701211549v1e3dbb9dgf4eb810c8756b5d7@mail.gmail.com","subject":"Re: git-push through git protocol","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-22T00:03:07Z","receivedAt":"2007-01-22T00:03:07Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Monday, January 22, 2007 at 12:49:02 (+1300) Martin Langhoff writes:\n>On 1/22/07, Bill Lear <rael@zopyra.com> wrote:\n>> 2) we have run into problems\n>> with developers having different umasks ---\n>\n>This is a non-issue. Just do git-repo-config core.sharedrepository 1\n>on each repo.\n\nDoes this have the same effect as 'git --bare init-db --shared'?\nIf so, I thought that was the way we initialized our company repo,\nthough our config file reads:\n\n[core]\n        repositoryformatversion = 0\n        filemode = true\n\nI also note that our company repo does not have this:\n\n[receive]\n        denyNonFastforwards = true\n\nwhich now makes me nervous.  I would assume this would be a good thing\nto have, no?\n\n\nBill\n"},{"id":"32250","messageId":"Pine.LNX.4.64.0701211554450.14248@woody.osdl.org","threadId":"6462","inReplyTo":"Pine.LNX.4.64.0701211341300.14248@woody.osdl.org","subject":"Re: git-push through git protocol","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2007-01-22T00:17:20Z","receivedAt":"2007-01-22T00:17:20Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 21 Jan 2007, Linus Torvalds wrote:\n> \n>  - git-send-pack wants expects the status report, and doesn't get one. \n>    That, in turn, seems to be because it expects \"out\" and \"in\" to be \n>    different file descriptors, and with the git:// protocol they aren't \n>    (they're the same file descriptor)\n> \n> This attached patch should fix the second problem. Maybe.\n\nThis actually looks like potentially a generic real problem.\n\nIt so *happens* that git_connect() is different from all the other \nconnection types in that it returns the same socket for both input and \noutput. All the others return separate fd's for the input and output \nsides, because they end up using pipes.\n\nThis is not normally a problem, since people just use \"read()\" and \n\"write()\" on the things. Who cares if they are the same fd or not? Nobody.\n\nWell, almost nobody. Anybody who ends up closing the file descriptors will \ninevitably care. In this case it was git-send-pack (through send_pack() \nthat happened to close the two file descriptors, but because they were \nactually the same one, it would end up (a) closing the same thing twice \nand (b) doing some operations on an already-closed fd).\n\nI really think this should be fixed, regardless of whether we want to have \ngit:// usable for pushing or not, because it's really conceptually a bug. \n\nWe could do it either with my stupid patch (which just makes \"send_pack()\" \ndo the dup itself when they happen to be identical, and thus avoids the \nproblem in the caller), but it might actually make sense to just make the \nrule be that \"git_connect()\" always returns separate file descriptors for \nthe input/output cases so that nobody can ever be confused, and so that \nyou can always close those things independently.\n\nIn fact, looking more closely, a lot of the other users of git_connect() \nseem to avoid it by simply leaking file descriptors (ie builtin-archive.c \ncloses only one of the file descriptors). Others (like receive-pack.c) \nclose both, but make sure that they always close them together, and \napparently fetch-pack.c just makes sure to close them together (so the \nsecond close might cause EBADF, but in the absense of any threading or \nsignals, you're ok).\n\nSame goes for peek-remote: it also just closes the same fd twice, and \ndepends on it having no bad side effects (which is true, modulo race \nconditions that we don't have because we're single-threaded).\n\nBut everything considered, I'd almost suggest just solving this by the \ntrivial one-liner to make git_connect() _always_ return two separate file \ndescriptors, so that nobody needs to do strange tests and so that we don't \ncall \"close()\" on the same file descriptor twice.\n\nSo I'd suggest this simple change to \"connect.c\". Yeah, it adds an \n\"unnecessary\" (but cheap) system call to the git:// case, but it allows \nall users to stop worrying about whether the result is a single in-out \nfile descriptor or two separate file descriptors for the in/out cases.\n\nAs shown by the send-pack example, there was actually code out there that \ndepended on the \"two separate file descriptors\" case, which we get for all \nthe normal and secure cases anyway (since they use pipe() to create the \ncommunication channels with a proxy or ssh or whatever).\n\nSo Junio, I'd suggest adding this whether you then want to add the trivial \ncode to allow pushing over git:// too or not. One less special case to \nworry about.\n\n\t\tLinus\n\n---\ndiff --git a/connect.c b/connect.c\nindex 66daa11..7844888 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -529,7 +529,7 @@ static void git_tcp_connect(int fd[2], char *host)\n \tint sockfd = git_tcp_connect_sock(host);\n \n \tfd[0] = sockfd;\n-\tfd[1] = sockfd;\n+\tfd[1] = dup(sockfd);\n }\n \n \n"},{"id":"32251","messageId":"46a038f90701211624y19e83999k291408764bccc645@mail.gmail.com","threadId":"6462","inReplyTo":"17843.65339.528621.549961@lisa.zopyra.com","subject":"Re: git-push through git protocol","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2007-01-22T00:24:08Z","receivedAt":"2007-01-22T00:24:08Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 1/22/07, Bill Lear <rael@zopyra.com> wrote:\n> On Monday, January 22, 2007 at 12:49:02 (+1300) Martin Langhoff writes:\n> >On 1/22/07, Bill Lear <rael@zopyra.com> wrote:\n> >> 2) we have run into problems\n> >> with developers having different umasks ---\n> >\n> >This is a non-issue. Just do git-repo-config core.sharedrepository 1\n> >on each repo.\n>\n> Does this have the same effect as 'git --bare init-db --shared'?\n> If so, I thought that was the way we initialized our company repo,\n> though our config file reads:\n>\n> [core]\n>         repositoryformatversion = 0\n>         filemode = true\n\nYou should check your repos, ours all have\n\n[core]\n        sharedrepository = true\n\nwhich I manually set doing\n\n  GIT_DIR=xx.git git-repo-config core.sharedrepository true\n\nand the group is set to \"git\" which all our devs are part of. Works great.\n\nWRT denyNonFastforwards -- even without that, git refuses to push if\nit's not a fast-forward. Maybe if I had the branch set to +headname.\nIn any case, you have to try real hard to muck that up.\n\ncheers\n\n\nm\n"},{"id":"32252","messageId":"ep11jt$uap$1@sea.gmane.org","threadId":"6462","inReplyTo":"46a038f90701211624y19e83999k291408764bccc645@mail.gmail.com","subject":"Re: git-push through git protocol","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-22T00:48:43Z","receivedAt":"2007-01-22T00:48:43Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Martin Langhoff wrote:\n\n> WRT denyNonFastforwards -- even without that, git refuses to push if\n> it's not a fast-forward. Maybe if I had the branch set to +headname.\n> In any case, you have to try real hard to muck that up.\n\nWith denyNonFastforwards even push --force, or push +head wouldn't work.\nWithout you need the above to push not fast-forward changes (rewind\nhistory).\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"32253","messageId":"7vhcujzxza.fsf@assigned-by-dhcp.cox.net","threadId":"6462","inReplyTo":"Pine.LNX.4.64.0701211554450.14248@woody.osdl.org","subject":"Re: git-push through git protocol","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-22T00:50:01Z","receivedAt":"2007-01-22T00:50:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> So Junio, I'd suggest adding this whether you then want to add the trivial \n> code to allow pushing over git:// too or not. One less special case to \n> worry about.\n>\n> \t\tLinus\n>\n> ---\n> diff --git a/connect.c b/connect.c\n> index 66daa11..7844888 100644\n> --- a/connect.c\n> +++ b/connect.c\n> @@ -529,7 +529,7 @@ static void git_tcp_connect(int fd[2], char *host)\n>  \tint sockfd = git_tcp_connect_sock(host);\n>  \n>  \tfd[0] = sockfd;\n> -\tfd[1] = sockfd;\n> +\tfd[1] = dup(sockfd);\n>  }\n\nYeah, I think this is very sensible thing to do.\n"},{"id":"32257","messageId":"7v3b63zx0k.fsf_-_@assigned-by-dhcp.cox.net","threadId":"6462","inReplyTo":"Pine.LNX.4.64.0701211554450.14248@woody.osdl.org","subject":"[PATCH] Make sure git_connect() always give two file descriptors.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-22T01:10:51Z","receivedAt":"2007-01-22T01:10:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Earlier, git_connect() returned the same fd when the destination\nwas remote (i.e.  we used socket to communicate with it) and two\nseparate fds when the destination was local (i.e. we used\npipe(2)).\n\nThis forced callers who do close() and dup() to really care\nwhich was which, and most of the existing callers got this\nwrong, although without much visible ill effect.\n\nFix it to uniformly use two separate fd, so if somebody wants to\nclose only reader side can just do close() on it without\nworrying about it accidentally also closing the writer side or\nvice versa.\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n * Your patch; just checking if the above log message makes sense...\n\n connect.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/connect.c b/connect.c\nindex 66daa11..7844888 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -529,7 +529,7 @@ static void git_tcp_connect(int fd[2], char *host)\n \tint sockfd = git_tcp_connect_sock(host);\n \n \tfd[0] = sockfd;\n-\tfd[1] = sockfd;\n+\tfd[1] = dup(sockfd);\n }\n \n \n-- \n1.5.0.rc2\n"},{"id":"32260","messageId":"17844.5120.316805.794579@lisa.zopyra.com","threadId":"6462","inReplyTo":"Pine.LNX.4.64.0701211341300.14248@woody.osdl.org","subject":"Re: git-push through git protocol","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-22T01:31:44Z","receivedAt":"2007-01-22T01:31:44Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Sunday, January 21, 2007 at 14:00:16 (-0800) Linus Torvalds writes:\n>On Sun, 21 Jan 2007, Bill Lear wrote:\n>> I did the steenking testing and it appears to fail.\n>\n>Ok, I did the test too. It does _appear_ to fail, where the keyword is \n>actually the \"appear\". \n\nI applied the patches and I get failure.  I have appended the entire\ntest case after my sig.  The last part reads:\n\n% git push\nupdating 'refs/heads/master'\n  from fee4efae4f3b98cce0fe85efc746291157fffbcd\n  to   e1179a3bf842ddcf4643740a396b46ce7ebd4ada\nGenerating pack...\nDone counting 5 objects.\nResult has 3 objects.\nDeltifying 3 objects.\n 100% (3/3) done\nWriting 3 objects.\n 100% (3/3) done\nTotal 3 (delta 0), reused 0 (delta 0)\nunpack unpacker exited with error code\nng refs/heads/master n/a (unpacker error)\n\nThis is on a Centos 4.3 system, under bash.  I am pushing to a git\nserver running on my local host.\n\n\nBill\n\n% cat /etc/xinet.d/git-daemon\nservice git\n{\n        disable         = no\n        type            = UNLISTED\n        port            = 9418\n        socket_type     = stream\n        wait            = no\n        user            = nobody\n        server          = /opt/git-1.5.0-rc2/bin/git-daemon\n        server_args     = --enable=receive-pack --verbose --syslog --inetd --export-all --base-path=/repos/git\n        log_on_failure  += USERID\n}\n% mkdir /repos/git/foo\n% cd /repos/git/foo\n% git --bare init-db --shared\nInitialized empty shared Git repository in /home/repos/git/foo/\n% mkdir ~/foo\n% cd ~/foo\n% git init-db\n% echo foo > foo\n% git add foo\n% git commit -a -m foo\n% git push /repos/git/foo master\nupdating 'refs/heads/master'\n  from 0000000000000000000000000000000000000000\n  to   fee4efae4f3b98cce0fe85efc746291157fffbcd\nGenerating pack...\nDone counting 3 objects.\nDeltifying 3 objects.\n 100% (3/3) done\nWriting 3 objects.\n 100% (3/3) done\nTotal 3 (delta 0), reused 0 (delta 0)\nUnpacking 3 objects\n 100% (3/3) done\nrefs/heads/master: 0000000000000000000000000000000000000000 -> fee4efae4f3b98cce0fe85efc746291157fffbcd\n% cd ~/\n% rm -rf foo\n% git clone git://localhost/foo\nInitialized empty Git repository in /home/blear/foo/.git/\nremote: Generating pack...\nremote: Done counting 3 objects.\nremote: Deltifying 3 objects.\nremote: /3) done/3) done\nremote: Total 3 (delta 0), reused 0 (delta 0)\nIndexing 3 objects.\n 100% (3/3) done\n% cd foo\n% echo bar >> foo\n% git commit -a -m bar\nCreated commit e1179a3bf842ddcf4643740a396b46ce7ebd4ada\n 1 files changed, 1 insertions(+), 0 deletions(-)\n% git push\nupdating 'refs/heads/master'\n  from fee4efae4f3b98cce0fe85efc746291157fffbcd\n  to   e1179a3bf842ddcf4643740a396b46ce7ebd4ada\nGenerating pack...\nDone counting 5 objects.\nResult has 3 objects.\nDeltifying 3 objects.\n 100% (3/3) done\nWriting 3 objects.\n 100% (3/3) done\nTotal 3 (delta 0), reused 0 (delta 0)\nunpack unpacker exited with error code\nng refs/heads/master n/a (unpacker error)\n"},{"id":"32262","messageId":"17844.5683.758362.984146@lisa.zopyra.com","threadId":"6462","inReplyTo":"17844.5120.316805.794579@lisa.zopyra.com","subject":"Re: git-push through git protocol","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-22T01:41:07Z","receivedAt":"2007-01-22T01:41:07Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Sunday, January 21, 2007 at 19:31:44 (-0600) Bill Lear writes:\n>...\n>I applied the patches ...\n\nI neglected to say that these patches were applied to the latest\n1.5.0-rc2 code.  Sorry for the slip.\n\n\nBill\n"},{"id":"32263","messageId":"Pine.LNX.4.64.0701211744140.14248@woody.osdl.org","threadId":"6462","inReplyTo":"7v3b63zx0k.fsf_-_@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Make sure git_connect() always give two file descriptors.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2007-01-22T01:47:09Z","receivedAt":"2007-01-22T01:47:09Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 21 Jan 2007, Junio C Hamano wrote:\n>\n> Earlier, git_connect() returned the same fd when the destination\n> was remote (i.e.  we used socket to communicate with it) and two\n> separate fds when the destination was local (i.e. we used\n> pipe(2)).\n\nActually, to be strictly correct, we returned the same fd when\n\n - we used git:// and were not proxying\n\nand we returned two different fd's for all other cases (ie local, ssh, \nproxy-git).\n\nSo it's not really about \"remote\" vs \"local\", since ssh in particular is \nmostly remote too, but since we used pipes to connect with ssh, it acted \nthe same way as the local case (which also used pipes to connect to the \nlocal processes).\n\nAnd git:// with proxy support also ended up using pipes (for the proxy \nprocess), which is why you _only_ saw this with the raw direct TCP git:// \ncase.\n\nOr something like that.-\n\n\t\tLinus\n"},{"id":"32264","messageId":"Pine.LNX.4.64.0701211749140.14248@woody.osdl.org","threadId":"6462","inReplyTo":"17844.5120.316805.794579@lisa.zopyra.com","subject":"Re: git-push through git protocol","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2007-01-22T01:52:22Z","receivedAt":"2007-01-22T01:52:22Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 21 Jan 2007, Bill Lear wrote:\n> \n> I applied the patches and I get failure.  I have appended the entire\n> test case after my sig.  The last part reads:\n\nOk, that's different. It worked for me, several times. As far as I can \ntell, the biggest thing is just a difference in OS and the fact that I'm \nnot running the git daemon from xinetd, but directly by hand as myself.\n\n> % git push\n> updating 'refs/heads/master'\n>   from fee4efae4f3b98cce0fe85efc746291157fffbcd\n>   to   e1179a3bf842ddcf4643740a396b46ce7ebd4ada\n> Generating pack...\n> Done counting 5 objects.\n> Result has 3 objects.\n> Deltifying 3 objects.\n>  100% (3/3) done\n> Writing 3 objects.\n>  100% (3/3) done\n> Total 3 (delta 0), reused 0 (delta 0)\n> unpack unpacker exited with error code\n> ng refs/heads/master n/a (unpacker error)\n\nUmm. Your git daemon is probably running as \"nobody\", and simply doesn't \nhave write permissions to the archive, does it?\n\n> % cat /etc/xinet.d/git-daemon\n> service git\n> {\n>         user            = nobody\n\niow, I think you simply need to make sure that git-daemon will have write \npermission to the thing. Either by making the whole repository writable by \nnobody, or by running git-daemon as the proper user.\n\n\t\tLinus\n"},{"id":"32269","messageId":"46a038f90701211826v54340352lf4376db41ad5be37@mail.gmail.com","threadId":"6462","inReplyTo":"Pine.LNX.4.64.0701211749140.14248@woody.osdl.org","subject":"Re: git-push through git protocol","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2007-01-22T02:26:18Z","receivedAt":"2007-01-22T02:26:18Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 1/22/07, Linus Torvalds <torvalds@osdl.org> wrote:\n> Umm. Your git daemon is probably running as \"nobody\", and simply doesn't\n> have write permissions to the archive, does it?\n>\n> > % cat /etc/xinet.d/git-daemon\n> > service git\n> > {\n> >         user            = nobody\n>\n> iow, I think you simply need to make sure that git-daemon will have write\n> permission to the thing. Either by making the whole repository writable by\n> nobody, or by running git-daemon as the proper user.\n\nWhereby I personaly run back quickly to cover under my git-over-ssh\nsafety blanket.\n\n:-)\n\n\nmartin\n"},{"id":"32274","messageId":"Pine.LNX.4.64.0701211858340.14248@woody.osdl.org","threadId":"6462","inReplyTo":"46a038f90701211826v54340352lf4376db41ad5be37@mail.gmail.com","subject":"Re: git-push through git protocol","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2007-01-22T03:01:45Z","receivedAt":"2007-01-22T03:01:45Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 22 Jan 2007, Martin Langhoff wrote:\n\n> On 1/22/07, Linus Torvalds <torvalds@osdl.org> wrote:\n> > Umm. Your git daemon is probably running as \"nobody\", and simply doesn't\n> > have write permissions to the archive, does it?\n> > \n> > > % cat /etc/xinet.d/git-daemon\n> > > service git\n> > > {\n> > >         user            = nobody\n> > \n> > iow, I think you simply need to make sure that git-daemon will have write\n> > permission to the thing. Either by making the whole repository writable by\n> > nobody, or by running git-daemon as the proper user.\n> \n> Whereby I personaly run back quickly to cover under my git-over-ssh\n> safety blanket.\n\nSure. \n\nI suspect that git-daemon is possibly easier and faster to set up in the \nkind of situation where you set up git instead of CVS inside a company, \nthough.\n\nIn that situation, you could just say: \"machine X is the central CVS \nrepository, and now it also contains a set of git repositories, all owned \nby nobody:nobody\".\n\nThat way, you basically get the exact same situation as you had with CVS, \nwith minimal setup.\n\nIf the alternative is some NFS thing, I'd take that writing git-daemon \nover shared NFS-access from everybody any day..\n\n\t\tLinus\n"},{"id":"32291","messageId":"17844.49923.798205.493630@lisa.zopyra.com","threadId":"6462","inReplyTo":"Pine.LNX.4.64.0701211858340.14248@woody.osdl.org","subject":"Re: git-push through git protocol","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-22T13:58:27Z","receivedAt":"2007-01-22T13:58:27Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Sunday, January 21, 2007 at 19:01:45 (-0800) Linus Torvalds writes:\n>On Mon, 22 Jan 2007, Martin Langhoff wrote:\n>> ...\n>> Whereby I personaly run back quickly to cover under my git-over-ssh\n>> safety blanket.\n>\n>Sure. \n>\n>I suspect that git-daemon is possibly easier and faster to set up in the \n>kind of situation where you set up git instead of CVS inside a company, \n>though. ...\n\nAnother nice thing with the git protocol is that we can keep the\nrepository \"interface\" constant --- it's always \"git://server/repo\"\nfor us, even if we have the repo one day at /repos/git/repo, or later\ndecide to move it to /backedup/repos/git/repo.  All we have to do is\nchange the git-daemon file and point it at the new repo, and all the\ndevelopers' origin files need not change.  You can do this with\nsymlinks, I suppose, but after the third move, we really appreciated\nthe git mobility and disliked the litter of symlinks:-)\n\n\nBill\n"},{"id":"32293","messageId":"17844.52487.646049.902119@lisa.zopyra.com","threadId":"6462","inReplyTo":"Pine.LNX.4.64.0701211749140.14248@woody.osdl.org","subject":"Re: git-push through git protocol","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-22T14:41:11Z","receivedAt":"2007-01-22T14:41:11Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Sunday, January 21, 2007 at 17:52:22 (-0800) Linus Torvalds writes:\n>...\n>iow, I think you simply need to make sure that git-daemon will have write \n>permission to the thing. Either by making the whole repository writable by \n>nobody, or by running git-daemon as the proper user.\n\nThis now works:\n\n% perl -pi -e 's/nobody/blear/' /etc/xinetd.d/git-daemon\n% /etc/init.d/xinetd restart\n% cd test/foo\n% cat .git/remotes/origin\nURL: git://blake/foo\nPull: refs/heads/master:refs/heads/origin\n% git push\nupdating 'refs/heads/master'\n  from fee4efae4f3b98cce0fe85efc746291157fffbcd\n  to   73167c1dbcd08ef290f9ead5eef1808236e728b3\nGenerating pack...\nDone counting 5 objects.\nResult has 3 objects.\nDeltifying 3 objects.\n 100% (3/3) done\nWriting 3 objects.\n 100% (3/3) done\nTotal 3 (delta 0), reused 0 (delta 0)\n\nThanks for the help.\n\n\nBill\n"}]}