# Problem running 'make install' as root when on mounted fs

2 messages from 2009-08-07 to 2009-08-07. Participants: Alex Blewitt, Junio C Hamano.
Thread: https://gitlist.dev/t/20448

## Alex Blewitt, 2009-08-07 10:08

Subject: Problem running 'make install' as root when on mounted fs
Message-ID: <8F9F4A8A-9515-4A7D-90EE-4BD3DA3F7A2B@gmail.com>
URL: https://gitlist.dev/e/8F9F4A8A-9515-4A7D-90EE-4BD3DA3F7A2B%40gmail.com

```
I just tried building and installing Git on Mac OSX. My home directory  
is NFS mounted, to which I have write (but root doesn't).

When I do make, everything compiles OK
When I do sudo make install, I get '/bin/sh: GIT-BUILD-OPTIONS:  
permission denied'

It seems that make install is re-running the GIT-BUILD-OPTIONS target,  
and that tries to write to the current directory. In my case, on an  
NFS mounted home, root doesn't have write permissions to the local dir  
and so the install step fails.

I could build on a local partition (e.g. /tmp) but I'd prefer to have  
the code on my local drive so that I can do a git update and other  
such changes subsequently. I was able to get it to work by removing  
the echo>> from the GIT-BUILD-OPTIONS step after having built the code  
the first time.

The problem basically seems to be:

install: all
all:: ... GIT-BUILD-OPTIONS

I think it would be possible to restrict the GIT-BUILD-OPTIONS to be  
generated during a build phase, so restructuring the Makefile like:

install: build
all:: build GIT-BUILD-OPTIONS
build: ...

would then mean the install phase wouldn't have to touch the GIT-BUILD- 
OPTIONS step.

Does that sound reasonable? I'm happy to test it out and submit a  
patch if people agree (and/or have opinions on what the inner target  
'build' should be called)

Alex

```

## Junio C Hamano, 2009-08-07 17:51

Subject: Re: Problem running 'make install' as root when on mounted fs
Message-ID: <7vbpmr1pin.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbpmr1pin.fsf%40alter.siamese.dyndns.org
In-Reply-To: <8F9F4A8A-9515-4A7D-90EE-4BD3DA3F7A2B@gmail.com>

```
Alex Blewitt <alex.blewitt@gmail.com> writes:

> I think it would be possible to restrict the GIT-BUILD-OPTIONS to be
> generated during a build phase, so restructuring the Makefile like:
>
> install: build
> all:: build GIT-BUILD-OPTIONS
> build: ...

If you did:

	make prefix=$HOME all
        make prefix=/usr install

then the second step needs to notice that the gitexecdir computed and
stored in exec_cmd.o in the first step is now invalid, and needs to
recompile the file.  The whole purpose of GIT-BUILD-OPTIONS is to detect
such a case---doesn't your change defeat it?

```
