git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Commit templates are not readable after 'make install'
       [not found] <3665a1a00809090835g2a8ea4aas6cfa2ebc922f12b2@mail.gmail.com>
@ 2008-09-09 15:41 ` Anatol Pomozov
  0 siblings, 0 replies; 7+ messages in thread
From: Anatol Pomozov @ 2008-09-09 15:41 UTC (permalink / raw)
  To: git

Hi,

I build git from sources and I have one small permissions issue that
(I think) should be fixed.

So I build it as described in INSTALL file
make prefix=/usr all
sudo make prefix=/usr install

Everything goes fine here and we have a new version of git installed
$ git --version
git version 1.6.0.1.285.g1070

But when I want to create a new repo, I have a fatal problem
$ git init
fatal: cannot copy /usr/share/git-core/templates/
hooks/applypatch-msg.sample to
/personal/sources/opensource/1/.git/hooks/applypatch-msg.sample


Because of the template files are readable only for root
$ ls -l /usr/share/git-core/templates/hooks/
total 44
-rwxr-x--- 1 root root  452 2008-08-29 11:04 applypatch-msg.sample
-rwxr-x--- 1 root root  894 2008-08-29 11:04 commit-msg.sample
-rwxr-x--- 1 root root  160 2008-08-29 11:04 post-commit.sample
-rwxr-x--- 1 root root  553 2008-08-29 11:04 post-receive.sample


I could fix the problem by running
$ sudo chmod a+r -R /usr/share/git-core/templates


But I think it should do 'make' when it installs git-core, isnt it?

--
anatol

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Commit templates are not readable after 'make install'
@ 2008-09-09 19:02 Anatol Pomozov
  2008-09-09 19:19 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Anatol Pomozov @ 2008-09-09 19:02 UTC (permalink / raw)
  To: git; +Cc: johannes.sixt

Hi,

I build git from sources and I have one small permissions issue that
(I think) should be fixed.

So I build it as described in INSTALL file
make prefix=/usr all
sudo make prefix=/usr install

Everything goes fine here and we have a new version of git installed
$ git --version
git version 1.6.0.1.285.g1070

But when I want to create a new repo, I have a fatal problem
$ git init
fatal: cannot copy
/usr/share/git-core/templates/hooks/applypatch-msg.sample to
/personal/sources/opensource/1/.git/hooks/applypatch-msg.sample


Because of the template files are readable only for root
$ ls -l /usr/share/git-core/templates/hooks/
total 44
-rwxr-x--- 1 root root  452 2008-08-29 11:04 applypatch-msg.sample
-rwxr-x--- 1 root root  894 2008-08-29 11:04 commit-msg.sample
-rwxr-x--- 1 root root  160 2008-08-29 11:04 post-commit.sample
-rwxr-x--- 1 root root  553 2008-08-29 11:04 post-receive.sample


I could fix the problem by running
$ sudo chmod a+r -R /usr/share/git-core/templates


But I think it should do 'make' when it installs git-core, isnt it?

-- 
anatol

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Commit templates are not readable after 'make install'
  2008-09-09 19:02 Anatol Pomozov
@ 2008-09-09 19:19 ` Junio C Hamano
  2008-09-09 20:18   ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2008-09-09 19:19 UTC (permalink / raw)
  To: Anatol Pomozov; +Cc: git, johannes.sixt

"Anatol Pomozov" <anatol.pomozov@gmail.com> writes:

> I build git from sources and I have one small permissions issue that
> (I think) should be fixed.
>
> So I build it as described in INSTALL file
> make prefix=/usr all
> sudo make prefix=/usr install
>
> Everything goes fine here and we have a new version of git installed
> $ git --version
> git version 1.6.0.1.285.g1070
>
> But when I want to create a new repo, I have a fatal problem
> $ git init
> fatal: cannot copy
> /usr/share/git-core/templates/hooks/applypatch-msg.sample to
> /personal/sources/opensource/1/.git/hooks/applypatch-msg.sample
>
>
> Because of the template files are readable only for root
> $ ls -l /usr/share/git-core/templates/hooks/
> total 44
> -rwxr-x--- 1 root root  452 2008-08-29 11:04 applypatch-msg.sample
> -rwxr-x--- 1 root root  894 2008-08-29 11:04 commit-msg.sample
> -rwxr-x--- 1 root root  160 2008-08-29 11:04 post-commit.sample
> -rwxr-x--- 1 root root  553 2008-08-29 11:04 post-receive.sample

Didn't 9907721 (templates/Makefile: don't depend on local umask setting,
2008-02-28) take care of that?

    ... goes and looks ...

Ah, that is only to propagate the wish of the person who _built_ it.

You probably have a tight umask and have sources checked out unreadable to
others, which is propagated to the installation (check the permission of
files in your templates/blt directory to verify this conjecture).  And the
build procedure is honoring your wish to make things unreadable to others.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Commit templates are not readable after 'make install'
  2008-09-09 19:19 ` Junio C Hamano
@ 2008-09-09 20:18   ` Junio C Hamano
  2008-09-10  6:34     ` Johannes Sixt
  2008-09-11 17:21     ` Anatol Pomozov
  0 siblings, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2008-09-09 20:18 UTC (permalink / raw)
  To: Anatol Pomozov; +Cc: git, johannes.sixt

Junio C Hamano <gitster@pobox.com> writes:

> Didn't 9907721 (templates/Makefile: don't depend on local umask setting,
> 2008-02-28) take care of that?
>
>     ... goes and looks ...
>
> Ah, that is only to propagate the wish of the person who _built_ it.
>
> You probably have a tight umask and have sources checked out unreadable to
> others, which is propagated to the installation (check the permission of
> files in your templates/blt directory to verify this conjecture).  And the
> build procedure is honoring your wish to make things unreadable to others.

I should have said "too tight a umask", but anyway, try this patch and see
it helps.

-- >8 --
Fix permission bits on sources checked out with an overtight umask

Two patches 9907721 (templates/Makefile: don't depend on local umask
setting, 2008-02-28) and 96cda0b (templates/Makefile: install is
unnecessary, just use mkdir -p, 2008-08-21) tried to prevent an overtight
umask the builder/installer might have from screwing over the installation
procedure, but we forgot there was another source of trouble.  If the
person who checked out the source tree had an overtight umask, it will
leak out to the built products, which is propagated to the installation
destination.

 templates/Makefile |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git c/templates/Makefile w/templates/Makefile
index 0722a92..a12c6e2 100644
--- c/templates/Makefile
+++ w/templates/Makefile
@@ -31,9 +31,11 @@ boilerplates.made : $(bpsrc)
 		dir=`expr "$$dst" : '\(.*\)/'` && \
 		mkdir -p blt/$$dir && \
 		case "$$boilerplate" in \
-		*--) ;; \
-		*) cp -p $$boilerplate blt/$$dst ;; \
-		esac || exit; \
+		*--) continue;; \
+		esac && \
+		cp $$boilerplate blt/$$dst && \
+		if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \
+		chmod a+$$rx "blt/$$dst" || exit; \
 	done && \
 	date >$@
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Commit templates are not readable after 'make install'
  2008-09-09 20:18   ` Junio C Hamano
@ 2008-09-10  6:34     ` Johannes Sixt
  2008-09-10  7:23       ` Junio C Hamano
  2008-09-11 17:21     ` Anatol Pomozov
  1 sibling, 1 reply; 7+ messages in thread
From: Johannes Sixt @ 2008-09-10  6:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Anatol Pomozov, git

Junio C Hamano schrieb:
> Fix permission bits on sources checked out with an overtight umask
> 
> Two patches 9907721 (templates/Makefile: don't depend on local umask
> setting, 2008-02-28) and 96cda0b (templates/Makefile: install is
> unnecessary, just use mkdir -p, 2008-08-21) tried to prevent an overtight
> umask the builder/installer might have from screwing over the installation
> procedure, but we forgot there was another source of trouble.  If the
> person who checked out the source tree had an overtight umask, it will
> leak out to the built products, which is propagated to the installation
> destination.
> 
>  templates/Makefile |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git c/templates/Makefile w/templates/Makefile
> index 0722a92..a12c6e2 100644
> --- c/templates/Makefile
> +++ w/templates/Makefile
> @@ -31,9 +31,11 @@ boilerplates.made : $(bpsrc)
>  		dir=`expr "$$dst" : '\(.*\)/'` && \
>  		mkdir -p blt/$$dir && \
>  		case "$$boilerplate" in \
> -		*--) ;; \
> -		*) cp -p $$boilerplate blt/$$dst ;; \
> -		esac || exit; \
> +		*--) continue;; \
> +		esac && \
> +		cp $$boilerplate blt/$$dst && \
> +		if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \
> +		chmod a+$$rx "blt/$$dst" || exit; \
>  	done && \
>  	date >$@

Since only hooks need to be executable, how about this instead:

diff --git a/templates/Makefile b/templates/Makefile
index 0722a92..80cd000 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -32,7 +32,12 @@ boilerplates.made : $(bpsrc)
 		mkdir -p blt/$$dir && \
 		case "$$boilerplate" in \
 		*--) ;; \
-		*) cp -p $$boilerplate blt/$$dst ;; \
+		hooks--*) \
+			cp -p "$$boilerplate" "blt/$$dst" && \
+			chmod a+rx "blt/$$dst";; \
+		*) \
+			cp -p "$$boilerplate" "blt/$$dst" && \
+			chmod a+r "blt/$$dst";; \
 		esac || exit; \
 	done && \
 	date >$@

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Commit templates are not readable after 'make install'
  2008-09-10  6:34     ` Johannes Sixt
@ 2008-09-10  7:23       ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2008-09-10  7:23 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Anatol Pomozov, git

Johannes Sixt <j.sixt@viscovery.net> writes:

>> diff --git c/templates/Makefile w/templates/Makefile
>> index 0722a92..a12c6e2 100644
>> --- c/templates/Makefile
>> +++ w/templates/Makefile
>> @@ -31,9 +31,11 @@ boilerplates.made : $(bpsrc)
>>  		dir=`expr "$$dst" : '\(.*\)/'` && \
>>  		mkdir -p blt/$$dir && \
>>  		case "$$boilerplate" in \
>> -		*--) ;; \
>> -		*) cp -p $$boilerplate blt/$$dst ;; \
>> -		esac || exit; \
>> +		*--) continue;; \
>> +		esac && \
>> +		cp $$boilerplate blt/$$dst && \
>> +		if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \
>> +		chmod a+$$rx "blt/$$dst" || exit; \
>>  	done && \
>>  	date >$@
>
> Since only hooks need to be executable, how about this instead:

Hmm. I tried to avoid hardcoding "it so happens that currently the only
executables are hooks".

> diff --git a/templates/Makefile b/templates/Makefile
> index 0722a92..80cd000 100644
> --- a/templates/Makefile
> +++ b/templates/Makefile
> @@ -32,7 +32,12 @@ boilerplates.made : $(bpsrc)
>  		mkdir -p blt/$$dir && \
>  		case "$$boilerplate" in \
>  		*--) ;; \
> -		*) cp -p $$boilerplate blt/$$dst ;; \
> +		hooks--*) \
> +			cp -p "$$boilerplate" "blt/$$dst" && \
> +			chmod a+rx "blt/$$dst";; \
> +		*) \
> +			cp -p "$$boilerplate" "blt/$$dst" && \
> +			chmod a+r "blt/$$dst";; \
>  		esac || exit; \
>  	done && \
>  	date >$@

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Commit templates are not readable after 'make install'
  2008-09-09 20:18   ` Junio C Hamano
  2008-09-10  6:34     ` Johannes Sixt
@ 2008-09-11 17:21     ` Anatol Pomozov
  1 sibling, 0 replies; 7+ messages in thread
From: Anatol Pomozov @ 2008-09-11 17:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, johannes.sixt

Hi, Junio.

Thanks for the provided patch. It works fine for me and I agree that
it is better do not hardcode that only hooks are executable. So your
solution looks better for me. +1 for include this patch.


Now permissions for are

anatol:repo $ ls -l /usr/share/git-core/templates/ -R
/usr/share/git-core/templates/:
total 16
drwxr-xr-x 2 root root 4096 2008-09-11 10:13 branches
-rw-r--r-- 1 root root   58 2008-09-11 10:13 description
drwxr-xr-x 2 root root 4096 2008-09-11 10:13 hooks
drwxr-xr-x 2 root root 4096 2008-09-11 10:13 info

/usr/share/git-core/templates/branches:
total 0

/usr/share/git-core/templates/hooks:
total 44
-rwxr-xr-x 1 root root  452 2008-09-11 10:13 applypatch-msg.sample
-rwxr-xr-x 1 root root  894 2008-09-11 10:13 commit-msg.sample
-rwxr-xr-x 1 root root  160 2008-09-11 10:13 post-commit.sample
-rwxr-xr-x 1 root root  553 2008-09-11 10:13 post-receive.sample
-rwxr-xr-x 1 root root  189 2008-09-11 10:13 post-update.sample
-rwxr-xr-x 1 root root  398 2008-09-11 10:13 pre-applypatch.sample
-rwxr-xr-x 1 root root  519 2008-09-11 10:13 pre-commit.sample
-rwxr-xr-x 1 root root 1219 2008-09-11 10:13 prepare-commit-msg.sample
-rwxr-xr-x 1 root root 4942 2008-09-11 10:13 pre-rebase.sample
-rwxr-xr-x 1 root root 2892 2008-09-11 10:13 update.sample

/usr/share/git-core/templates/info:
total 4
-rw-r--r-- 1 root root 240 2008-09-11 10:13 exclude

On Tue, Sep 9, 2008 at 1:18 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Didn't 9907721 (templates/Makefile: don't depend on local umask setting,
>> 2008-02-28) take care of that?
>>
>>     ... goes and looks ...
>>
>> Ah, that is only to propagate the wish of the person who _built_ it.
>>
>> You probably have a tight umask and have sources checked out unreadable to
>> others, which is propagated to the installation (check the permission of
>> files in your templates/blt directory to verify this conjecture).  And the
>> build procedure is honoring your wish to make things unreadable to others.
>
> I should have said "too tight a umask", but anyway, try this patch and see
> it helps.
>
> -- >8 --
> Fix permission bits on sources checked out with an overtight umask
>
> Two patches 9907721 (templates/Makefile: don't depend on local umask
> setting, 2008-02-28) and 96cda0b (templates/Makefile: install is
> unnecessary, just use mkdir -p, 2008-08-21) tried to prevent an overtight
> umask the builder/installer might have from screwing over the installation
> procedure, but we forgot there was another source of trouble.  If the
> person who checked out the source tree had an overtight umask, it will
> leak out to the built products, which is propagated to the installation
> destination.
>
>  templates/Makefile |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git c/templates/Makefile w/templates/Makefile
> index 0722a92..a12c6e2 100644
> --- c/templates/Makefile
> +++ w/templates/Makefile
> @@ -31,9 +31,11 @@ boilerplates.made : $(bpsrc)
>                dir=`expr "$$dst" : '\(.*\)/'` && \
>                mkdir -p blt/$$dir && \
>                case "$$boilerplate" in \
> -               *--) ;; \
> -               *) cp -p $$boilerplate blt/$$dst ;; \
> -               esac || exit; \
> +               *--) continue;; \
> +               esac && \
> +               cp $$boilerplate blt/$$dst && \
> +               if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \
> +               chmod a+$$rx "blt/$$dst" || exit; \
>        done && \
>        date >$@
>
>



-- 
anatol

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-09-11 17:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <3665a1a00809090835g2a8ea4aas6cfa2ebc922f12b2@mail.gmail.com>
2008-09-09 15:41 ` Commit templates are not readable after 'make install' Anatol Pomozov
2008-09-09 19:02 Anatol Pomozov
2008-09-09 19:19 ` Junio C Hamano
2008-09-09 20:18   ` Junio C Hamano
2008-09-10  6:34     ` Johannes Sixt
2008-09-10  7:23       ` Junio C Hamano
2008-09-11 17:21     ` Anatol Pomozov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).