[Pkg-ltsp-devel] Bug#595406: ltspfsd-core: cdpinger doesn't work well with USB CDROM drives

Vagrant Cascadian vagrant+debianbugs at freegeek.org
Fri Sep 3 18:07:58 UTC 2010


Package: ltspfsd-core
Version: 0.6-1
Severity: important
Tags: patch

cdpinger doesn't appear to properly die when the USB CDROM drive is removed,
leaving running cdpinger processes which lead to spurious mount and unmount
calls to the non-existant CDROM drive.

the following patch from upstream should resolve the issue, by calling cdpinger
with the real device name rather than the symlinked device name:

  144 Gideon Romm	2010-05-11
      revision-id:gideon at symbio-technologies.com-20100511145337-kev7n65bjxxiz67v
      Remove commented-out code.

  143 Gideon Romm	2010-05-11
      revision-id:gideon at symbio-technologies.com-20100511133014-m8ca2051wencjbkd
      Fix cdrom handling.

=== modified file 'scripts/ltspfs_entry'
--- scripts/ltspfs_entry	2010-02-11 03:08:21 +0000
+++ scripts/ltspfs_entry	2010-05-11 14:53:37 +0000
@@ -130,19 +130,14 @@
 }
 
 call_cdpinger(){
-    if [ ! -e /var/run/cdpinger.$1.pid ] && [ -z $(pgrep -f -l -x "/usr/sbin/cdpinger $1") ]; then
+    if [ -z $(pgrep -f -l -x "/usr/sbin/cdpinger $1") ]; then
         /usr/sbin/cdpinger $1 & 
-        echo $! > /var/run/cdpinger.$1.pid
         return 0
     fi
 }
 
 kill_cdpinger(){
-    if [ -e /var/run/cdpinger.$1.pid ]; then
-        pid=$(cat /var/run/cdpinger.$1.pid)
-        [ -n "$pid" ] && kill -9 $pid 2>/dev/null
-        rm -f /var/run/cdpinger.$1.pid 2>/dev/null 
-    fi
+    pkill -f -x "/usr/sbin/cdpinger $1"
 }
 
 verify_device() {
@@ -218,18 +213,8 @@
     DEVICENAME="$1"
     # handle CDROM devices, which do not produce udev add/remove events
     if [ "${ID_TYPE}" = "cd" ]; then
-        cd_device="$DEVICENAME"
-        for link in $($udevinfo -q symlink -n ${DEVICENAME}) ; do
-            case $link in
-                cdrom*) 
-                    cd_device="$link"
-                    break
-                    ;;
-            esac
-        done
-
         # started new cdpinger, which will handle the rest
-        call_cdpinger $cd_device 
+        call_cdpinger ${DEVICENAME} 
         exit 0
     fi
 }
@@ -238,22 +223,20 @@
     DEVICENAME="$1"
     # handle CDROM devices, which do not produce udev add/remove events
     if [ "${ID_TYPE}" = "cd" ]; then
-        cd_device="$DEVICENAME"
-        for link in $($udevinfo -q symlink -n ${DEVICENAME}) ; do
-            case $link in
-                cdrom*) 
-                    cd_device="$link"
-                    break
-                    ;;
-            esac
-        done
-        kill_cdpinger $cd_device 
-        exit 0
+        kill_cdpinger ${DEVICENAME} 
     fi
 }
 
 add_device() {
     DEVICENAME="$1"
+    for link in $($udevinfo -q symlink -n ${DEVICENAME}) ; do
+        case $link in
+            cdrom*) 
+                LABEL="$link"
+                break
+                ;;
+        esac
+    done
 
     case $DEVICENAME in
         fd*) 






More information about the Pkg-ltsp-devel mailing list