tup icon indicating copy to clipboard operation
tup copied to clipboard

Refuse to run as root for ldpreload mode.

Open layus opened this issue 7 years ago • 0 comments

Hi,

Tup and ldpreload does not mix with setuid tup installation. This should be detected by Tup to avoid strange errors like this:

$ tup     
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.000s] Reading in new environment variables...
[ tup ] [0.000s] No Tupfiles to parse.
[ tup ] [0.000s] No files to delete.
[ tup ] [0.000s] Executing Commands...
* 1) echo > b       && ls -l b                                                                                                                      
-rw-r--r-- 1 layus users 1 Aug  8 15:17 b
 *** tup errors ***
tup error: Expected to write to file 'b' from cmd 15 but didn't
 *** Command failed due to errors processing the output dependencies.
* 2) echo | tee c   && ls -l c                                                                                                                      

-rw-r--r-- 1 layus users 1 Aug  8 15:17 c
 *** tup errors ***
tup error: Expected to write to file 'c' from cmd 17 but didn't
 *** Command failed due to errors processing the output dependencies.
* 3) touch a        && ls -l a
-rw-r--r-- 1 layus users 0 Aug  8 15:17 a
 *** tup errors ***
tup error: Expected to write to file 'a' from cmd 13 but didn't
 *** Command failed due to errors processing the output dependencies.
 [   ] 100%                                                                                                                                         
 *** tup: 3 jobs failed.
$ ls -l
total 12
-rw-r--r-- 1 layus users 108  8 aoû 15:03 Tupfile
-rw-r--r-- 1 layus users   0  8 aoû 14:15 Tupfile.ini
-rw-r--r-- 1 layus users   0  8 aoû 15:17 a
-rw-r--r-- 1 layus users   1  8 aoû 15:17 b
-rw-r--r-- 1 layus users   1  8 aoû 15:17 c

I did not find the real culprit, but root will not respect LD_PRELOAD. Tup should at least refuse to run as root (or setuid root) when using LD_PRELOAD.

layus avatar Aug 08 '18 13:08 layus