supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* The multisubstitute commands in the run script generated by s6-usertree-maker are in a wrong order
@ 2021-01-22  8:01 Muhammad Mahendra Subrata
  2021-01-22 10:28 ` Laurent Bercot
  0 siblings, 1 reply; 3+ messages in thread
From: Muhammad Mahendra Subrata @ 2021-01-22  8:01 UTC (permalink / raw)
  To: supervision

Hello everyone,

I'm using skalibs-2.10.0.0, execline-2.7.0.0, and s6-2.10.0.0 here in my 
system. I tried using the s6-usertree-maker with below invocation:

     s6-usertree-maker -E /etc/user-env -e XDG_RUNTIME_DIR user 
/var/log/user-subtree /tmp/user-subtree

Below is the generated run script:

     #!/bin/execlineb -P
     fdmove -c 2 1
     emptyenv -p
     export USER "user"
     s6-envuidgid -i -- "user"
     s6-applyuidgid -U --
     backtick -in HOME { homeof "user" }
     s6-envdir -i -- "/etc/user-env"
     multisubstitute
     {
       importas -i USER USER
       importas -i HOME HOME
       importas -i UID UID
       importas -i GID GID
       importas -i GIDLIST GIDLIST
     }
     multisubstitute
     {
       importas -D "" -- "XDG_RUNTIME_DIR" "XDG_RUNTIME_DIR"
     }
     export "XDG_RUNTIME_DIR" ${"XDG_RUNTIME_DIR"}
     export PATH "/usr/bin:/bin"
     s6-svscan -d3 -- "${HOME}/service"

As shown above, the multisubstitute command that contains 
XDG_RUNTIME_DIR is put after the one that contains USER, HOME, UID, GID, 
and GIDLIST. If for example XDG_RUNTIME_DIR=/run/user/$UID, the $UID 
here will not be substituted with the user's UID since by the time $UID 
is substituted, $XDG_RUNTIME_DIR hasn't been substituted yet. So perhaps 
the order of these two multisubstitute should be inverted.

I was hit by this problem when trying to use it on my system, where I 
found XDG_DATA_HOME was still set to ${HOME}/.local/share (i.e. the 
${HOME} was not substituted with the path to my home directory).

Has anyone encountered this too? Or perhaps I'm just doing things 
incorrectly?

Thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: The multisubstitute commands in the run script generated by s6-usertree-maker are in a wrong order
  2021-01-22  8:01 The multisubstitute commands in the run script generated by s6-usertree-maker are in a wrong order Muhammad Mahendra Subrata
@ 2021-01-22 10:28 ` Laurent Bercot
  2021-01-22 12:54   ` Muhammad Mahendra Subrata
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Bercot @ 2021-01-22 10:28 UTC (permalink / raw)
  To: Muhammad Mahendra Subrata, supervision

>As shown above, the multisubstitute command that contains XDG_RUNTIME_DIR is put after the one that contains USER, HOME, UID, GID, and GIDLIST. If for example XDG_RUNTIME_DIR=/run/user/$UID, the $UID here will not be substituted with the user's UID since by the time $UID is substituted, $XDG_RUNTIME_DIR hasn't been substituted yet. So perhaps the order of these two multisubstitute should be inverted.

  You're right, of course. I remember testing it, and it *working*, so
I did not think any further, but in retrospect it appears my test was
incorrect.
  Thanks for the report! Fixed in git head.

  I'll give it the week-end, in case more bug-reports come in, then
I'll release 2.10.0.1.

  Note that skalibs-2.10.0.1 is out already, it fixes a bug that
manifests in execline's 'emptyenv -c' command.

--
  Laurent


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: The multisubstitute commands in the run script generated by s6-usertree-maker are in a wrong order
  2021-01-22 10:28 ` Laurent Bercot
@ 2021-01-22 12:54   ` Muhammad Mahendra Subrata
  0 siblings, 0 replies; 3+ messages in thread
From: Muhammad Mahendra Subrata @ 2021-01-22 12:54 UTC (permalink / raw)
  To: Laurent Bercot; +Cc: supervision

[-- Attachment #1: Type: text/plain, Size: 963 bytes --]

Great, thanks!

MMS

On Fri, Jan 22, 2021, 17:28 Laurent Bercot <ska-supervision@skarnet.org>
wrote:

> >As shown above, the multisubstitute command that contains XDG_RUNTIME_DIR
> is put after the one that contains USER, HOME, UID, GID, and GIDLIST. If
> for example XDG_RUNTIME_DIR=/run/user/$UID, the $UID here will not be
> substituted with the user's UID since by the time $UID is substituted,
> $XDG_RUNTIME_DIR hasn't been substituted yet. So perhaps the order of these
> two multisubstitute should be inverted.
>
>   You're right, of course. I remember testing it, and it *working*, so
> I did not think any further, but in retrospect it appears my test was
> incorrect.
>   Thanks for the report! Fixed in git head.
>
>   I'll give it the week-end, in case more bug-reports come in, then
> I'll release 2.10.0.1.
>
>   Note that skalibs-2.10.0.1 is out already, it fixes a bug that
> manifests in execline's 'emptyenv -c' command.
>
> --
>   Laurent
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-22 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22  8:01 The multisubstitute commands in the run script generated by s6-usertree-maker are in a wrong order Muhammad Mahendra Subrata
2021-01-22 10:28 ` Laurent Bercot
2021-01-22 12:54   ` Muhammad Mahendra Subrata

supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/supervision

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 supervision supervision/ http://inbox.vuxu.org/supervision \
		subscribe@list.skarnet.org
	public-inbox-index supervision

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.supervision.general


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git