Bug 228149 - sysutils/munin-node: share/munin/plugins/ping_ wrong syntax for ping
Summary: sysutils/munin-node: share/munin/plugins/ping_ wrong syntax for ping
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Mathieu Arnold
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-11 09:44 UTC by Niels Bakker
Modified: 2018-05-15 07:38 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (mat)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niels Bakker 2018-05-11 09:44:57 UTC
In this commit:

  https://github.com/munin-monitoring/munin/commit/0c75a5a0e160fba1e6c2853aab2e0753eaeee026#diff-cd846aa800193ea2a91756291de6cabf

the ping program's invocation was changed from ${ping_args2} to ${ping_args2:-}

This works for bash but not for FreeBSD's sh, where this expands to a null argument, leading ping to complain and fail.

Note the extra space below, indicating that echo was invoked with an extra argument:

% /bin/sh -c 'echo foo ${foo:-} bar'
foo  bar

The developer will no doubt have tested this only on Linux:

% /usr/local/bin/bash -c 'echo foo ${foo:-} bar'
foo bar

Possible fixes:

1) revert the relevant part of that commit (I don't see the point for this particular change at all; 'set -u' is not the default nor set in the script)
2) change the script's hashbang to /usr/local/bin/bash (the port already has a dependency on shells/bash)
Comment 1 Mathieu Arnold freebsd_committer freebsd_triage 2018-05-15 07:22:15 UTC
Mmmm, this only happens on 10.4

# sh -c 'echo foo ${foo:-} bar'|od -cb
0000000    f   o   o           b   a   r  \n
          146 157 157 040 040 142 141 162 012

On 11.1 it does not happen:

# sh -c 'echo foo ${foo:-} bar'|od -cb
0000000    f   o   o       b   a   r  \n
          146 157 157 040 142 141 162 012

It seems a bit strange, I'll investigate.
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-05-15 07:38:21 UTC
A commit references this bug:

Author: mat
Date: Tue May 15 07:37:49 UTC 2018
New revision: 469997
URL: https://svnweb.freebsd.org/changeset/ports/469997

Log:
  On FreeBSD 10, sh handles ${foo:-} differently, and creates an empty
  argument, which ping does not like.

  PR:		228149
  Reported by:	Niels Bakker
  Sponsored by:	Absolight

Changes:
  head/sysutils/munin-common/files/patch-plugins_node.d_ping__.in
  head/sysutils/munin-node/Makefile