Comment 0 for bug 14145

Revision history for this message
In , Braun Gabor (braung) wrote :

Package: hotplug
Version: 0.0.20040329-17
Severity: grave
Justification: renders package unusable
Tags: patch

At boot time nothing hotplug related appears on the screen, not even
something like "Starting hotplug subsystem". When inserting a
pendrive it is unmountable (/dev/sda1 does not exist).
(This is the only thing I use hotplug for.)

The init script /etc/init.d/hotplug seems to have no effect:
when called with no argument it prints a usage message
(as expected), when called
with 'restart' or 'status' it does not print anything and nothing
seems to happen. The pendrive remains unmountable.

I think the problem is that the init script /etc/init.d/hotplug
  (1) runs under "sh -e" so it exits immediately when a command
      returns non-zero
      (as described in the output of 'sh -c "help set"');
  (2) uses "unset" to unset variables which are not known to be set.
      The unset command returns non-zero when applied to a
      read-only or unset variable (see the bash man page).

For example, when the prune command is first called, it immediately
unsets prune_discard and prune_output which were not set before.
Also when invoking the script with argument "status" the QUIET
variable is unset though it may not be set.

The following patch, which works for me, replaces "unset VARIABLE"
with "unset VARIABLE || true" so that unsetting variables which need
not be set does not stop the script unwantedly. This may introduce
problems when prune_output or prune_discard is read-only for some
reason.

Patch:
--- /etc/init.d/hotplug~ Wed Feb 16 01:40:28 2005
+++ /etc/init.d/hotplug Thu Mar 17 18:20:49 2005
@@ -24,7 +24,7 @@
 # $prune_output (the list with the elements removed) and $prune_discard
 # (the list of the elements discarded).
 prune() {
- unset prune_output prune_discard
+ unset prune_output prune_discard || true
     local discard

     for x in $1; do
@@ -55,7 +55,7 @@
     # Append it to the new list, knowing that dependancies are satisfied.
     echo "$sorted_list $prune_discard"

- unset prune_output prune_discard
+ unset prune_output prune_discard || true
 }

 quiet_printk() {
@@ -132,7 +132,7 @@
     ;;

 status)
- unset QUIET
+ unset QUIET || true
     run_rcs $1 "Hotplug status"
     ;;

Best wishes,

 Gabor Braun

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux gabor 2.6.9.20041228 #1 Tue Dec 28 17:03:16 CET 2004 i686
Locale: LANG=hu_HU.iso88592, LC_CTYPE=hu_HU.iso88592

Versions of packages hotplug depends on:
ii debconf 1.4.30.11 Debian configuration management sy
ii grep 2.5.1.ds1-4 GNU grep, egrep and fgrep
ii module-init-tools 3.2-pre1-2 tools for managing Linux kernel mo
ii modutils 2.4.26-1.2 Linux module utilities
ii procps 1:3.2.1-2 The /proc file system utilities