Re: rc: reorder_libs: [1/2] Drop unused _l, exit early on failure

2017-07-17 Thread Robert Peichaer
On Mon, Jul 17, 2017 at 03:00:34PM +0200, Klemens Nanni wrote:
> On Sun, Jul 16, 2017 at 09:09:44AM +, Robert Peichaer wrote:
> > The rationale to picking the library versions before remounting was
> > to keep the time window having rw /usr as small as possible.
> > If that's deemed ok, I'm too OK with switching the steps.
> Considering the fact that the now simplified version picking routine
> takes virtually no time, I'd like finish this up.
> 
> Here's the updated diff checking r/w status beforehand.
> 
> Index: rc
> ===
> RCS file: /cvs/src/etc/rc,v
> retrieving revision 1.508
> diff -u -p -r1.508 rc
> --- rc17 Jul 2017 12:02:53 -  1.508
> +++ rc17 Jul 2017 12:56:07 -
> @@ -170,12 +170,6 @@ reorder_libs() {
>  
>   echo -n 'reordering libraries:'
>  
> - # Only choose the latest version of the libraries.
> - 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
>   if mount -u -w $_dkdev; then
> @@ -185,6 +179,12 @@ reorder_libs() {
>   return
>   fi
>   fi
> +
> + # Only choose the latest version of the libraries.
> + for _liba in /usr/lib/lib{c,crypto}; do
> + _libas="$_libas $(ls $_liba.so.+([0-9.]).a | sort -V | tail -1)"
> + done
> + _libas=${_libas# }
>  
>   for _liba in $_libas; do
>   _tmpdir=$(mktemp -dq /tmp/_librebuild.) && (
 
OK

-- 
-=[rpe]=-



Re: rc: reorder_libs: [1/2] Drop unused _l, exit early on failure

2017-07-17 Thread Theo Buehler
On Mon, Jul 17, 2017 at 03:00:34PM +0200, Klemens Nanni wrote:
> On Sun, Jul 16, 2017 at 09:09:44AM +, Robert Peichaer wrote:
> > The rationale to picking the library versions before remounting was
> > to keep the time window having rw /usr as small as possible.
> > If that's deemed ok, I'm too OK with switching the steps.
> Considering the fact that the now simplified version picking routine
> takes virtually no time, I'd like finish this up.
> 
> Here's the updated diff checking r/w status beforehand.

ok

> 
> Index: rc
> ===
> RCS file: /cvs/src/etc/rc,v
> retrieving revision 1.508
> diff -u -p -r1.508 rc
> --- rc17 Jul 2017 12:02:53 -  1.508
> +++ rc17 Jul 2017 12:56:07 -
> @@ -170,12 +170,6 @@ reorder_libs() {
>  
>   echo -n 'reordering libraries:'
>  
> - # Only choose the latest version of the libraries.
> - 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
>   if mount -u -w $_dkdev; then
> @@ -185,6 +179,12 @@ reorder_libs() {
>   return
>   fi
>   fi
> +
> + # Only choose the latest version of the libraries.
> + for _liba in /usr/lib/lib{c,crypto}; do
> + _libas="$_libas $(ls $_liba.so.+([0-9.]).a | sort -V | tail -1)"
> + done
> + _libas=${_libas# }
>  
>   for _liba in $_libas; do
>   _tmpdir=$(mktemp -dq /tmp/_librebuild.) && (
> 



Re: rc: reorder_libs: [1/2] Drop unused _l, exit early on failure

2017-07-17 Thread Klemens Nanni
On Sun, Jul 16, 2017 at 09:09:44AM +, Robert Peichaer wrote:
> The rationale to picking the library versions before remounting was
> to keep the time window having rw /usr as small as possible.
> If that's deemed ok, I'm too OK with switching the steps.
Considering the fact that the now simplified version picking routine
takes virtually no time, I'd like finish this up.

Here's the updated diff checking r/w status beforehand.

Index: rc
===
RCS file: /cvs/src/etc/rc,v
retrieving revision 1.508
diff -u -p -r1.508 rc
--- rc  17 Jul 2017 12:02:53 -  1.508
+++ rc  17 Jul 2017 12:56:07 -
@@ -170,12 +170,6 @@ reorder_libs() {
 
echo -n 'reordering libraries:'
 
-   # Only choose the latest version of the libraries.
-   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
if mount -u -w $_dkdev; then
@@ -185,6 +179,12 @@ reorder_libs() {
return
fi
fi
+
+   # Only choose the latest version of the libraries.
+   for _liba in /usr/lib/lib{c,crypto}; do
+   _libas="$_libas $(ls $_liba.so.+([0-9.]).a | sort -V | tail -1)"
+   done
+   _libas=${_libas# }
 
for _liba in $_libas; do
_tmpdir=$(mktemp -dq /tmp/_librebuild.) && (



Re: rc: reorder_libs: [1/2] Drop unused _l, exit early on failure

2017-07-16 Thread Klemens Nanni
On Sun, Jul 16, 2017 at 07:18:00AM +0200, Theo Buehler wrote:
> On Sun, Jul 16, 2017 at 03:34:07AM +0200, Klemens Nanni wrote:
> > $_l is not used and picking the latest archive versions is of no use
> > if /usr/lib cannot be written to.
> > 
> > This patch applies cleanly before my next one but not vice versa.
> > 
> > Feedback? OK?
Oh, that OK should've been gone.

> _l is only unused after your second patch :)
Indeed, a bit ugly now that I'm looking at it again but that's why those
two should only go together.


> hoisting the remount over picking the library version makes sense,
> but you should keep it after the "echo -n 'reordering libraries:'"
Fair point.



Re: rc: reorder_libs: [1/2] Drop unused _l, exit early on failure

2017-07-16 Thread Robert Peichaer
On Sun, Jul 16, 2017 at 07:18:00AM +0200, Theo Buehler wrote:
> On Sun, Jul 16, 2017 at 03:34:07AM +0200, Klemens Nanni wrote:
> > $_l is not used and picking the latest archive versions is of no use
> > if /usr/lib cannot be written to.
> > 
> > This patch applies cleanly before my next one but not vice versa.
> > 
> > Feedback? OK?
> 
> _l is only unused after your second patch :)
> 
> hoisting the remount over picking the library version makes sense,
> but you should keep it after the "echo -n 'reordering libraries:'"

The rationale to picking the library versions before remounting was
to keep the time window having rw /usr as small as possible.
If that's deemed ok, I'm too OK with switching the steps.



Re: rc: reorder_libs: [1/2] Drop unused _l, exit early on failure

2017-07-15 Thread Theo Buehler
On Sun, Jul 16, 2017 at 03:34:07AM +0200, Klemens Nanni wrote:
> $_l is not used and picking the latest archive versions is of no use
> if /usr/lib cannot be written to.
> 
> This patch applies cleanly before my next one but not vice versa.
> 
> Feedback? OK?

_l is only unused after your second patch :)

hoisting the remount over picking the library version makes sense,
but you should keep it after the "echo -n 'reordering libraries:'"

> 
> Index: rc
> ===
> RCS file: /cvs/src/etc/rc,v
> retrieving revision 1.507
> diff -u -p -r1.507 rc
> --- rc4 Jul 2017 19:02:11 -   1.507
> +++ rc16 Jul 2017 01:25:27 -
> @@ -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
>  
> @@ -168,6 +168,16 @@ reorder_libs() {
>   # Skip if /usr/lib is on a nfs mounted filesystem.
>   [[ $_mp == *' type nfs '* ]] && return
>  

echo -n 'reordering libraries:'

> + # Remount read-write, if /usr/lib is on a read-only ffs filesystem.
> + if [[ $_mp == *' type ffs '*'read-only'* ]]; then
> + if mount -u -w $_dkdev; then
> + _remount=true
> + else
> + echo ' failed.'
> + return
> + fi
> + fi
> +
>   echo -n 'reordering libraries:'

delete this

>  
>   # Only choose the latest version of the libraries.
> @@ -178,16 +188,6 @@ reorder_libs() {
>   done
>   _libas="$_libas $_liba"
>   done
> -
> - # Remount read-write, if /usr/lib is on a read-only ffs filesystem.
> - if [[ $_mp == *' type ffs '*'read-only'* ]]; then
> - if mount -u -w $_dkdev; then
> - _remount=true
> - else
> - echo ' failed.'
> - return
> - fi
> - fi
>  
>   for _liba in $_libas; do
>   _tmpdir=$(mktemp -dq /tmp/_librebuild.) && (
> 



rc: reorder_libs: [1/2] Drop unused _l, exit early on failure

2017-07-15 Thread Klemens Nanni
$_l is not used and picking the latest archive versions is of no use
if /usr/lib cannot be written to.

This patch applies cleanly before my next one but not vice versa.

Feedback? OK?

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 -   1.507
+++ rc  16 Jul 2017 01:25:27 -
@@ -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
 
@@ -168,6 +168,16 @@ reorder_libs() {
# Skip if /usr/lib is on a nfs mounted filesystem.
[[ $_mp == *' type nfs '* ]] && return
 
+   # Remount read-write, if /usr/lib is on a read-only ffs filesystem.
+   if [[ $_mp == *' type ffs '*'read-only'* ]]; then
+   if mount -u -w $_dkdev; then
+   _remount=true
+   else
+   echo ' failed.'
+   return
+   fi
+   fi
+
echo -n 'reordering libraries:'
 
# Only choose the latest version of the libraries.
@@ -178,16 +188,6 @@ reorder_libs() {
done
_libas="$_libas $_liba"
done
-
-   # Remount read-write, if /usr/lib is on a read-only ffs filesystem.
-   if [[ $_mp == *' type ffs '*'read-only'* ]]; then
-   if mount -u -w $_dkdev; then
-   _remount=true
-   else
-   echo ' failed.'
-   return
-   fi
-   fi
 
for _liba in $_libas; do
_tmpdir=$(mktemp -dq /tmp/_librebuild.) && (