<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 23, 2014 at 8:41 AM, Richard Purdie <span dir="ltr"><<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb adM"><div class="h5">On Wed, 2014-07-23 at 09:49 -0500, Ben Shelton wrote:<br>
> In the commit 'initscripts: save /etc/timestamp with seconds accuracy',<br>
> a bashism was introduced in the bootmisc.sh script in the code to set<br>
> the current date from the stored value in /etc/timestamp. This causes<br>
> that operation to fail with the following message when /bin/sh is not<br>
> bash:<br>
><br>
> /etc/init.d/rc: /etc/rcS.d/S55bootmisc.sh: line 73: syntax error: bad substitution<br>
><br>
> Fixed by using 'cut' (standard under POSIX) rather than bash-specific<br>
> substring expansion.<br>
><br>
> [YOCTO #6566]<br>
><br>
> Signed-off-by: Ben Shelton <<a href="mailto:ben.shelton@ni.com">ben.shelton@ni.com</a>><br>
> Tested-by: Maxin B. John <<a href="mailto:maxin.john@enea.com">maxin.john@enea.com</a>><br>
> ---<br>
> meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh | 5 ++++-<br>
> 1 file changed, 4 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh<br>
> index ccc7f9f..923fa88 100755<br>
> --- a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh<br>
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh<br>
> @@ -70,7 +70,10 @@ then<br>
> read TIMESTAMP < /etc/timestamp<br>
> if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then<br>
> # format the timestamp as date expects it (2m2d2H2M4Y.2S)<br>
> - date -u ${TIMESTAMP:4:8}${TIMESTAMP:0:4}.${TIMESTAMP:(-2)}<br>
> + TS_YR=$(echo $TIMESTAMP | cut -c 1-4)<br>
> + TS_SEC=$(echo $TIMESTAMP | cut -c 13-14)<br>
> + TS_REST=$(echo $TIMESTAMP | cut -c 5-12)<br>
> + date -u ${TS_REST}${TS_YR}.${TS_SEC}<br>
> test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh stop<br>
> fi<br>
> fi<br>
<br>
</div></div>We have tried hard to remove exec/fork/subshell calls from the init<br>
processes since each one does cost quite some time. The above introduces<br>
more than I'm comfortable with. Can we find some other way to do this<br>
please?</blockquote></div><br></div><div class="gmail_extra">Hmm, worst case it looks like a single sed script would do, assuming there's no way to get date -u to be more flexible.<br>-- <br>Christopher Larson<br>clarson at kergoth dot com<br>
Founder - BitBake, OpenEmbedded, OpenZaurus<br>Maintainer - Tslib<br>Senior Software Engineer, Mentor Graphics
</div></div>