Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 328227 - net-misc/dhcpcd-5.2.6: syslog function in dhcpcd-run-hooks breaks with more than two parameters
Summary: net-misc/dhcpcd-5.2.6: syslog function in dhcpcd-run-hooks breaks with more t...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 312385
  Show dependency tree
 
Reported: 2010-07-14 07:34 UTC by Jaco Kroon
Modified: 2010-08-04 01:15 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
0001-fix-syslog-function.patch (0001-fix-syslog-function.patch,823 bytes, text/plain)
2010-08-03 20:54 UTC, William Hubbs
Details

Note You need to log in before you can comment on or make changes to this bug.
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.