conf/175105: /etc/rc.d/* and more: syntax 'return_boolean_cmd && do_cmd_if_true' executed last returns unexpected value

Tatsuki Makino tatsuki_makino at hotmail.com
Mon Jan 7 15:10:01 UTC 2013


>Number:         175105
>Category:       conf
>Synopsis:       /etc/rc.d/* and more: syntax 'return_boolean_cmd && do_cmd_if_true' executed last returns unexpected value
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 07 15:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Tatsuki Makino
>Release:        FreeBSD 8.3-STABLE i386
>Organization:
>Environment:
FreeBSD T2.test 8.3-STABLE FreeBSD 8.3-STABLE #0 r245032M: Fri Jan  4 07:36:05 UTC 2013     root at T2.test:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
If the shell script that has 'false && true' line, $? set not 0. If that line execute last, then shell script returns not 0.

sub probrem: conf/175006
>How-To-Repeat:
# echo 'ip6addrctl_verbose="NO"' >> /etc/rc.conf
# /etc/rc.d/ip6addrctl start
# echo $?

# echo 'sysvipc_enable="NO"' >> /etc/rc.conf
# echo 'linux_enable="NO"' >> /etc/rc.conf
# echo 'svr4_enable="NO"' >> /etc/rc.conf
# /etc/rc.d/abi start
# echo $?
>Fix:
1. Use `if' syntax.

if checkyesno foo ; then
  do_foo
fi

1. Execute `true' if false

checkyesno foo && do_foo || true

# If we need result of do_foo
! checkyesno foo && true || do_foo

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list