On Sun, Jul 16, 2017 at 10:26:25AM +0000, Robert Peichaer wrote:
> But I'd like to stay strict matching the filenames.
> 
> +     for _liba in /usr/lib/lib{c,crypto}; do
> +             _libas="$_libas $(ls $_liba.so.+([0-9.]).a | sort -V | tail -1)"
> +     done
> 
> > +   _libas=${_libas# }
Agreed, I had a similiar approach first but then tried to reduce the
differences to the essentials.

Here's an updated diff taking this into while also dropping $_l together
with this hunk instead of the other one.

Feedback?

Index: rc
===================================================================
RCS file: /cvs/src/etc/rc,v
retrieving revision 1.507
diff -u -p -r1.507 rc
--- rc  4 Jul 2017 19:02:11 -0000       1.507
+++ rc  16 Jul 2017 11:54:36 -0000
@@ -158,7 +158,7 @@ make_keys() {
 
 # Re-link libraries, placing the objects in a random order.
 reorder_libs() {
-       local _dkdev _l _liba _libas _mp _tmpdir _remount=false _error=false
+       local _dkdev _liba _libas _mp _tmpdir _remount=false _error=false
 
        [[ $library_aslr == NO ]] && return
 
@@ -171,13 +171,10 @@ reorder_libs() {
        echo -n 'reordering libraries:'
 
        # Only choose the latest version of the libraries.
-       for _liba in /usr/lib/libc.so.*.a /usr/lib/libcrypto.so.*.a; do
-               _liba=$(ls ${_liba%%.[0-9]*}*.a | sort -V | tail -1)
-               for _l in $_libas; do
-                       [[ $_l == $_liba ]] && continue 2
-               done
-               _libas="$_libas $_liba"
+       for _liba in /usr/lib/lib{c,crypto}; do
+               _libas="$_libas $(ls $_liba.so.+([0-9.]).a | sort -V | tail -1)"
        done
+       _libas=${_libas# }
 
        # Remount read-write, if /usr/lib is on a read-only ffs filesystem.
        if [[ $_mp == *' type ffs '*'read-only'* ]]; then

Reply via email to