Ch5: "Locking in" glibc, Ch6: Adjusting toolchain

Edwin van Vliet cheatah at tweakers.net
Wed Jun 4 08:18:55 PDT 2003


Would a more accurate regular expression for sed do the job?
The regular expression isn't pretty anyway, as it uses . instead of  \.
Let me try to form a better regex:

s@/lib/ld.so.1@/stage1&@g

We haven't touched the dots yet, maybe we won't have to. There must be a
better pattern than specifying the whole filename. Actually we do that
twice. I think it's possible with a single command, using backreferences.
The & is a great improvement so far.

We would currently have the following command:

sed -e 's@/lib/ld.so.1@/stage1&@g' \
   -e 's@/lib/ld-linux.so.2@/stage1&@g' \
   $SPECFILE > XX

It must be possible to shorten this, given that both patterns start with the
same characters:

sed -e 's@/lib/ld\(\.so\.1|-linux\.so\.2\)@/stage1&@g' \
   $SPECFILE > XX

Maybe too scary still, but much less typing. And flawless. Shorter, less
flawless, but I think
we can assume there is no /lib/ld.so.2 or /lib/ld-linux.so.1:

sed -e 's@/lib/ld\(-linux\)\?\.so\.[12]@/stage1&@g' \
   $SPECFILE > XX

But this does not solve the problem of the specs-4 patch containing more
patterns than just the /lib directory. Nonetheless, those commands can be
shorter than they are now.


-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list