Bug 175105 - /etc/rc.d/* and more: syntax 'return_boolean_cmd && do_cmd_if_true' executed last returns unexpected value
Summary: /etc/rc.d/* and more: syntax 'return_boolean_cmd && do_cmd_if_true' executed ...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 8.3-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-07 15:10 UTC by Tatsuki Makino
Modified: 2018-01-03 05:14 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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