larous25 / mupen64plus

Automatically exported from code.google.com/p/mupen64plus
0 stars 0 forks source link

Checking for superuser in Makefile is fragile #401

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Describe your system:
 - Operating System (CRUX 2.7):
 - Machine type (32-bit):
 - Mupen64Plus version: 1.99.4
 - Plugins used: official ones from bundle

Related to #307 #328

source/mupen64plus-core/projects/unix/Makefile relies on /bin/id check. This 
fails if the package is built by the regular user under fakeroot, for 
example[1]. In this case real and effective UID's are both 0, but the user has 
no permission to run ldconfig (and ususlly does not have it in PATH).

The solution is to avoid this step (trivial patch attached) or to use more 
robust check (like having permissions to execute ldconfig).

After installation any package system would run ldconfig anyway.

[1] http://fakeroot.alioth.debian.org/

Original issue reported on code.google.com by fake.mik...@gmail.com on 19 Dec 2010 at 3:02

Attachments:

GoogleCodeExporter commented 8 years ago
This patch will break the install for users who build and install from source.  
Can you suggest a better way to determine if user has permission to execute 
ldconfig?

Original comment by richard...@gmail.com on 29 Dec 2010 at 1:04

GoogleCodeExporter commented 8 years ago
OK, I can't remember many cases users had to run "ldconfig" just after "make 
install" as root. But looking from packager's perspective: the "ldconfig" part 
is run by package manager after an installation step.

We can test for write permissions on "/etc/ld.so.cache", as it is the default 
file touched by "ldconfig", but other systems have their own set of files in 
different locations. Let's just instruct make to ignore possible error on that 
line [1]. AFAIK, it is portable enough feature to stick with it.

[1] http://www.gnu.org/software/make/manual/make.html#Errors

Original comment by fake.mik...@gmail.com on 29 Dec 2010 at 9:44

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the info; I pushed the change.

Original comment by richard...@gmail.com on 29 Dec 2010 at 2:40