<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 1 March 2016 at 09:37, Dengke Du <span dir="ltr"><<a href="mailto:dengke.du@windriver.com" target="_blank">dengke.du@windriver.com</a>></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 "info hostname" in /usr/lib/tcl/ptest/tests/http.test on<br>
target fail. When run the "info hostname" 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>
"echo "127.0.0.1 `cat /etc/hostname`" >> /etc/hosts" to the hostname.sh in<br>
"meta/recipes-core/initscripts/initscripts-1.0/", when the system invoke<br>
the hostname.sh in "/etc/init.d/", 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't fixed a ptest-tcl failure, you'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've done is add a call to write "127.0.0.1 <hostname>" 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'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>