Hello ! Richard Thrippleton wrote: > Running "pmount -d /dev/cdrom" just hangs - no debugging output. Doing the > same > with strace enabled (and running as root - strace clobbers setuid) -
It is quite fortunate that strace clobbers setuid (or rather that it wouldn't work to run it with setuid) - else any setuid program could be used to run arbitrary code with root permissions ;-)... > getcwd("/root", 4096) = 6 > lstat64("/root/none", 0xbf98b89c) = -1 ENOENT (No such file or > directory) > lstat64("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 > lstat64("/mnt", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 > lstat64("/mnt/bulk", <unfinished ...> OK, I got the problem: pmount checks whether the given argument is a /etc/fstab mountpoint. If it is a good idea, it is stupid to do so when the argument is a block device. Are you comfortable with applying patches ? I've attached a patch that should fix the symptoms - at least, it removes the accesses to the mountpoints in /etc/fstab when the argument to pmount is a full device name. If you are not comfortable with patches, I can make a .deb binary (but only for i386 or amd64), just ask. Thanks for your quick answer. Regards, Vincent Fourmond -- Vincent Fourmond, Debian Developer http://vincent.fourmond.neuf.fr/ -- pretty boring signature, isn't it ?
=== modified file 'src/pmount.c' --- src/pmount.c 2007-07-03 00:16:38 +0000 +++ src/pmount.c 2007-07-07 07:06:40 +0000 @@ -669,8 +669,11 @@ return E_ARGS; } - /* if we got a mount point, convert it to a device */ - if( fstab_has_mntpt( "/etc/fstab", devarg, mntptdev, sizeof(mntptdev) ) ) { + /* Lookup in /etc/fstab if devarg is a mount point, unless we already + have a block device -- this way, pmount shouldn't choke on stale + network mounts. */ + if( (! is_block(devarg)) && + fstab_has_mntpt( "/etc/fstab", devarg, mntptdev, sizeof(mntptdev) ) ) { debug( "resolved mount point %s to device %s\n", devarg, mntptdev ); devarg = mntptdev; } === modified file 'src/utils.c' --- src/utils.c 2005-10-13 15:16:44 +0000 +++ src/utils.c 2007-07-07 07:04:36 +0000 @@ -179,6 +179,18 @@ } int +is_block( const char* path ) +{ + struct stat st; + + if( stat( path, &st ) ) + return 0; + + return S_ISBLK( st.st_mode ); +} + + +int remove_pmount_mntpt( const char *path ) { char stampfile[PATH_MAX]; === modified file 'src/utils.h' --- src/utils.h 2005-10-05 11:49:57 +0000 +++ src/utils.h 2007-07-07 07:05:06 +0000 @@ -47,6 +47,13 @@ int is_dir( const char* path ); /** + * Return whether given path is a block device. + @ return 1 = block device, 0 = no block device + */ +int is_block( const char* path ); + + +/** * Remove a mountpoint created by pmount (i. e. only if the directory contains * a stamp file). * @return 0 on success, -1 on error