[Clfs-dev] Sanity checks

Chris Staub chris at beaker67.com
Mon Sep 21 21:55:05 PDT 2009


On 09/21/2009 12:28 AM, Akira Urushibata wrote:
> It is not possible to run checks that come with the packages during the
> early stages of CLFS.  As a result, errors may go unnoticed for a while.
> When they show up, one has to go back and do things over again.  When the
> exact cause of the error cannot be determined, one has to start anew from
> the beginning.
>
> I'd like to share some techniques to address this problem.
>
Personally I think the CLFS book does not need to contain a long list of 
checks to make sure everything works. I think the book really just needs 
to explain what needs to be done to make things work rather than 
worrying about double-checking everything and giving lists of problems, 
largely because there are just so many possibilities.

Perhaps additional checks to make sure that the compiler and linker ar 
working and looking in the correct places could be added. However, I 
think most of the other issues and solutions suggested are just 
unnecessary, mainly because CLFS's target audience - someone already 
familiar with stuff like compiling from source - should be able to keep 
track of where they are in the book and know what programs they've 
installed. I suppose it could be Hint material, but some of this stuff I 
would really hope nobody actually needs in the book. A few additional, 
specific points...
>
> The tests (for CLFS 1.1) listed below should help bring mistakes to light.
>
>
> 2. Execute programs and make sure that they work.
>
> Programs in /clfs/cross-tools/bin should run on the host system.
> You can check them by doing things like:
>
> /clfs/cross-tools/bin/file --version
> /clfs/cross-tools/bin/**-**-**-cc --version
>
Testing something like File in Cross-Tools to make sure it can run seems 
pretty pointless - if the host system can compile and link it, it's 
likely safe to assume it can be run. And of course for the more 
important stuff, like GCC and Binutils, you don't need to worry about 
just checking if they run because that can be lumped together with the 
toolchain tests mentioned elsewhere...
>
>
> 5. Check for existence of utilities with whereis.
>
> 5.1  Check for well-known utilities:
>
> Do this after boot or chroot, to assure that all the necessary utilities
> are in place.  You can throw in whatever else you please.
>
> At the end of chapter 10, do it again, but change one line:
>
>      whereis -b $i -B /bin /sbin /usr/bin /usr/sbin
>
>
> These programs are not available just after boot/chroot:
>
>    flex ps perl ping ftp vim less man

Neither is lsmod, if you're chrooting.
>
>
> 5.2  Thorough whereis test.
>
> This is like the one above, only that it scans through the book to find
> "installed programs".
>
> $ sed -n '/Installed programs:/,/<\/span>$/p' CLFS-BOOK.html |
>    grep -v "Installed programs" |
>    sed -e 's@</span>@,\n@' -e 's@<span class="segbody">@\n@' |
>    tr '\n' ' ' |
>    sed -e 's/,\| and /\n/g' |
>    sed -e '/^ *$/d' -e 's/^ *//' -e 's/  */ /g'>  list
>
I've actually done something similar myself, but that code could be 
simplified...keep in mind there is a single list of all programs at the 
end of the book...

sed -n \
   '/program-index/,/library-index/s at .*"item">\(.*\):</strong>.*@\1 at p' \ 
~/cross-lfs-book/x86/longindex.html > list

Of course you can replace the filename with CLFS-x86.html if using the 
single HTML file and you'll get the same results.

I did just get an idea from your version though...the program list I 
just used is generated from the program description list for each 
package, which is right below (and is separate from) the "Installed 
programs" list you were using...so I do both and compare to see if there 
are discrepancies...why this never occurred to me before I don't know....

You'd also have to make one small modification to your code...search for 
"program" not "programs", as a few packages do only have 1 binary installed.

> $ cut -d' ' -f 1 list | while read i           # cut, not cat; see below
>      do
>      whereis -b $i
>      done
>
> The file "list" above reports links like this:
>
>    c++
>    cc (link to gcc)
>    cpp

If you're just going to search the $PATH, you could just use "type -p".

>
> The whereis utility is in the Util-linux-ng package.
>
> Doing the above, I discovered that tack (from Ncurses) and resizecons (Kbd)
> are not installed, contrary to what is written in the Book.
>
Might want to double-check your versions of both the CLFS book and the 
packages. tack was installed with Ncurses 5.6, which is what you would 
be using with CLFS 1.1.0. However, current CLFS dev (correctly) does not 
list tack installed by Ncurses 5.7. Similarly, Kbd 1.15, in the current 
CLFS dev, does in fact install resizecons.
>
> 7.  Turning off write permission of "/cross-tools/" and "/tools/"
>
> No new files are written into "/cross-tools/" in Chapter 6 and onward.
>
> After boot or chroot, no files in "/cross-tools/" are accessed.
>
> No new files are created in "/tools/" in Chapter 10 and onward.  Only one
> write access to "/tools/" happens during Chapter 10, namely the specs file
> adjustment in 10.9.
>
This sounds like a good idea.



More information about the Clfs-dev mailing list