automate-lfs / jhalfs

Tools for running the Linux From Scratch book instructions
http://www.linuxfromscratch.org/alfs/
MIT License
66 stars 14 forks source link

BLFS tools: commands run as root instead of as user #13

Closed pierre-labastie closed 5 years ago

pierre-labastie commented 5 years ago

name: Bug report about: Create a report to help us improve title: 'BLFS tools: commands run as root instead of as user' labels: bug assignees: ''


Describe the bug

Commands without role="root" should be run as user, but sometimes, they are generated inside a sudo -E sh << ROOT_EOF ... ROOT_EOF block.

To Reproduce

Steps to reproduce the behavior:

  1. Install blfs tools, and change to the directory where they are installed
  2. Launch make, and select: Post LFS Configuration and Extra Software---> Security ---> [*] stunnel 5.53
  3. Tick: [*] Build as user [*] Use `porg style' package management
  4. Type q and save configuration. Answer yes to "Are you happy with these settings"
  5. Examine the content of scripts/001-z-stunnel

Expected behavior

The script should contain:

cd $JH_UNPACKDIR

sudo -E sh << ROOT_EOF
groupadd -g 51 stunnel
useradd -c "stunnel Daemon" -d /var/lib/stunnel \\
        -g stunnel -s /bin/false -u 51 stunnel
ROOT_EOF
sed -i '/LDFLAGS.*static_flag/ s/^/#/' configure

Observed behavior

The script contains:

cd $JH_UNPACKDIR

sudo -E sh << ROOT_EOF
groupadd -g 51 stunnel
useradd -c "stunnel Daemon" -d /var/lib/stunnel \\
        -g stunnel -s /bin/false -u 51 stunnel
sed -i '/LDFLAGS.*static_flag/ s/^/#/' configure
ROOT_EOF

Environment Details (please complete the following information):

Additional context

Add any other context about the problem here.

pierre-labastie commented 5 years ago

This happens because the <screen><userinput> is inside a <note>, but we only use: preceding-sibling::screen[not(@role='nodump') and ./userinput][1][not(@role)], so that are excluded...