misc/164011: comments in rc.conf cause system loading
Коньков Евгений
kes-kes at yandex.ru
Wed Jan 11 10:01:54 UTC 2012
Здравствуйте, Matthew.
Вы писали 11 января 2012 г., 10:00:30:
MS> The following reply was made to PR misc/164011; it has been noted by GNATS.
MS> From: Matthew Story <matthewstory at gmail.com>
MS> To: bug-followup at FreeBSD.org
MS> Cc:
MS> Subject: Re: misc/164011: comments in rc.conf cause system loading
MS> Date: Wed, 11 Jan 2012 02:24:36 -0500
MS> --f46d043c7c941cc30b04b63b8645
MS> Content-Type: text/plain; charset=ISO-8859-1
MS>
MS> On Wed, Jan 11, 2012 at 1:38 AM, Eugen Konkov <kes-kes at yandex.ru> wrote:
MS>
>> >How-To-Repeat:
>> If I put this line All is ok
>> ifconfig_vlan7="inet 10.11.19.149 netmask 255.255.255.248 vlan 7 vlandev
>> re0" #
>> When I do not keep space between " and #
>> ifconfig_vlan7="inet 10.11.19.149 netmask 255.255.255.248 vlan 7 vlandev
>> re0"#
>>
MS> rc.conf uses sh(1) syntax, per the man page:
MS> Options are set with ``name=value'' assignments that use sh(1) syntax.
MS> The following list provides a name and short description for each vari-
MS> able that can be set in the rc.conf file:
MS> (via man 5 rc.conf)
MS>
MS>
MS> A relevant snippit from "The UNIX Programming Environment" below:
MS>
MS> The metacharacter # is almost universally used for shell comments; if a
MS> shell word begins with #, the rest of the lineis ignored:
MS>
MS>
MS> $ echo hello # there
MS>
MS> hello
MS>
MS> $ echo hello#there
MS>
MS> hello#there
#cat test.sh
#!/bin/sh
#All tests expect to SUCCESS
echo "Test 1"
echo ddd # ddd
echo "Test 2"
echo ddd#ddd
echo "Test 3"
echo ddd# ddd
echo "Test 4"
echo ddd #ddd
echo "Test 5"
dddd=""
dddd="ddd" # ddd
echo $dddd
echo "Test 6"
dddd=""
dddd="ddd"#ddd
echo $dddd
#this test FAIL
echo "Test 7"
dddd=""
dddd="ddd"# ddd
echo $dddd
echo "Test 8"
dddd=""
dddd="ddd" #ddd
echo $dddd
#Despite on "Test 2" SUCCESS this "Test 9" FAIL
echo "Test 9"
dddd=""
dddd="ddd"#! ddd
echo $dddd
#Despite on "Test 2" SUCCESS this "Test 10" FAIL
echo "Test 10"
dddd=""
dddd="ddd"#ddd! ddd
echo $dddd
#sh thinks here that 'ddd' in test 8,9,10 is a command
echo "Test 11"
dddd=""
dddd="ddd"#ddd! echo "YYY"
echo $dddd
echo "Test 12"
dddd=""
dddd="ddd"# echo "YYY"
echo $dddd
__END__
Output:
# ./test.sh
Test 1
ddd
Test 2
ddd#ddd
Test 3
ddd# ddd
Test 4
ddd
Test 5
ddd
Test 6
ddd#ddd
Test 7
./test.sh: ddd: not found
Test 8
ddd
Test 9
./test.sh: ddd: not found
Test 10
./test.sh: ddd: not found
Test 11
YYY
Test 12
YYY
--
С уважением,
Коньков mailto:kes-kes at yandex.ru
More information about the freebsd-bugs
mailing list