<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 12/19/2012 12:39 PM, harold seigel
      wrote:<br>
    </div>
    <blockquote cite="mid:50D1FBD1.3000504@oracle.com" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      &gt;&gt; <span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p></o:p></span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I
        say file the bug merely to document the issue and get this code
        checked in</span><br>
      I agree.<br>
    </blockquote>
    <br>
    Harold, Thank you for looking at this change closely.<br>
    Dan, please file a bug about the fake path and include this writeup
    below, because I think I hit this bug with testing CDS with the
    gamma launcher and it might explain it.<br>
    Thanks,<br>
    Coleen<br>
    <br>
    <blockquote cite="mid:50D1FBD1.3000504@oracle.com" type="cite"> <br>
      Harold<br>
      <br>
      On 12/19/2012 12:11 PM, Ron Durbin wrote:
      <blockquote
        cite="mid:684945f3-4869-4674-bf17-74193ff9ffa7@default"
        type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=ISO-8859-1">
        <meta name="Generator" content="Microsoft Word 12 (filtered
          medium)">
        <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New","serif";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
span.changed
        {mso-style-name:changed;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle24
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle25
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle26
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle27
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle28
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
        <div class="WordSection1">
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Harold<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I
              would say first off this is not a bug that has manifested
              itself yet.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">So

              it is low priority.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">That

              being said this exposure is not introduced or made more
              risky by my changes.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">This

              is the only issue that we have against this code review
              and it does not belong to the changes being reviewed=.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I
              say file the bug merely to document the issue and get this
              code checked in.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Ron<o:p></o:p></span></p>
          <div>
            <div style="border:none;border-top:solid #B5C4DF
              1.0pt;padding:3.0pt 0in 0in 0in">
              <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">
                  Daniel D. Daugherty <br>
                  <b>Sent:</b> Wednesday, December 19, 2012 9:30 AM<br>
                  <b>To:</b> <a moz-do-not-send="true"
                    class="moz-txt-link-abbreviated"
                    href="mailto:hotspot-runtime-dev@openjdk.java.net">hotspot-runtime-dev@openjdk.java.net</a>;
                  build-dev; <a moz-do-not-send="true"
                    class="moz-txt-link-abbreviated"
                    href="mailto:serviceability-dev@openjdk.java.net">serviceability-dev@openjdk.java.net</a><br>
                  <b>Subject:</b> Re: Code Review fix for 8005044 remove
                  crufty '_g' support from HS runtime code<o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
          <p class="MsoNormal"><tt><span style="font-size:10.0pt">Adding
                the other aliases back in...</span></tt><span
              style="font-size:10.0pt;font-family:&quot;Courier
              New&quot;,&quot;serif&quot;"><br>
              <br>
              <tt>Harold,</tt><br>
              <br>
              <tt>This question:</tt><br>
              <br>
              <tt>&gt; Another nit: Is it worth checking that all of</tt><br>
              <tt>&gt; "/hotspot/libjvm.so"&nbsp;could get copied to buf?
                (i.e.:&nbsp; that</tt><br>
              <tt>&gt; buflen-len &gt; strlen("/hotspot/libjvm.so")</tt><br>
              <br>
              <tt>is straight forward and the short answer is: yes, that</tt><br>
              <tt>code makes assumptions that "/hotspot/libjvm.so" will</tt><br>
              <tt>fit into 'buf'. It should not do that.</tt><br>
              <br>
              <tt>It is Ron's call as to whether he wants to fix this
                existing</tt><br>
              <tt>bug as part of this work. It is easy enough to fix the
                obvious</tt><br>
              <tt>part of the bug, but... as is normal with HotSpot,
                there</tt><br>
              <tt>is more going on here than meets the eye...</tt><br>
              <br>
              <tt>The slightly longer answer is that it probably doesn't</tt><br>
              <tt>matter because the path being created here is a fake.</tt><br>
              <tt>As long as the "/hotspot/l" part gets copied, then the</tt><br>
              <tt>callers of os::jvm_path() will be able to handle the</tt><br>
              <tt>fakery.</tt><br>
              <br>
              <tt>Of course, there is an even longer answer. Read on if</tt><br>
              <tt>you want gory details (and a history lesson).</tt><br>
              <br>
              <tt>This gamma launcher stuff is giving me an absolute
                headache.</tt><br>
              <tt>Unfortunately, there is a lot of history involved
                here...</tt><br>
              <br>
              <tt>Here are the variations:</tt><br>
              <br>
              <tt>src/os/bsd/vm/os_bsd.cpp:</tt><br>
              <br>
              <tt>&nbsp;&nbsp; 1715&nbsp;&nbsp; if (Arguments::created_by_gamma_launcher())
                {</tt><br>
              <tt>&nbsp;&nbsp; 1716&nbsp;&nbsp;&nbsp;&nbsp; // Support for the gamma launcher.&nbsp;
                Typical value for buf is</tt><br>
              <tt>&nbsp;&nbsp; 1717&nbsp;&nbsp;&nbsp;&nbsp; //
                "&lt;JAVA_HOME&gt;/jre/lib/&lt;arch&gt;/&lt;vmtype&gt;/libjvm".&nbsp;
                If "/jre/lib/" appears at</tt><br>
              <tt>&nbsp;&nbsp; 1718&nbsp;&nbsp;&nbsp;&nbsp; // the right place in the string, then
                assume we are installed in a JDK and</tt><br>
              <tt>&nbsp;&nbsp; 1719&nbsp;&nbsp;&nbsp;&nbsp; // we're done.&nbsp; Otherwise, check for a
                JAVA_HOME environment variable and</tt><br>
              <tt>&nbsp;&nbsp; 1720&nbsp;&nbsp;&nbsp;&nbsp; // construct a path to the JVM being
                overridden.</tt><br>
              <br>
              <tt>&lt;snip&gt;</tt><br>
              <br>
              <tt>&nbsp;&nbsp; 1762&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // If the path exists within
                JAVA_HOME, add the JVM library name</tt><br>
              <tt>&nbsp;&nbsp; 1763&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // to complete the path to JVM being
                overridden.&nbsp; Otherwise fallback</tt><br>
              <tt>&nbsp;&nbsp; 1764&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // to the path to the current library.</tt><br>
              <tt>&nbsp;&nbsp; 1765&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (0 == access(buf, F_OK)) {</tt><br>
              <tt>&nbsp;&nbsp; 1766&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Use current module name "libjvm"</tt><br>
              <tt>&nbsp;&nbsp; 1767&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; len = strlen(buf);</tt><br>
              <tt>&nbsp;&nbsp; 1768&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; snprintf(buf + len, buflen-len,
                "/libjvm%s", JNI_LIB_SUFFIX);</tt><br>
              <tt>&nbsp;&nbsp; 1769&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {</tt><br>
              <tt>&nbsp;&nbsp; 1770&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Fall back to path of current
                library</tt><br>
              <tt>&nbsp;&nbsp; 1771&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rp = realpath(dli_fname, buf);</tt><br>
              <tt>&nbsp;&nbsp; 1772&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (rp == NULL)</tt><br>
              <tt>&nbsp;&nbsp; 1773&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</tt><br>
              <tt>&nbsp;&nbsp; 1774&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</tt><br>
              <br>
              <tt>src/os/linux/vm/os_linux.cpp:</tt><br>
              <br>
              <tt>&nbsp;&nbsp; 2206&nbsp;&nbsp; if (Arguments::created_by_gamma_launcher())
                {</tt><br>
              <tt>&nbsp;&nbsp; 2207&nbsp;&nbsp;&nbsp;&nbsp; // Support for the gamma launcher.&nbsp;
                Typical value for buf is</tt><br>
              <tt>&nbsp;&nbsp; 2208&nbsp;&nbsp;&nbsp;&nbsp; //
                "&lt;JAVA_HOME&gt;/jre/lib/&lt;arch&gt;/&lt;vmtype&gt;/libjvm.so".&nbsp;
                If "/jre/lib/" appears at</tt><br>
              <tt>&nbsp;&nbsp; 2209&nbsp;&nbsp;&nbsp;&nbsp; // the right place in the string, then
                assume we are installed in a JDK and</tt><br>
              <tt>&nbsp;&nbsp; 2210&nbsp;&nbsp;&nbsp;&nbsp; // we're done.&nbsp; Otherwise, check for a
                JAVA_HOME environment variable and fix&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </tt><br>
              <tt>&nbsp;&nbsp; 2211&nbsp;&nbsp;&nbsp;&nbsp; // up the path so it looks like libjvm.so
                is installed there (append a</tt><br>
              <tt>&nbsp;&nbsp; 2212&nbsp;&nbsp;&nbsp;&nbsp; // fake suffix hotspot/libjvm.so).</tt><br>
              <br>
              <tt>&lt;snip&gt;</tt><br>
              <br>
              <tt>&nbsp;&nbsp; 2243&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (0 == access(buf, F_OK)) {</tt><br>
              <tt>&nbsp;&nbsp; 2244&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Use current module name
                "libjvm.so"</tt><br>
              <tt>&nbsp;&nbsp; 2245&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; len = strlen(buf);</tt><br>
              <tt>&nbsp;&nbsp; 2246&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; snprintf(buf + len, buflen-len,
                "/hotspot/libjvm.so");</tt><br>
              <tt>&nbsp;&nbsp; 2247&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {</tt><br>
              <tt>&nbsp;&nbsp; 2248&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Go back to path of .so</tt><br>
              <tt>&nbsp;&nbsp; 2249&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rp = realpath(dli_fname, buf);</tt><br>
              <tt>&nbsp;&nbsp; 2250&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (rp == NULL)</tt><br>
              <tt>&nbsp;&nbsp; 2251&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</tt><br>
              <tt>&nbsp;&nbsp; 2252&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</tt><br>
              <br>
              <tt>src/os/solaris/vm/os_solaris.cpp:</tt><br>
              <br>
              <tt>&nbsp;&nbsp; 2496&nbsp;&nbsp; if (Arguments::created_by_gamma_launcher())
                {</tt><br>
              <tt>&nbsp;&nbsp; 2497&nbsp;&nbsp;&nbsp;&nbsp; // Support for the gamma launcher.&nbsp;
                Typical value for buf is</tt><br>
              <tt>&nbsp;&nbsp; 2498&nbsp;&nbsp;&nbsp;&nbsp; //
                "&lt;JAVA_HOME&gt;/jre/lib/&lt;arch&gt;/&lt;vmtype&gt;/libjvm.so".&nbsp;
                If "/jre/lib/" appears at</tt><br>
              <tt>&nbsp;&nbsp; 2499&nbsp;&nbsp;&nbsp;&nbsp; // the right place in the string, then
                assume we are installed in a JDK and</tt><br>
              <tt>&nbsp;&nbsp; 2500&nbsp;&nbsp;&nbsp;&nbsp; // we're done.&nbsp; Otherwise, check for a
                JAVA_HOME environment variable and fix</tt><br>
              <tt>&nbsp;&nbsp; 2501&nbsp;&nbsp;&nbsp;&nbsp; // up the path so it looks like libjvm.so
                is installed there (append a</tt><br>
              <tt>&nbsp;&nbsp; 2502&nbsp;&nbsp;&nbsp;&nbsp; // fake suffix hotspot/libjvm.so).</tt><br>
              <br>
              <tt>&lt;snip&gt;</tt><br>
              <br>
              <tt>&nbsp;&nbsp; 2539&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (0 == access(buf, F_OK)) {</tt><br>
              <tt>&nbsp;&nbsp; 2540&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Use current module name
                "libjvm.so"</tt><br>
              <tt>&nbsp;&nbsp; 2541&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; len = strlen(buf);</tt><br>
              <tt>&nbsp;&nbsp; 2542&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; snprintf(buf + len, buflen-len,
                "/hotspot/libjvm.so");</tt><br>
              <tt>&nbsp;&nbsp; 2543&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {</tt><br>
              <tt>&nbsp;&nbsp; 2544&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Go back to path of .so</tt><br>
              <tt>&nbsp;&nbsp; 2545&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; realpath((char *)dlinfo.dli_fname,
                buf);</tt><br>
              <tt>&nbsp;&nbsp; 2546&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</tt><br>
              <br>
              <tt>src/os/windows/vm/os_windows.cpp:</tt><br>
              <br>
              <tt>&nbsp;&nbsp; 1732&nbsp;&nbsp; buf[0] = '\0';</tt><br>
              <tt>&nbsp;&nbsp; 1733&nbsp;&nbsp; if (Arguments::created_by_gamma_launcher())
                {</tt><br>
              <tt>&nbsp;&nbsp; 1734&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Support for the gamma launcher. Check
                for an</tt><br>
              <tt>&nbsp;&nbsp; 1735&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // JAVA_HOME environment variable</tt><br>
              <tt>&nbsp;&nbsp; 1736&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // and fix up the path so it looks like</tt><br>
              <tt>&nbsp;&nbsp; 1737&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // libjvm.so is installed there (append a
                fake suffix</tt><br>
              <tt>&nbsp;&nbsp; 1738&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // hotspot/libjvm.so).</tt><br>
              <tt>&nbsp;&nbsp; 1739&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char* java_home_var =
                ::getenv("JAVA_HOME");</tt><br>
              <tt>&nbsp;&nbsp; 1740&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (java_home_var != NULL &amp;&amp;
                java_home_var[0] != 0) {</tt><br>
              <tt>&nbsp;&nbsp; 1741 </tt><br>
              <tt>&nbsp;&nbsp; 1742&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strncpy(buf, java_home_var, buflen);</tt><br>
              <tt>&nbsp;&nbsp; 1743 </tt><br>
              <tt>&nbsp;&nbsp; 1744&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // determine if this is a legacy image
                or modules image</tt><br>
              <tt>&nbsp;&nbsp; 1745&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // modules image doesn't have "jre"
                subdirectory</tt><br>
              <tt>&nbsp;&nbsp; 1746&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size_t len = strlen(buf);</tt><br>
              <tt>&nbsp;&nbsp; 1747&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char* jrebin_p = buf + len;</tt><br>
              <tt>&nbsp;&nbsp; 1748&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jio_snprintf(jrebin_p, buflen-len, "<a
                  moz-do-not-send="true"
                  href="file:///%5C%5Cjre%5Cbin%5C">\\jre\\bin\\</a>");</tt><br>
              <tt>&nbsp;&nbsp; 1749&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (0 != _access(buf, 0)) {</tt><br>
              <tt>&nbsp;&nbsp; 1750&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jio_snprintf(jrebin_p, buflen-len, "<a
                  moz-do-not-send="true" href="file:///%5C%5Cbin%5C">\\bin\\</a>");</tt><br>
              <tt>&nbsp;&nbsp; 1751&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</tt><br>
              <tt>&nbsp;&nbsp; 1752&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; len = strlen(buf);</tt><br>
              <tt>&nbsp;&nbsp; 1753&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jio_snprintf(buf + len, buflen-len,
                "hotspot\\jvm.dll");</tt><br>
              <tt>&nbsp;&nbsp; 1754&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</tt><br>
              <tt>&nbsp;&nbsp; 1755&nbsp;&nbsp; }</tt><br>
              <br>
              <br>
              <tt>Linux, Solaris and Windows all recognize that if they</tt><br>
              <tt>get to the point where they are appending a
                "hotspot/..."</tt><br>
              <tt>path to the jvm_path value, then they are making a
                fake</tt><br>
              <tt>path. Why are they making a fake path? Well, the gamma</tt><br>
              <tt>launcher lets someone use a libjvm.so/jvm.dll that is</tt><br>
              <tt>not located in the usual place in a JDK. And, you get</tt><br>
              <tt>to use that libjvm.so/jvm.dll WITH THAT JDK. Sounds</tt><br>
              <tt>pretty cool and it is pretty cool... until you realize</tt><br>
              <tt>that there is code in the VM that tries to find other</tt><br>
              <tt>libraries _relative_ to the libjvm.so/jvm.dll that is</tt><br>
              <tt>running. Ouch! So enter the above code blocks that
                fake</tt><br>
              <tt>a path to the libjvm.so/jvm.dll so that callers to</tt><br>
              <tt>os::jvm_path() don't get confused.</tt><br>
              <br>
              <tt>To make matters more convoluted... yes, I know this is</tt><br>
              <tt>convoluted enough... The os_bsd.cpp doesn't seem to</tt><br>
              <tt>realize that it is creating a fake path here. At one</tt><br>
              <tt>point, the os_bsd.cpp code was a copy of os_linux.cpp</tt><br>
              <tt>code, but it was obviously tweaked. It will take more</tt><br>
              <tt>investigation to figure out the right course of action</tt><br>
              <tt>for os_bsd.cpp</tt><br>
              <br>
              <tt>Dan</tt><br>
              <br>
              <br>
              <br>
            </span>On 12/19/12 7:51 AM, harold seigel wrote:<br>
            <br>
            <o:p></o:p></p>
          <p class="MsoNormal">Hi Ron,<br>
            <br>
            I'm ok with using snprinft().<br>
            <br>
            Another nit: Is it worth checking that all of
            "/hotspot/libjvm.so" could get copied to buf?&nbsp; (i.e.:&nbsp; that
            buflen-len &gt; strlen("/hotspot/libjvm.so")<br>
            <br>
            Thanks, Harold<br>
            <br>
            On 12/19/2012 9:17 AM, Ron Durbin wrote: <o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Harold,</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Did

              you have any more points or counter points to make on the
              use of snprintf and strncpy ?</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Ron</span><o:p></o:p></p>
          <div>
            <div style="border:none;border-top:solid #B5C4DF
              1.0pt;padding:3.0pt 0in 0in 0in">
              <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">
                  Ron Durbin <br>
                  <b>Sent:</b> Tuesday, December 18, 2012 4:50 PM<br>
                  <b>To:</b> Daniel Daugherty; <a
                    moz-do-not-send="true"
                    href="mailto:hotspot-runtime-dev@openjdk.java.net">hotspot-runtime-dev@openjdk.java.net</a>;
                  build-dev; <a moz-do-not-send="true"
                    href="mailto:serviceability-dev@openjdk.java.net">serviceability-dev@openjdk.java.net</a><br>
                  <b>Subject:</b> RE: Code Review fix for 8005044 remove
                  crufty '_g' support from HS runtime code</span><o:p></o:p></p>
            </div>
          </div>
          <p class="MsoNormal">&nbsp;<o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Thanks

              for the quick reviews by all.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I
              will agree with Dan on this one, sprint will stay.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Ron</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
          <div>
            <div style="border:none;border-top:solid #B5C4DF
              1.0pt;padding:3.0pt 0in 0in 0in">
              <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">
                  Daniel D. Daugherty <br>
                  <b>Sent:</b> Tuesday, December 18, 2012 4:03 PM<br>
                  <b>To:</b> <a moz-do-not-send="true"
                    href="mailto:hotspot-runtime-dev@openjdk.java.net">hotspot-runtime-dev@openjdk.java.net</a>;
                  build-dev; <a moz-do-not-send="true"
                    href="mailto:serviceability-dev@openjdk.java.net">serviceability-dev@openjdk.java.net</a><br>
                  <b>Subject:</b> Re: Code Review fix for 8005044 remove
                  crufty '_g' support from HS runtime code</span><o:p></o:p></p>
            </div>
          </div>
          <p class="MsoNormal">&nbsp;<o:p></o:p></p>
          <p class="MsoNormal" style="margin-bottom:12.0pt"><tt><span
                style="font-size:10.0pt">Sorry, I lost my manners
                somewhere... :-(</span></tt><span
              style="font-size:10.0pt;font-family:&quot;Courier
              New&quot;,&quot;serif&quot;"><br>
              <br>
              <tt>Thanks for the fast review!</tt><br>
              <br>
              <tt>Dan</tt></span><o:p></o:p></p>
          <div>
            <p class="MsoNormal">On 12/18/12 3:57 PM, Daniel D.
              Daugherty wrote:<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal" style="margin-bottom:12.0pt"><tt><span
                  style="font-size:10.0pt">Adding back in the other
                  aliases...</span></tt><span
                style="font-size:10.0pt;font-family:&quot;Courier
                New&quot;,&quot;serif&quot;"><br>
                <br>
                <tt>Harold,</tt><br>
                <br>
                <tt>The equivalent of:</tt><br>
                <br>
                <tt>&nbsp;&nbsp;&nbsp; snprintf(buf, n, str);</tt><br>
                <br>
                <tt>is:</tt><br>
                <br>
                <tt>&nbsp;&nbsp;&nbsp; strncpy(buf, str, n - 1);</tt><br>
                <tt>&nbsp;&nbsp;&nbsp; buf[n - 1] = '\0';</tt><br>
                <br>
                <tt>because snprintf() will only write out (n - 1) bytes
                  from</tt><br>
                <tt>'str' to 'buf' and then write a NUL in the last
                  slot.</tt><br>
                <tt>strncpy() copies up to 'n' bytes from 'str' to
                  'buf'.</tt><br>
                <tt>strncpy() will not copy past a NUL character in
                  'str', but</tt><br>
                <tt>it will also not NUL terminate 'buf' if a NUL is not
                  found</tt><br>
                <tt>in 'str' before the limit 'n' is reached.</tt><br>
                <br>
                <tt>Dan</tt></span><o:p></o:p></p>
            <div>
              <p class="MsoNormal">On 12/18/12 2:48 PM, harold seigel
                wrote:<o:p></o:p></p>
            </div>
            <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
              <p class="MsoNormal">Hi Ron,<br>
                <br>
                I think these calls to snprintf() in os_solaris.cpp and
                the other os_....cpp files could be replaced with calls
                to strncpy().&nbsp; It might be a little simpler.<br>
                <br>
                Otherwise, it looks good.<br>
                <br>
                Thanks, Harold<br>
                <br>
                2539 if (0 == access(buf, F_OK)) { <br>
                <span class="changed">2540 // Use current module name
                  "libjvm.so"</span> <br>
                2541 len = strlen(buf); <br>
                <span class="changed">2542 <b>snprintf(buf + len,
                    buflen-len, "/hotspot/libjvm.so");</b></span> <br>
                2543 } else { <br>
                2544 // Go back to path of .so <br>
                2545 realpath((char *)dlinfo.dli_fname, buf); 2546 } <br>
                <br>
                On 12/18/2012 3:46 PM, Daniel D. Daugherty wrote: <o:p></o:p></p>
              <p class="MsoNormal" style="margin-bottom:12.0pt"><tt><span
                    style="font-size:11.0pt">Greetings,</span></tt><span
                  style="font-size:11.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                  <br>
                </span><tt><span style="font-size:10.0pt">I'm sponsoring
                    this code review request from Ron Durbin. This
                    change</span></tt><span
                  style="font-size:11.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                </span><tt><span style="font-size:10.0pt">is targeted at
                    JDK8/HSX-25 in the RT_Baseline repo.</span></tt><span
                  style="font-size:11.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                  <br>
                </span><tt><span style="font-size:10.0pt">Dan</span></tt><span
                  style="font-size:11.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                  <br>
                </span><tt><span style="font-size:10.0pt">Sending again
                    with correct subject line, bug URLs and webrev URL.</span></tt><span
                  style="font-size:11.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                  <br>
                </span><span
                  style="font-size:10.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                  <tt>Intro:</tt><br>
                  <tt>&nbsp;</tt><br>
                  <tt>This set of changes removes the runtime support
                    for generation of debug versions that follow _g
                    semantics.</tt><br>
                  <tt>&nbsp;</tt><br>
                  <tt>Defect:</tt><br>
                </span><tt><span style="font-size:9.0pt">JDK-8005044
                    remove crufty '_g' support from HS runtime code</span></tt><span
                  style="font-size:10.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                  <tt><a moz-do-not-send="true"
                      href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8005044">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8005044</a></tt><br>
                  <tt><a moz-do-not-send="true"
                      href="https://jbs.oracle.com/bugs/browse/JDK-8005044">https://jbs.oracle.com/bugs/browse/JDK-8005044</a></tt><br>
                  <br>
                  <br>
                  <tt>Webrev</tt><br>
                  <tt><a moz-do-not-send="true"
                      href="http://cr.openjdk.java.net/%7Edcubed/for_rdurbin/8005044-webrev/0">http://cr.openjdk.java.net/~dcubed/for_rdurbin/8005044-webrev/0</a>
                  </tt><br>
                  <br>
                  <tt>&nbsp;</tt><br>
                  <tt>Details:</tt><br>
                </span><tt><span style="font-size:11.0pt">Files </span></tt><tt><span
                    style="font-size:10.0pt">have been modified to
                    remove all reference and support for &nbsp;debug versions
                    that follow _g semantics.</span></tt><span
                  style="font-size:10.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                </span><tt><span style="font-size:11.0pt">&nbsp;</span></tt><span
                  style="font-size:10.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                </span><tt><span style="font-size:11.0pt">Testing:</span></tt><span
                  style="font-size:10.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                </span><tt><span style="font-size:11.0pt">&nbsp;</span></tt><span
                  style="font-size:10.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                </span><tt><span style="font-size:11.0pt">Passed JPRT
                    last night:</span></tt><span
                  style="font-size:10.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                </span><tt><span style="font-size:11.0pt">&nbsp;</span></tt><span
                  style="font-size:10.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                </span><tt><span style="font-size:11.0pt">Additional
                    Testing In process: (suggested by Dan)</span></tt><tt><span
                    style="font-size:10.0pt">:</span></tt><span
                  style="font-size:10.0pt;font-family:&quot;Courier
                  New&quot;,&quot;serif&quot;"><br>
                  <br>
                  <tt>src/share/vm/runtime/arguments.cpp</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp; - test with shared archive creation and use;
                    see the e-mail</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from Coleen</tt><br>
                  <br>
                  <tt>src/share/tools/ProjectCreator/ProjectCreator.java</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp; - just a usage message; visual inspection of
                    the code</tt><br>
                  <br>
                  <tt>src/os/windows/vm/os_windows.cpp</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp; - comments only; no testing needed</tt><br>
                  <br>
                  <tt>src/os/{bsd,linux,solaris}/vm/os_{bsd,linux,solaris}.cpp</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp; - the only code changes come into play when
                    the "gamma"</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; launcher is used</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp; - and when JAVA_HOME refers to a valid JDK,
                    the function</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fakes up a JVM path so that callers using
                    the JVM path</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to find other things in the JDK will work.</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp; - I can't find any way that the actual JVM
                    path value</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; that is returned is exposed</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp; - I don't see a way to test this other than
                    have a debug</tt><br>
                  <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf() or manual code inspection.</tt></span><o:p></o:p></p>
            </blockquote>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
          </blockquote>
          <p class="MsoNormal">&nbsp;<o:p></o:p></p>
          <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
        </div>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>