https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-03-14T09:22:35ZRuby Issue Tracking SystemRuby master - Feature #8090: resolv.rb checks platform based on RUBY_PLATFORM, which is insufficient for JRubyhttps://bugs.ruby-lang.org/issues/8090?journal_id=375822013-03-14T09:22:35Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Why not try to require 'win32/resolv' and rescue?</p> Ruby master - Feature #8090: resolv.rb checks platform based on RUBY_PLATFORM, which is insufficient for JRubyhttps://bugs.ruby-lang.org/issues/8090?journal_id=375832013-03-14T10:55:30Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>nobu (Nobuyoshi Nakada) wrote:</p>
<blockquote>
<p>Why not try to require 'win32/resolv' and rescue?</p>
</blockquote>
<p>Yep, that works too. The original logic does not do that, so I just expanded on the original condition. I don't have a strong preference for one way versus the other.</p> Ruby master - Feature #8090: resolv.rb checks platform based on RUBY_PLATFORM, which is insufficient for JRubyhttps://bugs.ruby-lang.org/issues/8090?journal_id=375882013-03-14T14:31:37Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>=begin<br>
Because we haven't considered the case (({RUBY_PLATFORM})) means somethings different from CPU and OS.</p>
<p>If you check by (({RbConfig})), (({RUBY_PLATFORM})) is useless, so it should be:</p>
<p>require 'rbconfig' # loaded by rubygems in default<br>
if /mswin|mingw|bccwin/ =~ ::RbConfig::CONFIG['target_os']</p>
<p>You should use '((%target_os%))' to see the running platform.<br>
=end</p> Ruby master - Feature #8090: resolv.rb checks platform based on RUBY_PLATFORM, which is insufficient for JRubyhttps://bugs.ruby-lang.org/issues/8090?journal_id=376302013-03-16T02:01:29Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>I thought host_os is the OS that we're <em>actually</em> running on, and target_os was the OS name Ruby was built for. Was I mistaken?</p>
<p>I like checking RbConfig::CONFIG alone, if we can decide which key to use.</p> Ruby master - Feature #8090: resolv.rb checks platform based on RUBY_PLATFORM, which is insufficient for JRubyhttps://bugs.ruby-lang.org/issues/8090?journal_id=379862013-03-28T16:29:17Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>"host" has meanings when you build a cross-compiler. You build a<br>
compiler on "build" platform, which runs on "host" platform and<br>
generates code for "target" platform. So we don't need "host" almost,<br>
and often we tweaks "target" in configure.in.</p> Ruby master - Feature #8090: resolv.rb checks platform based on RUBY_PLATFORM, which is insufficient for JRubyhttps://bugs.ruby-lang.org/issues/8090?journal_id=379992013-03-28T22:09:13Zjonforums (Jon Forums)
<ul></ul><p>nobu (Nobuyoshi Nakada) wrote:</p>
<blockquote>
<p>"host" has meanings when you build a cross-compiler. You build a<br>
compiler on "build" platform, which runs on "host" platform and<br>
generates code for "target" platform. So we don't need "host" almost,<br>
and often we tweaks "target" in configure.in.</p>
</blockquote>
<p>I have a different interpretation of the following docs, and also believe <code>host_os</code>, not <code>target_os</code> should be used (at runtime) to determine which OS Ruby is running on.</p>
<p><a href="http://sourceware.org/autobook/autobook/autobook_260.html#SEC260" class="external">http://sourceware.org/autobook/autobook/autobook_260.html#SEC260</a><br>
<a href="http://sourceware.org/autobook/autobook/autobook_261.html#SEC261" class="external">http://sourceware.org/autobook/autobook/autobook_261.html#SEC261</a></p> Ruby master - Feature #8090: resolv.rb checks platform based on RUBY_PLATFORM, which is insufficient for JRubyhttps://bugs.ruby-lang.org/issues/8090?journal_id=380052013-03-28T23:11:37Zakr (Akira Tanaka)akr@fsij.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r39988.<br>
Charles, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>lib/resolv.rb: Test Windows platform by detecting LoadError when<br>
require 'win32/resolv' suggested by Nobuyoshi Nakada <a href="/issues/8090">[ruby-core:53389]</a>.<br>
<a href="/issues/8090">[ruby-core:53388]</a> [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: resolv.rb checks platform based on RUBY_PLATFORM, which is insufficient for JRuby (Closed)" href="https://bugs.ruby-lang.org/issues/8090">#8090</a>] Reported by Charles Nutter.</li>
</ul>