threads / discuss / 20448

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

Subject: Problem running 'make install' as root when on mounted fs

## tl;dr

2 messages between Aug 7, 2009 and Aug 7, 2009.

replies: 1people: 2as markdown or json

Alex Blewitt· Aug 7, 2009, 10:08 UTC · lore

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· Aug 7, 2009, 17:51 UTC · re: Alex Blewitt · lore

Re: Problem running 'make install' as root when on mounted fs

Alex Blewitt <alex.blewitt@gmail.com> writes:
Show 6 quoted lines
> 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?

← back to recent threads