FreeBSD Bugzilla – Attachment 152120 Details for
Bug 197064
rc.subr: ${name}_user and ${name}_nice don't work with ${name}_flags that include quote
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
test script
test (text/plain), 1.75 KB, created by
Tatsuki Makino
on 2015-01-25 08:28:14 UTC
(
hide
)
Description:
test script
Filename:
MIME Type:
Creator:
Tatsuki Makino
Created:
2015-01-25 08:28:14 UTC
Size:
1.75 KB
patch
obsolete
>#!/bin/sh > ># PROVIDE: test ># REQUIRE: FILESYSTEMS NETWORKING SERVERS DAEMON LOGIN ># REQUIRE: mountcritlocal ># KEYWORD: shutdown > >. /etc/rc.subr > >name='test' >desc='test' >rcvar='test_enable' > >command='/bin/echo' >procname="${command}" > >: "${test_enable=NO}" > >start_cmd='test_cmd' >stop_cmd=':' > >test_sh_escape() >{ > for s ; do > echo "$s" | sed -e 's/\([][ '\''`";&<>()|*?{}\$!#^~]\)/\\\1/g' > done >} > >test_sh_q_escape() >{ > for s ; do > echo "$s" | sed -e 's/\(['\'']\)/\1\\\1\1/g' > done >} > >test_sh_qq_escape() >{ > for s ; do > echo "$s" | sed -e 's/\([`"\$]\)/\\\1/g' > done >} > >test_cmd() >{ > # Perhaps, this function is the same behavior as default operation on run_rc_command. > > set -x > _doit= > > case "${rc_arg}" in > start) > _doit="$command $rc_flags $command_args" > if [ -n "$_chroot" ] ; then > _doit="\ >${_nice:+nice -n $_nice }\ >${_fib:+setfib -F $_fib }\ >chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ >$_chroot $_doit" > else > _doit="\ >${_chdir:+cd $_chdir && }\ >${_fib:+setfib -F $_fib }\ >$_doit" > if [ -n "$_user" ] ; then > # use double quote to -c of su because su -c is likely to execute by csh (root's login shell). > # it will be easy to quote. > _doit="su -m $_user -c \"sh -c '$(test_sh_qq_escape "$(test_sh_q_escape "$_doit")")'\"" > fi > if [ -n "$_nice" ] ; then > if [ -z "$_user" ] ; then > _doit="sh -c '$(test_sh_q_escape "$_doit")'" # case single quote > #_doit="sh -c $(test_sh_escape "$_doit")" # case without quote > fi > _doit="nice -n $_nice $_doit" > fi > fi > ;; > esac > > if ! _run_rc_doit "${_doit}" ; then > set +x > warn "failed to start ${name}" > return 1 > fi > > set +x > > return 0 >} > >load_rc_config "${name}" > ># /etc/rc.conf >test_nice="5" >#test_user="nobody" >test_flags="\"test test\"" > >run_rc_command "${1}"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 197064
: 152120