Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hwclock init script logging grep warning #548

Closed
particleflux opened this issue Sep 7, 2022 · 2 comments · Fixed by #549
Closed

hwclock init script logging grep warning #548

particleflux opened this issue Sep 7, 2022 · 2 comments · Fixed by #549

Comments

@particleflux
Copy link
Contributor

With the latest grep (3.8), the hwclock init script throws a warning on start in the logic to detect --noadjfile argument support:

openrc/init.d/hwclock.in

Lines 74 to 75 in 112b698

# Some implementations don't handle adjustments
if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then

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

This seems to have been introduced in grep in this commit: https://git.savannah.gnu.org/cgit/grep.git/commit/?id=e7f8e8eb1fd41b308ee10741bbd8068acc1847c2

I think replacing the affected logic with

grep -q -- "--noadjfile"

should work.

@vapier
Copy link
Member

vapier commented Sep 7, 2022

normally we'd use -e instead of -- for portability. want to send a PR for that ?

@particleflux
Copy link
Contributor Author

Oh, sure, -e makes more sense anyway.

I'll create a PR

particleflux added a commit to particleflux/openrc that referenced this issue Sep 7, 2022
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 OpenRC#548
vapier pushed a commit that referenced this issue Sep 7, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants