[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: update-alternatives and /dev/random



Samuel Thibault, le Mon 21 Nov 2011 15:47:39 +0100, a écrit :
> Guillem Jover, le Sat 19 Nov 2011 04:07:48 +0100, a écrit :
> > > (b) Recursive grep through /etc/ on hurd would fail with the error message
> > >       "Resource lost"
> > >     while on Debian/Linux it would succeed (at least it did on my box).
> > 
> > That's because something went wrong on the upgrade from the random-egd
> > to the random-hurd switch. Check with showtrans what /dev/{u,}random
> > and /dev/{u,}random-hurd are set to.
> 
> Well, even if the /etc/alternatives/u?random link was correct, we'd get
> a bad result: rgrep foo /etc will stumble on it, keeping grepping in
> random data until it finds "foo" in there.
> 
> So this needs more thought.

This is what I have commited. The idea is to put the alternative on
a new /hurd/u?random.sh script instead. Does it look ok? I have put some
testing packages on http://people.debian.org/~sthibault/hurd-i386/tmp/

Samuel

commit 42373040d68f2316e4308bb12b531251cf8cbf68
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sat Nov 26 17:22:00 2011 +0100

    Replace /dev/u?random alternatives with /hurd/u?random.sh alternatives
    
      * local/random-hurd.sh, urandom-hurd.sh: Add scripts to be used as
        hurd-provided translators for /dev/*random.
      * hurd.postinst: Remove "random" alternative introduced by 20111106-1, as it
        makes rgrep in /etc not working any more. Install random.sh alternative
        instead, which sets /hurd/u?random.sh scripts.
      * local/setup-translators: Set /dev/u?random translator from
        /hurd/u?random.sh instead of making them alternatives.

diff --git a/debian/changelog b/debian/changelog
index a1aa927..f52dd6f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,13 @@ hurd (20111126-1) UNRELEASED; urgency=low
     rules: Move getty, console-run, and runttys to /sbin, runsystem and rc to
     /etc/hurd (Closes: Bug#556526).
   * hurd-udeb.lintian-overrides: Drop override about /libexec
+  * local/random-hurd.sh, urandom-hurd.sh: Add scripts to be used as
+    hurd-provided translators for /dev/*random.
+  * hurd.postinst: Remove "random" alternative introduced by 20111106-1, as it
+    makes rgrep in /etc not working any more. Install random.sh alternative
+    instead, which sets /hurd/u?random.sh scripts.
+  * local/setup-translators: Set /dev/u?random translator from
+    /hurd/u?random.sh instead of making them alternatives.
 
  -- Samuel Thibault <sthibault@debian.org>  Sun, 06 Nov 2011 19:51:54 +0100
 
diff --git a/debian/hurd.install b/debian/hurd.install
index c0e1149..ea39265 100644
--- a/debian/hurd.install
+++ b/debian/hurd.install
@@ -1,4 +1,6 @@
 debian/local/setup-translators usr/lib/hurd
+debian/local/random-hurd.sh hurd
+debian/local/urandom-hurd.sh hurd
 debian/tmp/lib/*.so.*
 debian/tmp/lib/hurd/console/*.so.* usr/lib/hurd/console
 debian/tmp/hurd/*
diff --git a/debian/hurd.postinst b/debian/hurd.postinst
index 2336469..8f79961 100644
--- a/debian/hurd.postinst
+++ b/debian/hurd.postinst
@@ -60,6 +60,9 @@ fi
 
 #DEBHELPER#
 
+# Remove alternative introduced by 20111106-1
+update-alternatives --remove random /dev/random-hurd
+
 if [ "$1" = configure ] && [ "$2" ]; then
 	# Upgrade: create the missing device and server nodes
 	if showtrans /dev/random 2> /dev/null | grep -q /tmp/entropy.sock
@@ -72,8 +75,8 @@ if [ "$1" = configure ] && [ "$2" ]; then
 	/usr/lib/hurd/setup-translators -K
 fi
 
-update-alternatives --install /dev/random random /dev/random-hurd 10 \
-		    --slave /dev/urandom urandom /dev/urandom-hurd
+update-alternatives --install /hurd/random.sh random.sh /hurd/random-hurd.sh 10 \
+		    --slave /hurd/urandom.sh urandom.sh /hurd/urandom-hurd.sh
 
 if [ "$1" = configure ] ; then
 	# Generate initial pool
diff --git a/debian/local/random-hurd.sh b/debian/local/random-hurd.sh
new file mode 100755
index 0000000..6b583c4
--- /dev/null
+++ b/debian/local/random-hurd.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /hurd/random --seed-file /var/spool/random-seed
diff --git a/debian/local/setup-translators b/debian/local/setup-translators
index 4a019fc..91ee85d 100755
--- a/debian/local/setup-translators
+++ b/debian/local/setup-translators
@@ -146,8 +146,8 @@ else
 	md ptyq
 	md lprX 0123
 	md comX 0123
-	st random-hurd 'random --seed-file /var/spool/random-seed' random
-	st urandom-hurd 'random --seed-file /var/spool/random-seed --fast' urandom
+	st random /etc/alternatives/random.sh random
+	st urandom /etc/alternatives/urandom.sh urandom
 fi
 
 st kbd 'symlink cons/kbd' kbd
diff --git a/debian/local/urandom-hurd.sh b/debian/local/urandom-hurd.sh
new file mode 100755
index 0000000..1205e8b
--- /dev/null
+++ b/debian/local/urandom-hurd.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /hurd/random --seed-file /var/spool/random-seed --fast


Reply to: