{"thread":{"id":"15456","subject":"Commit templates are not readable after 'make install'","startedAt":"2008-09-09T19:02:01Z","lastAt":"2008-09-11T17:21:21Z","messageCount":6,"participants":["Anatol Pomozov","Junio C Hamano","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"90247","messageId":"3665a1a00809091202u295fedabl53b280aad7bedb62@mail.gmail.com","threadId":"15456","inReplyTo":null,"subject":"Commit templates are not readable after 'make install'","fromName":"Anatol Pomozov","fromEmail":"anatol.pomozov@gmail.com","sentAt":"2008-09-09T19:02:01Z","receivedAt":"2008-09-09T19:02:01Z","isPatch":false,"sender":{"key":"anatol.pomozov@gmail.com","avatar":"https://gravatar.com/avatar/71fc20093402ce987148294ec0999d025209e52da6762789ff248cf5c317645f?d=mp&s=160"},"body":"Hi,\n\nI build git from sources and I have one small permissions issue that\n(I think) should be fixed.\n\nSo I build it as described in INSTALL file\nmake prefix=/usr all\nsudo make prefix=/usr install\n\nEverything goes fine here and we have a new version of git installed\n$ git --version\ngit version 1.6.0.1.285.g1070\n\nBut when I want to create a new repo, I have a fatal problem\n$ git init\nfatal: cannot copy\n/usr/share/git-core/templates/hooks/applypatch-msg.sample to\n/personal/sources/opensource/1/.git/hooks/applypatch-msg.sample\n\n\nBecause of the template files are readable only for root\n$ ls -l /usr/share/git-core/templates/hooks/\ntotal 44\n-rwxr-x--- 1 root root  452 2008-08-29 11:04 applypatch-msg.sample\n-rwxr-x--- 1 root root  894 2008-08-29 11:04 commit-msg.sample\n-rwxr-x--- 1 root root  160 2008-08-29 11:04 post-commit.sample\n-rwxr-x--- 1 root root  553 2008-08-29 11:04 post-receive.sample\n\n\nI could fix the problem by running\n$ sudo chmod a+r -R /usr/share/git-core/templates\n\n\nBut I think it should do 'make' when it installs git-core, isnt it?\n\n-- \nanatol\n"},{"id":"90249","messageId":"7v8wu16sbc.fsf@gitster.siamese.dyndns.org","threadId":"15456","inReplyTo":"3665a1a00809091202u295fedabl53b280aad7bedb62@mail.gmail.com","subject":"Re: Commit templates are not readable after 'make install'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-09T19:19:03Z","receivedAt":"2008-09-09T19:19:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Anatol Pomozov\" <anatol.pomozov@gmail.com> writes:\n\n> I build git from sources and I have one small permissions issue that\n> (I think) should be fixed.\n>\n> So I build it as described in INSTALL file\n> make prefix=/usr all\n> sudo make prefix=/usr install\n>\n> Everything goes fine here and we have a new version of git installed\n> $ git --version\n> git version 1.6.0.1.285.g1070\n>\n> But when I want to create a new repo, I have a fatal problem\n> $ git init\n> fatal: cannot copy\n> /usr/share/git-core/templates/hooks/applypatch-msg.sample to\n> /personal/sources/opensource/1/.git/hooks/applypatch-msg.sample\n>\n>\n> Because of the template files are readable only for root\n> $ ls -l /usr/share/git-core/templates/hooks/\n> total 44\n> -rwxr-x--- 1 root root  452 2008-08-29 11:04 applypatch-msg.sample\n> -rwxr-x--- 1 root root  894 2008-08-29 11:04 commit-msg.sample\n> -rwxr-x--- 1 root root  160 2008-08-29 11:04 post-commit.sample\n> -rwxr-x--- 1 root root  553 2008-08-29 11:04 post-receive.sample\n\nDidn't 9907721 (templates/Makefile: don't depend on local umask setting,\n2008-02-28) take care of that?\n\n    ... goes and looks ...\n\nAh, that is only to propagate the wish of the person who _built_ it.\n\nYou probably have a tight umask and have sources checked out unreadable to\nothers, which is propagated to the installation (check the permission of\nfiles in your templates/blt directory to verify this conjecture).  And the\nbuild procedure is honoring your wish to make things unreadable to others.\n"},{"id":"90253","messageId":"7vprnd5b07.fsf@gitster.siamese.dyndns.org","threadId":"15456","inReplyTo":"7v8wu16sbc.fsf@gitster.siamese.dyndns.org","subject":"Re: Commit templates are not readable after 'make install'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-09T20:18:16Z","receivedAt":"2008-09-09T20:18:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Didn't 9907721 (templates/Makefile: don't depend on local umask setting,\n> 2008-02-28) take care of that?\n>\n>     ... goes and looks ...\n>\n> Ah, that is only to propagate the wish of the person who _built_ it.\n>\n> You probably have a tight umask and have sources checked out unreadable to\n> others, which is propagated to the installation (check the permission of\n> files in your templates/blt directory to verify this conjecture).  And the\n> build procedure is honoring your wish to make things unreadable to others.\n\nI should have said \"too tight a umask\", but anyway, try this patch and see\nit helps.\n\n-- >8 --\nFix permission bits on sources checked out with an overtight umask\n\nTwo patches 9907721 (templates/Makefile: don't depend on local umask\nsetting, 2008-02-28) and 96cda0b (templates/Makefile: install is\nunnecessary, just use mkdir -p, 2008-08-21) tried to prevent an overtight\numask the builder/installer might have from screwing over the installation\nprocedure, but we forgot there was another source of trouble.  If the\nperson who checked out the source tree had an overtight umask, it will\nleak out to the built products, which is propagated to the installation\ndestination.\n\n templates/Makefile |    8 +++++---\n 1 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git c/templates/Makefile w/templates/Makefile\nindex 0722a92..a12c6e2 100644\n--- c/templates/Makefile\n+++ w/templates/Makefile\n@@ -31,9 +31,11 @@ boilerplates.made : $(bpsrc)\n \t\tdir=`expr \"$$dst\" : '\\(.*\\)/'` && \\\n \t\tmkdir -p blt/$$dir && \\\n \t\tcase \"$$boilerplate\" in \\\n-\t\t*--) ;; \\\n-\t\t*) cp -p $$boilerplate blt/$$dst ;; \\\n-\t\tesac || exit; \\\n+\t\t*--) continue;; \\\n+\t\tesac && \\\n+\t\tcp $$boilerplate blt/$$dst && \\\n+\t\tif test -x \"blt/$$dst\"; then rx=rx; else rx=r; fi && \\\n+\t\tchmod a+$$rx \"blt/$$dst\" || exit; \\\n \tdone && \\\n \tdate >$@\n \n"},{"id":"90318","messageId":"48C76A88.2050109@viscovery.net","threadId":"15456","inReplyTo":"7vprnd5b07.fsf@gitster.siamese.dyndns.org","subject":"Re: Commit templates are not readable after 'make install'","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-09-10T06:34:48Z","receivedAt":"2008-09-10T06:34:48Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Junio C Hamano schrieb:\n> Fix permission bits on sources checked out with an overtight umask\n> \n> Two patches 9907721 (templates/Makefile: don't depend on local umask\n> setting, 2008-02-28) and 96cda0b (templates/Makefile: install is\n> unnecessary, just use mkdir -p, 2008-08-21) tried to prevent an overtight\n> umask the builder/installer might have from screwing over the installation\n> procedure, but we forgot there was another source of trouble.  If the\n> person who checked out the source tree had an overtight umask, it will\n> leak out to the built products, which is propagated to the installation\n> destination.\n> \n>  templates/Makefile |    8 +++++---\n>  1 files changed, 5 insertions(+), 3 deletions(-)\n> \n> diff --git c/templates/Makefile w/templates/Makefile\n> index 0722a92..a12c6e2 100644\n> --- c/templates/Makefile\n> +++ w/templates/Makefile\n> @@ -31,9 +31,11 @@ boilerplates.made : $(bpsrc)\n>  \t\tdir=`expr \"$$dst\" : '\\(.*\\)/'` && \\\n>  \t\tmkdir -p blt/$$dir && \\\n>  \t\tcase \"$$boilerplate\" in \\\n> -\t\t*--) ;; \\\n> -\t\t*) cp -p $$boilerplate blt/$$dst ;; \\\n> -\t\tesac || exit; \\\n> +\t\t*--) continue;; \\\n> +\t\tesac && \\\n> +\t\tcp $$boilerplate blt/$$dst && \\\n> +\t\tif test -x \"blt/$$dst\"; then rx=rx; else rx=r; fi && \\\n> +\t\tchmod a+$$rx \"blt/$$dst\" || exit; \\\n>  \tdone && \\\n>  \tdate >$@\n\nSince only hooks need to be executable, how about this instead:\n\ndiff --git a/templates/Makefile b/templates/Makefile\nindex 0722a92..80cd000 100644\n--- a/templates/Makefile\n+++ b/templates/Makefile\n@@ -32,7 +32,12 @@ boilerplates.made : $(bpsrc)\n \t\tmkdir -p blt/$$dir && \\\n \t\tcase \"$$boilerplate\" in \\\n \t\t*--) ;; \\\n-\t\t*) cp -p $$boilerplate blt/$$dst ;; \\\n+\t\thooks--*) \\\n+\t\t\tcp -p \"$$boilerplate\" \"blt/$$dst\" && \\\n+\t\t\tchmod a+rx \"blt/$$dst\";; \\\n+\t\t*) \\\n+\t\t\tcp -p \"$$boilerplate\" \"blt/$$dst\" && \\\n+\t\t\tchmod a+r \"blt/$$dst\";; \\\n \t\tesac || exit; \\\n \tdone && \\\n \tdate >$@\n"},{"id":"90323","messageId":"7vsks8xy4q.fsf@gitster.siamese.dyndns.org","threadId":"15456","inReplyTo":"48C76A88.2050109@viscovery.net","subject":"Re: Commit templates are not readable after 'make install'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-10T07:23:33Z","receivedAt":"2008-09-10T07:23:33Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n>> diff --git c/templates/Makefile w/templates/Makefile\n>> index 0722a92..a12c6e2 100644\n>> --- c/templates/Makefile\n>> +++ w/templates/Makefile\n>> @@ -31,9 +31,11 @@ boilerplates.made : $(bpsrc)\n>>  \t\tdir=`expr \"$$dst\" : '\\(.*\\)/'` && \\\n>>  \t\tmkdir -p blt/$$dir && \\\n>>  \t\tcase \"$$boilerplate\" in \\\n>> -\t\t*--) ;; \\\n>> -\t\t*) cp -p $$boilerplate blt/$$dst ;; \\\n>> -\t\tesac || exit; \\\n>> +\t\t*--) continue;; \\\n>> +\t\tesac && \\\n>> +\t\tcp $$boilerplate blt/$$dst && \\\n>> +\t\tif test -x \"blt/$$dst\"; then rx=rx; else rx=r; fi && \\\n>> +\t\tchmod a+$$rx \"blt/$$dst\" || exit; \\\n>>  \tdone && \\\n>>  \tdate >$@\n>\n> Since only hooks need to be executable, how about this instead:\n\nHmm. I tried to avoid hardcoding \"it so happens that currently the only\nexecutables are hooks\".\n\n> diff --git a/templates/Makefile b/templates/Makefile\n> index 0722a92..80cd000 100644\n> --- a/templates/Makefile\n> +++ b/templates/Makefile\n> @@ -32,7 +32,12 @@ boilerplates.made : $(bpsrc)\n>  \t\tmkdir -p blt/$$dir && \\\n>  \t\tcase \"$$boilerplate\" in \\\n>  \t\t*--) ;; \\\n> -\t\t*) cp -p $$boilerplate blt/$$dst ;; \\\n> +\t\thooks--*) \\\n> +\t\t\tcp -p \"$$boilerplate\" \"blt/$$dst\" && \\\n> +\t\t\tchmod a+rx \"blt/$$dst\";; \\\n> +\t\t*) \\\n> +\t\t\tcp -p \"$$boilerplate\" \"blt/$$dst\" && \\\n> +\t\t\tchmod a+r \"blt/$$dst\";; \\\n>  \t\tesac || exit; \\\n>  \tdone && \\\n>  \tdate >$@\n"},{"id":"90455","messageId":"3665a1a00809111021i565be775x9ad34dd99f753497@mail.gmail.com","threadId":"15456","inReplyTo":"7vprnd5b07.fsf@gitster.siamese.dyndns.org","subject":"Re: Commit templates are not readable after 'make install'","fromName":"Anatol Pomozov","fromEmail":"anatol.pomozov@gmail.com","sentAt":"2008-09-11T17:21:21Z","receivedAt":"2008-09-11T17:21:21Z","isPatch":false,"sender":{"key":"anatol.pomozov@gmail.com","avatar":"https://gravatar.com/avatar/71fc20093402ce987148294ec0999d025209e52da6762789ff248cf5c317645f?d=mp&s=160"},"body":"Hi, Junio.\n\nThanks for the provided patch. It works fine for me and I agree that\nit is better do not hardcode that only hooks are executable. So your\nsolution looks better for me. +1 for include this patch.\n\n\nNow permissions for are\n\nanatol:repo $ ls -l /usr/share/git-core/templates/ -R\n/usr/share/git-core/templates/:\ntotal 16\ndrwxr-xr-x 2 root root 4096 2008-09-11 10:13 branches\n-rw-r--r-- 1 root root   58 2008-09-11 10:13 description\ndrwxr-xr-x 2 root root 4096 2008-09-11 10:13 hooks\ndrwxr-xr-x 2 root root 4096 2008-09-11 10:13 info\n\n/usr/share/git-core/templates/branches:\ntotal 0\n\n/usr/share/git-core/templates/hooks:\ntotal 44\n-rwxr-xr-x 1 root root  452 2008-09-11 10:13 applypatch-msg.sample\n-rwxr-xr-x 1 root root  894 2008-09-11 10:13 commit-msg.sample\n-rwxr-xr-x 1 root root  160 2008-09-11 10:13 post-commit.sample\n-rwxr-xr-x 1 root root  553 2008-09-11 10:13 post-receive.sample\n-rwxr-xr-x 1 root root  189 2008-09-11 10:13 post-update.sample\n-rwxr-xr-x 1 root root  398 2008-09-11 10:13 pre-applypatch.sample\n-rwxr-xr-x 1 root root  519 2008-09-11 10:13 pre-commit.sample\n-rwxr-xr-x 1 root root 1219 2008-09-11 10:13 prepare-commit-msg.sample\n-rwxr-xr-x 1 root root 4942 2008-09-11 10:13 pre-rebase.sample\n-rwxr-xr-x 1 root root 2892 2008-09-11 10:13 update.sample\n\n/usr/share/git-core/templates/info:\ntotal 4\n-rw-r--r-- 1 root root 240 2008-09-11 10:13 exclude\n\nOn Tue, Sep 9, 2008 at 1:18 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Didn't 9907721 (templates/Makefile: don't depend on local umask setting,\n>> 2008-02-28) take care of that?\n>>\n>>     ... goes and looks ...\n>>\n>> Ah, that is only to propagate the wish of the person who _built_ it.\n>>\n>> You probably have a tight umask and have sources checked out unreadable to\n>> others, which is propagated to the installation (check the permission of\n>> files in your templates/blt directory to verify this conjecture).  And the\n>> build procedure is honoring your wish to make things unreadable to others.\n>\n> I should have said \"too tight a umask\", but anyway, try this patch and see\n> it helps.\n>\n> -- >8 --\n> Fix permission bits on sources checked out with an overtight umask\n>\n> Two patches 9907721 (templates/Makefile: don't depend on local umask\n> setting, 2008-02-28) and 96cda0b (templates/Makefile: install is\n> unnecessary, just use mkdir -p, 2008-08-21) tried to prevent an overtight\n> umask the builder/installer might have from screwing over the installation\n> procedure, but we forgot there was another source of trouble.  If the\n> person who checked out the source tree had an overtight umask, it will\n> leak out to the built products, which is propagated to the installation\n> destination.\n>\n>  templates/Makefile |    8 +++++---\n>  1 files changed, 5 insertions(+), 3 deletions(-)\n>\n> diff --git c/templates/Makefile w/templates/Makefile\n> index 0722a92..a12c6e2 100644\n> --- c/templates/Makefile\n> +++ w/templates/Makefile\n> @@ -31,9 +31,11 @@ boilerplates.made : $(bpsrc)\n>                dir=`expr \"$$dst\" : '\\(.*\\)/'` && \\\n>                mkdir -p blt/$$dir && \\\n>                case \"$$boilerplate\" in \\\n> -               *--) ;; \\\n> -               *) cp -p $$boilerplate blt/$$dst ;; \\\n> -               esac || exit; \\\n> +               *--) continue;; \\\n> +               esac && \\\n> +               cp $$boilerplate blt/$$dst && \\\n> +               if test -x \"blt/$$dst\"; then rx=rx; else rx=r; fi && \\\n> +               chmod a+$$rx \"blt/$$dst\" || exit; \\\n>        done && \\\n>        date >$@\n>\n>\n\n\n\n-- \nanatol\n"}]}