[OpenWrt-Devel] [PATCH] base-files: For sysfixtime use hwclock if RTC available

Daniel Dickinson openwrt at daniel.thecshore.com
Mon Jan 11 05:14:18 EST 2016


I did one other test I hadn't thought of originally:

#!/bin/sh

set -e

/bin/false && /bin/false

echo "not killed"

displays "not killed", so there still the issue that unlike if..then 
with set -e, && fails to exit on error condition (for the purposes of 
set -e it's like there is an implicit || /bin/true (really the exit 
status just gets ignored for an AND-OR list in POSIX terms)).

Regards,

Daniel

On 11/01/16 03:30 AM, Daniel Curran-Dickinson wrote:
> Actually I must have been smoking something when I thought I saw that
> problem (and no I don't actually).  I think it must have been in
> combination with some other error that I misremembered.
>
> I just check both bash and ash (and the docs) and they 'do the right
> thing'.
>
> Regards,
>
> Daniel
>
> On 11/01/16 03:19 AM, Daniel Dickinson wrote:
>> Hi,
>>
>> On 10/01/16 06:42 AM, bittorf wireless )) Bastian Bittorf wrote:
>>>> +
>>>> +start() {
>>>> +    if [ -e /dev/rtc ]; then
>>>> +        hwclock -s
>>>
>>> please use the short form [ -e /dev/rtc ] && ...
>>>
>>
>> Per private mail I've learned this is the current codebase standard, so
>> will follow that, but the reason I tend to prefer the if..then is that
>> if..then has the correct semantics when using set -e (that is causes
>> termination on error, but not under normal operation) whereas [ xx ] &&
>> yy is not set -e safe and simply adding || true results in error
>> conditions not being detected, so it is actually doing the wrong thing
>> if you use set -e (unless the initial condition being false is an error
>> and not just normal operation).
>>
>> Regards,
>>
>> Daniel
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list