On Sat, Aug 04, 2007 at 04:04:17PM -0400, Bryan Kadzban wrote:
> Ken Moffat wrote:
> > But how do we explain it in the text ?  "This test won't work when 
> > run like this, so we make it succeed by doing nothing useful" might 
> > raise a lot of questions about the point of testsuites in the minds 
> > of some of our readers ;)
> 
> True -- how about:
> 
> One of the tests requires the ability to read the device file behind
> stdin.  By default this file can't be read in the current environment,
> since it's owned by another user.  Make the test use an alternate device
> for its stdin, which is always readable:

Below is a patch that gives the most minimal explanation I can think of.
If you guys feel like fleshing out the explanation, my hat goes off to
you. I understand where you're coming from, but it could get a little long
winded to explain that the tests are not being run as the developer expected
and need to be worked-around.

> That wording should be a bit less questionable.  Unfortunately there's
> still an issue with why is the test trying to read the device when it
> isn't always readable (if normal "read(0, ...);" works, why doesn't
> "test -r <that device>"?), but maybe we can avoid that question.

Why do you think read(0,...) works? I don't see anything in the tests that
tries to read from stdin. An alternative to using /dev/null is to use
/dev/tty. This is what's done in the perl tests (not by us), but I guess we
can't guarantee that'll be readable either.

--
Dan

diff --git a/BOOK/chapter01/changelog.xml b/BOOK/chapter01/changelog.xml
index 0abd7d1..4416e3e 100644
--- a/BOOK/chapter01/changelog.xml
+++ b/BOOK/chapter01/changelog.xml
@@ -40,6 +40,11 @@
       <para>2007-08-06</para>
       <itemizedlist>
         <listitem>
+          <para>[dnicholson] - Redirected <filename>/dev/null</filename> to
+          stdin when running the Bash testsuite to prevent errors with
+          terminal permissions.</para>
+        </listitem>
+        <listitem>
           <para>[dnicholson] - Fixed a typo and clarified text on the Perl
           page. Reported by Shawn.</para>
         </listitem>
diff --git a/BOOK/chapter06/bash.xml b/BOOK/chapter06/bash.xml
index ba08418..767993a 100644
--- a/BOOK/chapter06/bash.xml
+++ b/BOOK/chapter06/bash.xml
@@ -81,9 +81,10 @@ sed -i "s|htmldir = @htmldir@|htmldir = 
/usr/share/doc/bash-&bash-version;|" \
 chown -Rv nobody ./</userinput></screen>
 
     <para>Now, run the tests as the <systemitem
-    class="username">nobody</systemitem> user:</para>
+    class="username">nobody</systemitem> user, ensuring that the standard
+    input device is readable:</para>
 
-<screen><userinput>su-tools nobody -s /bin/bash -c "make 
tests"</userinput></screen>
+<screen><userinput>su-tools nobody -s /bin/bash -c "make tests" 
&lt;/dev/null</userinput></screen>
 
     <para>Install the package:</para>
 

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to