supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Muhammad Mahendra Subrata <mumahendras3@gmail.com>
To: supervision@list.skarnet.org
Subject: The multisubstitute commands in the run script generated by s6-usertree-maker are in a wrong order
Date: Fri, 22 Jan 2021 15:01:18 +0700	[thread overview]
Message-ID: <719f5399-2d05-d6d0-7377-e4014aab1ac1@gmail.com> (raw)

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!


             reply	other threads:[~2021-01-22  8:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22  8:01 Muhammad Mahendra Subrata [this message]
2021-01-22 10:28 ` Laurent Bercot
2021-01-22 12:54   ` Muhammad Mahendra Subrata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=719f5399-2d05-d6d0-7377-e4014aab1ac1@gmail.com \
    --to=mumahendras3@gmail.com \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).