Re: s6-log can create current with 640?

From: Dewayne Geraghty <dewayne.geraghty_at_heuristicsystems.com.au>
Date: Sat, 26 Oct 2019 12:52:39 +1100

On 26/10/2019 4:06 am, Guillermo wrote:
...
> Let me guess: the value of PATH is
> /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin,
> execline's chain loading umask is in /usr/local/bin, and FreeBSD
> happens to have an 'umask' shell script in /usr/bin. If that is
> correct, then you'll have to either use the absolute pathname
> /usr/local/bin/umask in the execlineb chain, or run it with a PATH in
> which /usr/local/bin comes before /usr/bin.
>
> G.
>

Irk! Thank-you Guillermo, your guess is correct.
I'd mistakenly assumed execlineb knew where its friends were; though in
hindsight its a bit much to assume that execlineb internally changes the
PATH.

This works correctly
# rm /tmp/t1 ; setenv PATH
"/usr/local/bin:/bin:/sbin:/usr/sbin:/usr/bin" ; printenv | grep -i path
; ktrace -f /tmp/t1-pathok-umaskfirst \
/usr/local/bin/execlineb -Pc 'export path "/usr/local/bin" umask 033
redirfd -w 1 /tmp/t1 echo hello' ; echo $? ; ls -l /tmp/t1

PATH=/usr/local/bin:/bin:/sbin:/usr/sbin:/usr/bin
0
-rw-r--r-- 1 root wheel 6 26 Oct 11:19 /tmp/t1

as does
/usr/local/bin/execlineb -Pc '/usr/local/bin/umask 033
/usr/local/bin/redirfd -w 1 /tmp/t1 echo hello'

Unfortunately it seems that the path can't be set within execlineb context.

I tried both "path" and "PATH" in the following export and envfile examples.

export

/usr/local/bin/execlineb -Pc '/usr/local/bin/export PATH /usr/local/bin
umask 033 redirfd -w 1 /tmp/t1 echo hello' ; echo $? ; ls -l /tmp/t1
rm: /tmp/t1: No such file or directory
PATH=/bin:/sbin:/usr/sbin:/usr/bin
0
ls: /tmp/t1: No such file or directory

envfile

/usr/local/bin/execlineb -Pc '/usr/local/bin/envfile /tmp/e umask 035
redirfd -w 1 /tmp/t1 echo hello' ; echo $? ; ls -l /tmp/t1
where /tmp/e
path = /usr/local/bin:/bin:/sbin:/usr/sbin:/usr/bin

I've moved the various kdumps into
http://www.heuristicsystems.com/s6-umask/

However I don't think there is a problem with export as
/usr/local/bin/execlineb -Pc 'export T1 /tmp/t1 umask 033 importas T1v
T1 redirfd -w 1 $T1v echo hello'
works correctly, but envfile doesn't; might be worth a look. (?)

Kind regards, Dewayne
Received on Sat Oct 26 2019 - 01:52:39 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC