<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 1 March 2016 at 09:37, Dengke Du <span dir="ltr">&lt;<a href="mailto:dengke.du@windriver.com" target="_blank">dengke.du@windriver.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":1vu" class="a3s" style="overflow:hidden">http.test httpold.test socket.test failed when run the pTest-tcl,because<br>
the tcl script &quot;info hostname&quot; in /usr/lib/tcl/ptest/tests/http.test on<br>
target fail. When run the &quot;info hostname&quot; get the hostname,but it can find<br>
the IP in the /etc/hosts, so it failed. We need to add the IP and hostname<br>
pair in the /etc/hosts. In order to add the IP and hostname pair in the<br>
/etc/hosts, we need to add the pair when the target start, so I add the<br>
&quot;echo &quot;127.0.0.1 `cat /etc/hostname`&quot; &gt;&gt; /etc/hosts&quot; to the hostname.sh in<br>
&quot;meta/recipes-core/initscripts/initscripts-1.0/&quot;, when the system invoke<br>
the hostname.sh in &quot;/etc/init.d/&quot;, it add the IP and hostname pair in the<br>
/etc/hosts.</div></blockquote></div><br>First, the shortlog should accurately reflect the change.  You haven&#39;t fixed a ptest-tcl failure, you&#39;ve added a missing host entry in /etc/hosts which had the side-effect of fixing a failure in tcl-ptest.</div><div class="gmail_extra"><br></div><div class="gmail_extra">So what you&#39;ve done is add a call to write &quot;127.0.0.1   &lt;hostname&gt;&quot; to /etc/hosts on boot.  On every boot.  Every time that script runs a new entry will be written to /etc/hosts.  If the hostname changes then hosts will contain incorrect entries.  If / is read-only then this operation will fail.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Instead netbase should write the hostname entry at build time so the rootfs is correct when it is created, fixing the problem at source and ensuring it works with read-only rootfs.  The problem you&#39;ve now got to solve is getting the hostname from the base-files recipe, so clearly the hostname needs to be promoted to distro-level variable.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Ross</div></div>