This should fix about 3 or 4 BUGS in devfs.rules and support scripts.
The fix for the NAME bug is also in this patch, thought it is just a
matter of moving strings around to fix this.
I don't see why this is a g-v-m bug, AFAIWT g-v-m gets the device name
from udev and passes it along to pmount. pmount takes the name and
creates /media/%n and nautilus makes a desctop icon made %n.
So if anything other then udev it's a nautilus bug.
# USB devices
BUS="usb", KERNEL="hiddev*", NAME="usb/%k"
@@ -70,7 +70,7 @@
KERNEL="i2c-[0-9]*", NAME="i2c/%n"
KERNEL="ram[0-9]*", NAME="rd/%n"
KERNEL="lp[0-9]*", NAME="printers/%n"
-KERNEL="fd[0-9]*", NAME="floppy/%n",
+KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k"
KERNEL="cdemu[0-9]*", NAME="cdemu/%n"
KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n"
KERNEL="pktcdvd", NAME="pktcdvd/control"
diff -ruNa /etc/udev/links.conf udev/links.conf
--- /etc/udev/links.conf 2004-11-28 12:24:26.000000000 -0600
+++ udev/links.conf 2004-12-05 09:41:49.000000000 -0600
@@ -2,9 +2,9 @@
# You may use it to do strange and wonderful things, at your risk.
L fd /proc/self/fd
-L stdin /proc/self/fd/0
-L stdout /proc/self/fd/1
-L stderr /proc/self/fd/2
+L stdin fd/0
+L stdout fd/1
+L stderr fd/2
L core /proc/kcore
L sndstat /proc/asound/oss/sndstat
L MAKEDEV /sbin/MAKEDEV
diff -ruNa /etc/udev/scripts/ide-devfs.sh udev/scripts/ide-devfs.sh
--- /etc/udev/scripts/ide-devfs.sh 2004-11-28 12:24:26.000000000 -0600
+++ udev/scripts/ide-devfs.sh 2004-12-06 14:41:57.000000000 -0600
@@ -36,11 +36,11 @@
if [ -z "$3" ] && [ -f /proc/ide/${1}/media ]; then
MEDIA=`cat /proc/ide/${1}/media`
if [ "${MEDIA}" = "cdrom" ]; then
- echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom`
+ echo cdroms/$(get_dev_number $1 cdrom) root cdrom 0660 ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom$(get_dev_number $1 cdrom)
elif [ "${MEDIA}" = "floppy" ]; then
- echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc floppies/floppy`get_dev_number $1 floppy`/disc
+ echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc root floppy 0660 floppies/floppy`get_dev_number $1 floppy`/disc
elif [ "${MEDIA}" = "disk" ]; then
- echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc
+ echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc root disks 0640 discs/disc`get_dev_number $1 disk`/disc
fi
else
echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/part$3 discs/disc`get_dev_number $1 disk`/part$3
diff -ruNa /etc/udev/scripts/scsi-devfs.sh udev/scripts/scsi-devfs.sh
--- /etc/udev/scripts/scsi-devfs.sh 2004-11-28 12:24:26.000000000 -0600
+++ udev/scripts/scsi-devfs.sh 2004-12-07 10:06:57.000000000 -0600
@@ -1,18 +1,26 @@
-#!/bin/sh -e
+#!/bin/bash -e
+# This script may not work with dash.
+
# Inspired from a script by Remco <email address hidden>.
# Support for /dev/discs/* and /dev/cdroms/* by Daniel Mueller <email address hidden>.
#
# BUS="scsi", KERNEL="sd[a-z][0-9]*", PROGRAM="/etc/udev/scsi-devfs.sh %k %b %n", NAME="%1c", SYMLINK="%k %2c"
-get_ide_offset() {
+get_scsi_offset() {
local num=0
local dev
- for dev in /proc/ide/*/media; do
+ if [ "$1" = "disk" -o "$1" = "cdrom" ]; then
+ for dev in /proc/scsi/*/media; do
if [ "`cat $dev`" = "$1" ]; then
num=$(($num + 1))
fi
- done
+ done
+ else
+ for dev in /proc/scsi/${2}*; do
+ num=$(($num + 1))
+ done
+ fi
echo $num
}
@@ -20,7 +28,7 @@
get_next_number() {
local num=0
local dev
- local offset=`get_ide_offset $2`
+ local offset=`get_scsi_offset $2 $3`
if [ "$2" = "disk" ]; then
local DRIVE="${1%%[0-9]*}"
@@ -48,34 +56,58 @@
SCSI_ID=${SCSI_ID#*:}
LUN=$SCSI_ID
+PREFIX="scsi/host$HOST/bus$BUS/target$TARGET/lun$LUN"
+USER=root
+
case "$1" in
scd*|sr*)
# CDROM/DVD
- NAME=cd
- LINK="cdroms/cdrom"`get_next_number $1 cdrom`
+ MODE=0660
+ GROUP=cdrom
+ LINK="cdroms/cdrom$(get_next_number $1 cdrom) $PREFIX/cd"
+ NAME="cdroms/$(get_next_number $1 cdrom)"
;;
sd*)
+ MODE=0640
+ GROUP=disk
if [ "$3" ]; then
- NAME=part$3
- LINK="discs/disc"`get_next_number $1 disk`/part${3}
+ NAME=$PREFIX/part$3
+ LINK="discs/disc$(get_next_number $1 disk sd/something)/part${3}"
+ DEV_NAME="discs/$(get_next_number $1 disk sd/something)/parts/${3}"
else
- NAME=disc
- LINK="discs/disc"`get_next_number $1 disk`/disc
+ NAME=$PREFIX/disc
+ LINK="discs/disc$(get_next_number $1 disk sd)/disc"
+ DEV_NAME="discs/$(get_next_number $1 disk sd)/${3}"
fi
;;
nst*)
- NAME=$(echo "$1" | sed -e 's/nst0m/nmt/')
- [ $NAME = "mt0" ] && LINK=ntape
+ MODE=0660
+ GROUP=tape
+ LINK="$PREFIX/$(echo "$1" | sed -e 's/nst0m/nmt/')"
+ # I don't get the following line.
+ [ $LINK = "$PREFIX/nmt0" ] && LINK="$LINK ntape"
+ NAME="$(echo "$1" | sed -e 's/nst0m/nmt/')/"
+ NAME="$NAME$(get_next_number $1 disk nst)"
;;
st*)
- NAME=$(echo "$1" | sed -e 's/st0m/mt/')
- [ $NAME = "mt0" ] && LINK=tape
+ MODE=0660
+ GROUP=tape
+ LINK=$PREFIX/$(echo "$1" | sed -e 's/st0m/mt/')
+ # I don't get the following line.
+ [ $LINK = "$PREFIX/mt0" ] && LINK="$LINK tape"
+ NAME=$(echo "$1" | sed -e 's/st0m/mt/')/
+ NAME="$NAME$(get_next_number $1 disk st)"
;;
sg*|*)
- NAME=generic
+ MODE=0660
+ GROUP=disk
+ LINK=$PREFIX/generic
+ NAME="sg/"
+ NAME="$NAME$(get_next_number $1 disk sg)"
;;
esac
Message-ID: <email address hidden>
Date: Tue, 07 Dec 2004 10:45:55 -0600
From: Mike Mestnik <email address hidden>
To: <email address hidden>,
"bugs.debian.org control" <email address hidden>
Cc: Marco d'Itri <email address hidden>
Subject: Re: Bug#284492: devfs.rules: Don't change NAME into a port(host?/bus?)
specific target, for gvm.)
------- ------- 050800020809010 409080404 Transfer- Encoding: 7bit
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-
tag 284492 +patch
thank you.
This should fix about 3 or 4 BUGS in devfs.rules and support scripts.
The fix for the NAME bug is also in this patch, thought it is just a
matter of moving strings around to fix this.
I don't see why this is a g-v-m bug, AFAIWT g-v-m gets the device name
from udev and passes it along to pmount. pmount takes the name and
creates /media/%n and nautilus makes a desctop icon made %n.
So if anything other then udev it's a nautilus bug.
------- ------- 050800020809010 409080404 udevconf. diff" Transfer- Encoding: 7bit Disposition: inline; "udevconf. diff"
Content-Type: text/x-patch;
name="
Content-
Content-
filename=
diff -ruNa /etc/udev/ devfs.rules udev/devfs.rules devfs.rules 2004-11-28 12:24:26.000000000 -0600
--- /etc/udev/
+++ udev/devfs.rules 2004-12-07 10:22:00.000000000 -0600
@@ -13,20 +13,20 @@
#
# IDE block devices "/etc/udev/ scripts/ ide-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" "/etc/udev/ scripts/ ide-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{5} %c{6}", USER"%c{2}", GROUP="%c{3}", MODE="%c{4}"
-BUS="ide", KERNEL="hd[a-z]*", PROGRAM=
+BUS="ide", KERNEL="hd[a-z]*", PROGRAM=
# permissions for SCSI sg devices "s[grt] [0-9]*" , SYSFS{type}="5", PROGRAM= "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}", MODE="0660", GROUP="cdrom" "s[grt] [0-9]*" , SYSFS{type}="5", PROGRAM= "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{5} %c{6}", USER"%c{2}", GROUP="cdrom", MODE="0660"
-BUS="scsi", KERNEL=
+BUS="scsi", KERNEL=
# SCSI block devices "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" "sd[a-z] [0-9]*" , PROGRAM= "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" "sd[a-i] [a-z]", PROGRAM= "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" "sd[a-i] [a-z][0- 9]*", PROGRAM= "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" "s[grt] [0-9]*" , PROGRAM= "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{5} %c{6}", USER"%c{2}", GROUP="%c{3}", MODE="%c{4}" "sd[a-z] [0-9]*" , PROGRAM= "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{5} %c{6}", USER"%c{2}", GROUP="%c{3}", MODE="%c{4}" "sd[a-i] [a-z]", PROGRAM= "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{5} %c{6}", USER"%c{2}", GROUP="%c{3}", MODE="%c{4}" "sd[a-i] [a-z][0- 9]*", PROGRAM= "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{5} %c{6}", USER"%c{2}", GROUP="%c{3}", MODE="%c{4}" "s[grt] [0-9]*" , PROGRAM= "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{5} %c{6}", USER"%c{2}", GROUP="%c{3}", MODE="%c{4}" "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{5} %c{6}", USER"%c{2}", GROUP="%c{3}", MODE="%c{4}" "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{5} %c{6}", USER"%c{2}", GROUP="%c{3}", MODE="%c{4}" "/etc/udev/ scripts/ scsi-devfs. sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{5} %c{6}", USER"%c{2}", GROUP="%c{3}", MODE="%c{4}"
-BUS="scsi", KERNEL="sd[a-z]", PROGRAM=
-BUS="scsi", KERNEL=
-BUS="scsi", KERNEL=
-BUS="scsi", KERNEL=
-BUS="scsi", KERNEL=
-BUS="scsi", KERNEL="scd[0-9]*", PROGRAM=
-BUS="scsi", KERNEL="st[0-9]*", PROGRAM=
-BUS="scsi", KERNEL="nst[0-9]*", PROGRAM=
+BUS="scsi", KERNEL="sd[a-z]", PROGRAM=
+BUS="scsi", KERNEL=
+BUS="scsi", KERNEL=
+BUS="scsi", KERNEL=
+BUS="scsi", KERNEL=
+BUS="scsi", KERNEL="scd[0-9]*", PROGRAM=
+BUS="scsi", KERNEL="st[0-9]*", PROGRAM=
+BUS="scsi", KERNEL="nst[0-9]*", PROGRAM=
# USB devices "i2c-[0- 9]*", NAME="i2c/%n" "ram[0- 9]*", NAME="rd/%n" "cdemu[ 0-9]*", NAME="cdemu/%n" "pktcdvd[ 0-9]*", NAME="pktcdvd/%n" control" links.conf udev/links.conf links.conf 2004-11-28 12:24:26.000000000 -0600
BUS="usb", KERNEL="hiddev*", NAME="usb/%k"
@@ -70,7 +70,7 @@
KERNEL=
KERNEL=
KERNEL="lp[0-9]*", NAME="printers/%n"
-KERNEL="fd[0-9]*", NAME="floppy/%n",
+KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k"
KERNEL=
KERNEL=
KERNEL="pktcdvd", NAME="pktcdvd/
diff -ruNa /etc/udev/
--- /etc/udev/
+++ udev/links.conf 2004-12-05 09:41:49.000000000 -0600
@@ -2,9 +2,9 @@
# You may use it to do strange and wonderful things, at your risk.
L fd /proc/self/fd oss/sndstat scripts/ ide-devfs. sh udev/scripts/ ide-devfs. sh scripts/ ide-devfs. sh 2004-11-28 12:24:26.000000000 -0600 ide-devfs. sh 2004-12-06 14:41:57.000000000 -0600 ${1}/media ]; then ${1}/media` {HOST}/ bus${BUS} /target$ {TARGET} /lun0/cd cdroms/ cdrom`get_ dev_number $1 cdrom` $(get_dev_ number $1 cdrom) root cdrom 0660 ide/host$ {HOST}/ bus${BUS} /target$ {TARGET} /lun0/cd cdroms/ cdrom$( get_dev_ number $1 cdrom) {HOST}/ bus${BUS} /target$ {TARGET} /lun0/disc floppies/ floppy` get_dev_ number $1 floppy`/disc {HOST}/ bus${BUS} /target$ {TARGET} /lun0/disc root floppy 0660 floppies/ floppy` get_dev_ number $1 floppy`/disc {HOST}/ bus${BUS} /target$ {TARGET} /lun0/disc discs/disc` get_dev_ number $1 disk`/disc {HOST}/ bus${BUS} /target$ {TARGET} /lun0/disc root disks 0640 discs/disc` get_dev_ number $1 disk`/disc {HOST}/ bus${BUS} /target$ {TARGET} /lun0/part$ 3 discs/disc` get_dev_ number $1 disk`/part$3 scripts/ scsi-devfs. sh udev/scripts/ scsi-devfs. sh scripts/ scsi-devfs. sh 2004-11-28 12:24:26.000000000 -0600 scsi-devfs. sh 2004-12-07 10:06:57.000000000 -0600 "sd[a-z] [0-9]*" , PROGRAM= "/etc/udev/ scsi-devfs. sh %k %b %n", NAME="%1c", SYMLINK="%k %2c"
-L stdin /proc/self/fd/0
-L stdout /proc/self/fd/1
-L stderr /proc/self/fd/2
+L stdin fd/0
+L stdout fd/1
+L stderr fd/2
L core /proc/kcore
L sndstat /proc/asound/
L MAKEDEV /sbin/MAKEDEV
diff -ruNa /etc/udev/
--- /etc/udev/
+++ udev/scripts/
@@ -36,11 +36,11 @@
if [ -z "$3" ] && [ -f /proc/ide/
MEDIA=`cat /proc/ide/
if [ "${MEDIA}" = "cdrom" ]; then
- echo ide/host$
+ echo cdroms/
elif [ "${MEDIA}" = "floppy" ]; then
- echo ide/host$
+ echo ide/host$
elif [ "${MEDIA}" = "disk" ]; then
- echo ide/host$
+ echo ide/host$
fi
else
echo ide/host$
diff -ruNa /etc/udev/
--- /etc/udev/
+++ udev/scripts/
@@ -1,18 +1,26 @@
-#!/bin/sh -e
+#!/bin/bash -e
+# This script may not work with dash.
+
# Inspired from a script by Remco <email address hidden>.
# Support for /dev/discs/* and /dev/cdroms/* by Daniel Mueller <email address hidden>.
#
# BUS="scsi", KERNEL=
-get_ide_offset() {
+get_scsi_offset() {
local num=0
local dev
- for dev in /proc/ide/*/media; do
+ if [ "$1" = "disk" -o "$1" = "cdrom" ]; then
+ for dev in /proc/scsi/*/media; do
if [ "`cat $dev`" = "$1" ]; then
num=$(($num + 1))
fi
- done
+ done
+ else
+ for dev in /proc/scsi/${2}*; do
+ num=$(($num + 1))
+ done
+ fi
echo $num `get_ide_ offset $2` `get_scsi_ offset $2 $3`
}
@@ -20,7 +28,7 @@
get_next_number() {
local num=0
local dev
- local offset=
+ local offset=
if [ "$2" = "disk" ]; then ${1%%[0- 9]*}" ${SCSI_ ID#*:}
local DRIVE="
@@ -48,34 +56,58 @@
SCSI_ID=
LUN=$SCSI_ID
+PREFIX= "scsi/host$ HOST/bus$ BUS/target$ TARGET/ lun$LUN" cdrom"` get_next_ number $1 cdrom` cdrom$( get_next_ number $1 cdrom) $PREFIX/cd" $(get_next_ number $1 cdrom)" disc"`get_ next_number $1 disk`/part${3} disc$(get_ next_number $1 disk sd/something) /part${ 3}" "discs/ $(get_next_ number $1 disk sd/something) /parts/ ${3}" disc"`get_ next_number $1 disk`/disc disc$(get_ next_number $1 disk sd)/disc" "discs/ $(get_next_ number $1 disk sd)/${3}" PREFIX/ $(echo "$1" | sed -e 's/nst0m/nmt/')" NAME$(get_ next_number $1 disk nst)" NAME$(get_ next_number $1 disk st)" generic NAME$(get_ next_number $1 disk sg)"
+USER=root
+
case "$1" in
scd*|sr*)
# CDROM/DVD
- NAME=cd
- LINK="cdroms/
+ MODE=0660
+ GROUP=cdrom
+ LINK="cdroms/
+ NAME="cdroms/
;;
sd*)
+ MODE=0640
+ GROUP=disk
if [ "$3" ]; then
- NAME=part$3
- LINK="discs/
+ NAME=$PREFIX/part$3
+ LINK="discs/
+ DEV_NAME=
else
- NAME=disc
- LINK="discs/
+ NAME=$PREFIX/disc
+ LINK="discs/
+ DEV_NAME=
fi
;;
nst*)
- NAME=$(echo "$1" | sed -e 's/nst0m/nmt/')
- [ $NAME = "mt0" ] && LINK=ntape
+ MODE=0660
+ GROUP=tape
+ LINK="$
+ # I don't get the following line.
+ [ $LINK = "$PREFIX/nmt0" ] && LINK="$LINK ntape"
+ NAME="$(echo "$1" | sed -e 's/nst0m/nmt/')/"
+ NAME="$
;;
st*)
- NAME=$(echo "$1" | sed -e 's/st0m/mt/')
- [ $NAME = "mt0" ] && LINK=tape
+ MODE=0660
+ GROUP=tape
+ LINK=$PREFIX/$(echo "$1" | sed -e 's/st0m/mt/')
+ # I don't get the following line.
+ [ $LINK = "$PREFIX/mt0" ] && LINK="$LINK tape"
+ NAME=$(echo "$1" | sed -e 's/st0m/mt/')/
+ NAME="$
;;
sg*|*)
- NAME=generic
+ MODE=0660
+ GROUP=disk
+ LINK=$PREFIX/
+ NAME="sg/"
+ NAME="$
;;
esac
-echo scsi/host$ HOST/bus$ BUS/target$ TARGET/ lun$LUN/ $NAME $LINK
+echo $USER $GROUP $MODE $NAME\
+ $LINK | tr '\n' ' '
exit 0
------- ------- 050800020809010 409080404- -