Skip to content

Commit

Permalink
Avoid warning on grep 3.8 in hwclock
Browse files Browse the repository at this point in the history
Starting with grep version 3.8, the hwclock init script logs warnings
about stray backslashes:

> hwclock | * Setting system clock using the hardware clock [UTC] ...
> hwclock |grep: warning: stray \ before -
> hwclock |grep: warning: stray \ before -

This is caused by the check for existence of the `--noadjfile` argument
in function `get_noadjfile()`.

Replacing the affected logic with an explicit argument denoting the
pattern as such resolves the issue.

Fixes #548
  • Loading branch information
particleflux authored and vapier committed Sep 7, 2022
1 parent 112b698 commit 9380347
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion init.d/hwclock.in
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ get_noadjfile()
{
if ! yesno $clock_adjfile; then
# Some implementations don't handle adjustments
if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
if LC_ALL=C hwclock --help 2>&1 | grep -q -e "--noadjfile"; then
echo --noadjfile
fi
fi
Expand Down

0 comments on commit 9380347

Please sign in to comment.