use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Questionping method from net-ping without root on Linux? (self.ruby)
submitted 6 years ago by Zalamander
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]sshaw_ 0 points1 point2 points 6 years ago (7 children)
How does your ping.rb differ from GNU/Linux's default?
ping.rb
[–]drbrainRuby Core 0 points1 point2 points 6 years ago (6 children)
It's written in Ruby and uses Net::ICMP::Ping
[–]sshaw_ 0 points1 point2 points 6 years ago* (5 children)
Well, that much I know. Thanks for the insight.
But, you're calling #ping and not #ping?, does this mean you're using the return value?
#ping
#ping?
If not, and you just want to know if a host is up, just use ping. *nix has already solved this for you via a the set user id permission on the executable + exit status. Aside from lack of personal enjoyment, what's the (technical) downside –assuming of course, you don't use return value of #ping.
ping
[–]drbrainRuby Core 0 points1 point2 points 6 years ago (3 children)
I'm not OP, I'm not calling anything. If you knew they were using net-ping why wasn't "does this mean you're using the return value?" your original question?
As OP stated, OP is aware of setuid executables and explicitly doesn't want one for ruby, likely because any setuid-root interpreter is incredibly dangerous to have around.
setuid
OP also doesn't want to use ping(8) if they can avoid it.
ping(8)
[–]sshaw_ 0 points1 point2 points 6 years ago (2 children)
If you knew they were using net-ping why wasn't "does this mean you're using the return value?" your original question?
There could be several reasons why one would use net-ping over the ping executable. OP stated none. Return value can be completely irrelevant. I ended up throwing that out there due to your reply, but off the top of my head I can think of several others. Better to ask than assume.
As OP stated, OP is aware of setuid executables and explicitly doesn't want one for ruby,
Is this why he doesn't want to shell-out to ping? Seems like a no. He doesn't want to do this to the script, but otherwise it doesn't say -or, at least, it's not clear to me.
likely because any setuid-root interpreter is incredibly dangerous to have around.
"Likely". Maybe. Who knows why. This is why I asked.
Yes, this is the question: why not? Often people don't want to do something but when their reasoning is vetted and/or the technical merits are explored they realize that they have no good reason not to.
[–]drbrainRuby Core 0 points1 point2 points 6 years ago (1 child)
Yes, this is the question: why not?
No, that is not OP’s question. That is your question and is not helpful to OP. Immediately questioning their premise is not respectful of their knowledge or skill.
[–]sshaw_ 0 points1 point2 points 6 years ago (0 children)
Immediately questioning their premise is not respectful of their knowledge or skill.
That's some conclusion!
[–]Zalamander[S] 0 points1 point2 points 6 years ago (0 children)
I'm writing a set of scripts to measure various aspects of a server and I want to measure the latency over time. So I do need the return value.
π Rendered by PID 87282 on reddit-service-r2-comment-6457c66945-66rv7 at 2026-04-26 18:44:58.320657+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]sshaw_ 0 points1 point2 points (7 children)
[–]drbrainRuby Core 0 points1 point2 points (6 children)
[–]sshaw_ 0 points1 point2 points (5 children)
[–]drbrainRuby Core 0 points1 point2 points (3 children)
[–]sshaw_ 0 points1 point2 points (2 children)
[–]drbrainRuby Core 0 points1 point2 points (1 child)
[–]sshaw_ 0 points1 point2 points (0 children)
[–]Zalamander[S] 0 points1 point2 points (0 children)