Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 328227

Summary: net-misc/dhcpcd-5.2.6: syslog function in dhcpcd-run-hooks breaks with more than two parameters
Product: Gentoo Linux Reporter: Jaco Kroon <jaco>
Component: Current packagesAssignee: William Hubbs <williamh>
Status: RESOLVED UPSTREAM    
Severity: minor CC: base-system, roy
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 312385    
Attachments: 0001-fix-syslog-function.patch

Description Jaco Kroon 2010-07-14 07:34:51 UTC
If one simply does something like

syslog info foo bar

From a dhcp hook it will actually cause an error to be output (and script terminated):

Jul 14 09:10:41 serenity ifplugd(eth0)[1905]: client: /lib/dhcpcd/dhcpcd-run-hooks: line 134: [: uls-dhcp-hook: binary operator expected

Looking at the code this is because $@ is used when testing for a non-empty string, in particular:

if [ -n "$@" ]; then

In the above example this would expand to:

if [ -n "foo" "bar" ]; then

Which is not legal.  I would suggest changing the $@ in that line, as well as two lines down in the actual call to logger to $* which will eliminate the problem.

It's easy enough to work around once you realize what the problem is (don't call syslog with more than two parameters), so the above for example needs to change to:

syslog info "foo bar"

Reproducible: Always
Comment 1 William Hubbs gentoo-dev 2010-08-03 20:54:32 UTC
Created attachment 241323 [details]
0001-fix-syslog-function.patch

This patch should fix the issue.

Roy,

can you please apply this to your git?

Thanks,

William
Comment 2 William Hubbs gentoo-dev 2010-08-03 20:58:56 UTC
Roy,

I have written a patch that should fix this, see the attachment.

Thanks,

William
Comment 4 William Hubbs gentoo-dev 2010-08-04 00:24:09 UTC
This has been fixed in upstream git.

Thanks for the report.