1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-11-01 09:21:11 +03:00
Commit Graph

1544 Commits

Author SHA1 Message Date
Kay Sievers
2983db9745 check the udevdb before assigning a new %e
A second "add" event created a new enumeration with %e. Check the
udevdb first and if a matching name is already used.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-29 03:48:17 +02:00
Kay Sievers
a8586078fc udev_test.pl: we replace untrusted chars with '_'
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-29 02:19:36 +02:00
Kay Sievers
69348b66ff remove special TIMEOUT handling from incoming queue
Moving events directly to the exec queue instead of the reordering
incoming queue, leaves holes in the sequence, that lead to timeouts for
all other events. Remove that part of the special handling.

(With netlink, events can't get out-of-order and the maximum timeout is 5
seconds and should not cause any trouble with the 10 sec timout for the
firmware class anyway. Events with timeouts are still prioritized for
execution, but don't bypass the incoming queue anymore.)

Many thanks to:
  Uberto Barbini <uberto@ubiland.net>

for his endless debugging and sending all the traces, that showed this
failure with his DVB device:
  UEVENT[1124474094] add@/module/stv0299
  UEVENT[1124474094] add@/module/ves1x93
  UEVENT[1124474094] add@/module/ttpci_eeprom
  UEVENT[1124474094] add@/module/saa7146
  UEVENT[1124474094] add@/module/video_buf
  UEVENT[1124474094] add@/module/saa7146_vv
  UEVENT[1124474094] add@/module/dvb_core
  UEVENT[1124474094] add@/module/dvb_ttpci
  UEVENT[1124474094] add@/bus/pci/drivers/dvb
  UEVENT[1124474094] add@/class/firmware/0000:00:14.0
  UDEV  [1124474094] add@/module/dvb_core
  UDEV  [1124474094] add@/module/saa7146_vv
  UDEV  [1124474094] add@/module/dvb_ttpci
  UDEV  [1124474094] add@/module/ves1x93
  UDEV  [1124474094] add@/module/ttpci_eeprom
  UDEV  [1124474094] add@/module/saa7146
  UDEV  [1124474094] add@/module/stv0299
  UDEV  [1124474094] add@/module/video_buf
  UDEV  [1124474094] add@/bus/pci/drivers/dvb
  UEVENT[1124474094] remove@/class/firmware/0000:00:14.0  <- event with TIMEOUT will leave a hole in the incoming
  UDEV  [1124474094] add@/class/firmware/0000:00:14.0        sequence, which will cause a wait for the alarm()
  UEVENT[1124474094] add@/class/i2c-adapter/i2c-1            that flushes the queue
  UEVENT[1124474094] add@/class/i2c-dev/i2c-1
  UDEV  [1124474094] remove@/class/firmware/0000:00:14.0  <- event also has TIMEOUT and is executed immediately
  UEVENT[1124474095] add@/class/dvb/dvb0.demux0
  UEVENT[1124474095] add@/class/dvb/dvb0.dvr0
  UEVENT[1124474095] add@/class/dvb/dvb0.video0
  UEVENT[1124474095] add@/class/dvb/dvb0.audio0
  UEVENT[1124474095] add@/class/dvb/dvb0.ca0
  UEVENT[1124474095] add@/class/dvb/dvb0.osd0
  UEVENT[1124474095] add@/class/dvb/dvb0.net0
  UEVENT[1124474095] add@/class/video4linux/video1
  UEVENT[1124474095] add@/class/dvb/dvb0.frontend0
  UDEV  [1124474099] add@/class/i2c-adapter/i2c-1         <- all others have 5 seconds delay cause of the missing event
  UDEV  [1124474099] add@/class/dvb/dvb0.ca0                 missing events
  UDEV  [1124474099] add@/class/dvb/dvb0.osd0
  UDEV  [1124474099] add@/class/video4linux/video1
  UDEV  [1124474099] add@/class/dvb/dvb0.frontend0
  UDEV  [1124474099] add@/class/dvb/dvb0.video0
  UDEV  [1124474099] add@/class/dvb/dvb0.audio0
  UDEV  [1124474099] add@/class/i2c-dev/i2c-1
  UDEV  [1124474099] add@/class/dvb/dv

My test program that simulates a similar sequence, runs without any delay
now. (With one of the next versions we will make netlink mandatory, then
we can remove the whole input queue crap with the reordering anyway.)

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-29 01:19:02 +02:00
Kay Sievers
199cdd8675 udevd: move some logging to "info" and "err"
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 23:19:45 +02:00
Kay Sievers
e79952c598 vol_id: ID_LABEL_SAFE will no longer contain fancy characters
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 23:16:56 +02:00
Kay Sievers
b2c6818dc3 rename ...trailing_char() to ...trailing_chars()
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 23:15:51 +02:00
Kay Sievers
d2ecd6a19d don't reenter get_udevd_msg() if message is ignored
Check all event sources with every iteration.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 23:14:59 +02:00
Kay Sievers
c6303c1316 remove not needed sig_flag for state of signal_pipe
Less internal state is better. And, we don't need to call
read() twice with every signal handling.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 23:13:14 +02:00
Kay Sievers
f1ff8d7b4a use WRITE_END/READ_END for the pipe index
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 20:25:37 +02:00
Kay Sievers
764ce7f2ab start to enforce plain ascii or valid utf8
No device node or symlink can have other characters as plain
readable ascii or valid utf8. The /dev/disk/by-label/* symlinks
can no longer contain weird stuff read from untrusted sources.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 15:55:58 +02:00
Kay Sievers
5b13ecb830 add uft8 validation for safe volume label exporting
We will not support any other character encoding than plain ascii
or utf8 for volume labels. All invalid utf8 and non-ascii characters
are substituted for security reasons. No options, no fancy heuristics.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 13:49:32 +02:00
Kay Sievers
7104c558da don't store devpath in udevdb, we don't need it
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 23:27:43 +02:00
Kay Sievers
fb17920701 add and use name_list_cleanup() for cleaning up the string lists
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 16:15:41 +02:00
Kay Sievers
314edf3ca4 change parameter order of udev_db_search_name()
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 15:46:58 +02:00
Kay Sievers
64d735e652 print persistent data with "udevinfo -q all"
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 15:37:03 +02:00
Kay Sievers
db481105c2 prepare for new HAL udevdb dump
HAL soon wants to read the whole content of the udevdatabase while
starting up. This makes the whole udev structure available to the
udevinfo "dump".

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 02:59:20 +02:00
Kay Sievers
3ad7a5b1a5 fix lookup for name in the udevdb, it should return the devpath
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-26 22:43:49 +02:00
Kay Sievers
8f847bb845 store ENV{key}="value" exported keys in the database
Just like the IMPORT values are stored in the udev database the
exported keys are stored in the udev database. The database is also
imported on a remove event before the rules are matched. So it
is possible to do:
  ACTION=="add", KERNEL=="sda", ENV{MY_DEVICE}="1234", RUN+="/bin/logger add $devpath"
  ACTION=="remove", ENV{MY_DEVICE}=="1234", RUN+="/bin/logger remove $devpath"

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-26 21:38:18 +02:00
Thierry Vignaud
c4ef16f92c switch to '==' in raid-devfs.sh 2005-08-26 14:52:57 +02:00
Kay Sievers
97dd82b9a7 update SUSE rules
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-26 14:27:13 +02:00
Kay Sievers
bcd9fc8f47 add pci_express to bus list
Hopefully that wait_for_sysfs crap can go away some day...

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-25 03:37:38 +02:00
Kay Sievers
879d194673 update SUSE rules
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-25 02:30:01 +02:00
Kay Sievers
cf7cad9dc9 path_id: remove SUSE specific PATH
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-25 00:40:41 +02:00
Amir Shalem
440103fcfc fix typo in firmware_helper
The wrong string is being nullifed.
2005-08-25 00:39:45 +02:00
Kay Sievers
9ae611be33 udevmonitor: cleanup on exit
We want to write the output buffer before
we exit, otherwise redirection to a file
does not work correctly.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-25 00:38:25 +02:00
Kay Sievers
8d77c6a383 volume_id: don't probe for mac_partition_maps
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-25 00:37:46 +02:00
Kay Sievers
e7f247503c udevd: keep the right order for messages without SEQNUM
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-23 00:57:46 +02:00
Kay Sievers
9bbcdb56d8 fix exit code of udevinitsend and udevmonitor
Thanks to: Marco d'Itri <md@Linux.IT> for the initial patch.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-22 12:01:55 +02:00
Kay Sievers
66691c6e6c add program name to logged error
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-22 11:42:58 +02:00
Kay Sievers
c907c823c3 *_id: fix zero length in set_str()
Thanks to Olaf Hering <olh@suse.de>

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-22 11:37:12 +02:00
Greg KH
8c11a2f0ff 068 release 2005-08-18 10:04:49 -07:00
Greg KH
da4aec2fb4 add EXTRAS documentation to the README file.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-08-18 10:02:27 -07:00
Kay Sievers
24a12dcbb8 fix printed udevmonitor header
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-18 13:43:27 +02:00
Kay Sievers
3f9f8de4de bring std(in|out|err) fd's in a sane state
If the kernel forks us as an usermodhelper, we don't have any of
the standard fd's and the first open() will start with fd=0.
This is inherited to all forked childs and confuses later forked
helpers where we want to read from a pipe connected to the helpers
stdout/stderr.

  # ls -l /proc/$(pidof udevd)/fd
  total 6
  dr-x------  2 root root  0 2005-08-18 12:44 .
  dr-xr-xr-x  4 root root  0 2005-08-18 12:44 ..
  lrwx------  1 root root 64 2005-08-18 12:44 0 -> /dev/null
  lrwx------  1 root root 64 2005-08-18 12:44 1 -> socket:[1274617]
  lr-x------  1 root root 64 2005-08-18 12:44 2 -> pipe:[1274618]
  l-wx------  1 root root 64 2005-08-18 12:44 3 -> pipe:[1274618]
  lrwx------  1 root root 64 2005-08-18 12:44 4 -> socket:[1274619]
  lrwx------  1 root root 64 2005-08-18 12:44 5 -> socket:[1274620]

Ouch! This will obviously not redirect sterr, it will kill the pipe
we established between the parent and the child:

  devnull = open("/dev/null", O_RDWR);
  dup2(devnull, STDERR_FILENO);

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-18 13:07:15 +02:00
Kay Sievers
e331c54dc5 fix typo in cdrom_id syslog
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-18 04:54:59 +02:00
Kay Sievers
5097a6ca42 Merge rsync://rsync.kernel.org/pub/scm/linux/hotplug/udev 2005-08-18 04:48:43 +02:00
Greg Kroah-Hartman
a961dcbf0d cdrom_id: change err() to info() to help with debugging problems
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-08-17 16:10:32 -07:00
Greg Kroah-Hartman
fc046d4d08 Always open the cdrom drive in non-blocking mode in cdrom_id
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-08-17 16:09:03 -07:00
Kay Sievers
f7a144a5be vol_id: fix sloppy error handling
vol_id segfaults if read() fails on broken devices reporting
the wrong size.

Thanks to Erhard Schultchen for the debugging.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-17 16:58:19 +02:00
Kay Sievers
5618b5611b ENV{TEST}=="1" compares and ENV{TEST}="1" sets the environment
This can be uses to export stuff to the event environment or
to carry a state from one rule to another, like enabling/disabling
later rules conditionally.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-16 04:25:20 +02:00
Kay Sievers
beb9f9ccb8 move udevmonitor to /usr/sbin
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-15 12:00:43 +02:00
Kay Sievers
40caaeec51 cleanup some debug output and move to info level + unify select() loops
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-15 11:57:04 +02:00
Greg Kroah-Hartman
8aafc06d94 067 release 2005-08-13 10:10:50 -07:00
Kay Sievers
af5461f72f don't fail too bad, if /dev/null does not exist
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-13 02:36:12 +02:00
Kay Sievers
7d38d2287c fix udevstart event ordering, we want /dev/null very early 2005-08-13 02:19:22 +02:00
Kay Sievers
b5d88a0cfe Merge rsync://rsync.kernel.org/pub/scm/linux/hotplug/udev 2005-08-13 02:16:54 +02:00
Kay Sievers
853ccc433c fix more compiler warnings ...
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-13 00:18:44 +02:00
Greg Kroah-Hartman
903a36495f added the cdrom.h #defines directly into the cdrom_id.c file
This solves the problem with building the file against old kernel header
files.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-08-12 11:37:56 -07:00
Kay Sievers
d2e8d41b9c fix make install, as we don't provide a default rule set anymore
Several people complained about the "default" rules and the "default"
setup. Here we start to remove things where we can't hava a  "default".
The best examples for rules are in the distro folders, just pick the one
that matches your needs and start from there.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-12 02:07:50 +02:00
Kay Sievers
5590ace308 update SUSE rules
don't use ID_TYPE, so cdroms will be in /dev/disk/

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-12 00:50:48 +02:00