Bug 2056527

Summary: "%h" doesn't evaluate to home directory
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: systemdAssignee: David Tardon <dtardon>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.5CC: dtardon, jamacku, systemd-maint-list
Target Milestone: rcKeywords: Bugfix, Reproducer, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-239-61.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 10:49:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2056542    

Description Renaud Métrich 2022-02-21 13:13:44 UTC
Description of problem:

From systemd.unit() manpage, %h is supposed to evaluate to home dir:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
       ├──────────┼───────────────────────────────┼───────────────────────────────┤
       │"%h"      │ User home directory           │ This is the home directory of │
       │          │                               │ the user running the service  │
       │          │                               │ manager instance. In case of  │
       │          │                               │ the system manager this       │
       │          │                               │ resolves to "/root".          │
       ├──────────┼───────────────────────────────┼───────────────────────────────┤
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Unfortunately this doesn't work, "%h" always evaluates to "/", as shown in the example below:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# systemctl cat test
# /etc/systemd/system/test.service
[Service]
ExecStart=/bin/echo "%%h evaluates to %h"

# systemctl start test

# systemctl status test
[...]
[...] echo[1413]: %h evaluates to /
[...]
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Version-Release number of selected component (if applicable):

systemd-239-51

How reproducible:

Always, see above.

Comment 2 Plumber Bot 2022-07-07 14:28:32 UTC
fix merged to github master branch -> https://github.com/redhat-plumbers/systemd-rhel8/pull/263

Comment 8 errata-xmlrpc 2022-11-08 10:49:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (systemd bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7727