From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/openrc:openrc-0.11.x commit in: sh/
Date: Mon, 22 Oct 2012 05:15:39 +0000 (UTC) [thread overview]
Message-ID: <1350882747.aa34435cc8c17618facb6e68c8380f0026d79b8e.WilliamH@OpenRC> (raw)
commit: aa34435cc8c17618facb6e68c8380f0026d79b8e
Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
AuthorDate: Thu Oct 11 18:34:20 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Oct 22 05:12:27 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=aa34435c
tmpfilesd: parse arguments with spaces
systemd allows the final arg in tmpfiles to contain spaces. Using the read()
call to set the variables includes all trailing components in $arg so it
doesn't get cut off.
Signed-off-by: Andrew Gregory <andrew.gregory.8 <AT> gmail.com>
---
sh/tmpfiles.sh.in | 32 ++++++++++----------------------
1 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 57cedbe..ae7b7ca 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -253,46 +253,34 @@ for FILE in $tmpfiles_d ; do
# XXX: Upstream says whitespace is NOT permitted in the Path argument.
# But IS allowed when globs are expanded for the x/r/R/z/Z types.
- while read line; do
+ while read cmd path mode uid gid age arg; do
LINENUM=$(( LINENUM+1 ))
- # This will skip over comments and empty lines
- set -- $line
-
# Unless we have both command and path, skip this line.
- if [ -z "$1" -o -z "$2" ]; then
+ if [ -z "$cmd" -o -z "$path" ]; then
continue
fi
# whine about invalid entries
- case $1 in
+ case $cmd in
f|F|w|d|D|p|L|c|b|x|r|R|z|Z) ;;
\#) continue ;;
*) warninvalid ; continue ;;
esac
- cmd=$1
- path=$2
-
# fall back on defaults when parameters are passed as '-'
- if [ "$3" = '-' -o "$3" = '' ]; then
- case ${1} in
+ if [ "$mode" = '-' -o "$mode" = '' ]; then
+ case "$cmd" in
p|f|F) mode=0644 ;;
d|D) mode=0755 ;;
z|Z|x|r|R|L) ;;
esac
- else
- mode=$3
fi
- uid=$4
- gid=$5
- age=$6
- arg=$7
-
- [ "${4}" = '-' -o "${4}" = '' ] && uid=0
- [ "${5}" = '-' -o "${5}" = '' ] && gid=0
- [ "${6}" = '-' -o "${6}" = '' ] && age=0
- [ "${7}" = '-' -o "${7}" = '' ] && arg=''
+
+ [ "$uid" = '-' -o "$uid" = '' ] && uid=0
+ [ "$gid" = '-' -o "$gid" = '' ] && gid=0
+ [ "$age" = '-' -o "$age" = '' ] && age=0
+ [ "$arg" = '-' -o "$arg" = '' ] && arg=''
set -- "$path" "$mode" "$uid" "$gid" "$age" "$arg"
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
next reply other threads:[~2012-10-22 5:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-22 5:15 William Hubbs [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-12-07 16:15 [gentoo-commits] proj/openrc:openrc-0.11.x commit in: sh/ William Hubbs
2012-12-06 23:58 William Hubbs
2012-11-29 23:45 William Hubbs
2012-11-10 21:14 William Hubbs
2012-11-05 21:36 William Hubbs
2012-10-22 5:15 William Hubbs
2012-10-21 19:53 William Hubbs
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=1350882747.aa34435cc8c17618facb6e68c8380f0026d79b8e.WilliamH@OpenRC \
--to=williamh@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.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