diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 54db55ff1f..458aed7054 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -3314,12 +3314,6 @@ static int parse_line( *invalid_config = true; return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG), "base64 decoding not supported for symlink targets."); } - - if (!i.argument) { - i.argument = path_join("/usr/share/factory", i.path); - if (!i.argument) - return log_oom(); - } break; case WRITE_FILE: @@ -3428,6 +3422,14 @@ static int parse_line( } switch (i.type) { + case CREATE_SYMLINK: + if (!i.argument) { + i.argument = path_join("/usr/share/factory", i.path); + if (!i.argument) + return log_oom(); + } + break; + case COPY_FILES: if (!i.argument) { i.argument = path_join("/usr/share/factory", i.path); diff --git a/test/units/testsuite-22.15.sh b/test/units/testsuite-22.15.sh new file mode 100755 index 0000000000..6cbb498678 --- /dev/null +++ b/test/units/testsuite-22.15.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Check specifier expansion in L lines. +# +set -eux + +rm -fr /tmp/L +mkdir /tmp/L + +# Check that %h expands to $home. +home='/somewhere' +dst='/tmp/L/1' +src="$home" +HOME="$home" \ +systemd-tmpfiles --create - <