Skip to content

Commit

Permalink
Don't use nonexisting programs
Browse files Browse the repository at this point in the history
/usr/sbin/rpcinfo does not exist, /sbin/rpcinfo is the only alternative
  • Loading branch information
mvidner committed Feb 26, 2019
1 parent 0173791 commit 7a49aa7
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/modules/Nfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -553,20 +553,10 @@ def AutoPackages
# Uses RPC broadcast to mountd.
# @return [Array<String>] a list of hostnames
def ProbeServers
# newer, shinier, better rpcinfo from rpcbind (#450056)
prog_name = "/sbin/rpcinfo"
delim = ""

# fallback from glibc (uses different field separators, grr :( )
# TODO: looks like glibc no longer contain this fallback?
if !FileUtils.Exists(prog_name)
prog_name = "/usr/sbin/rpcinfo"
delim = "-d ' ' "
end

# #71064
# this works also if ICMP broadcasts are ignored
cmd = "#{prog_name} -b mountd 1 | /usr/bin/cut #{delim} -f 2 | /usr/bin/sort -u"
# newer, shinier, better rpcinfo from rpcbind (#450056)
cmd = "/sbin/rpcinfo -b mountd 1 | /usr/bin/cut -f 2 | /usr/bin/sort -u"
out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd))
Ops.get_string(out, "stdout", "").lines.map(&:strip).reject(&:empty?)
end
Expand Down

0 comments on commit 7a49aa7

Please sign in to comment.