Bug 175105

Summary: /etc/rc.d/* and more: syntax 'return_boolean_cmd && do_cmd_if_true' executed last returns unexpected value
Product: Base System Reporter: Tatsuki Makino <tatsuki_makino>
Component: confAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me    
Priority: Normal    
Version: 8.3-STABLE   
Hardware: Any   
OS: Any   

Description Tatsuki Makino 2013-01-07 15:10:00 UTC
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

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
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 $?
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-01-08 04:40:41 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:56 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped