Package: eject
Version: 2.0.13deb-16
Severity: normal

Hello,

The pmount package, used by KDE and GNOME, allows the mounting and 
unmounting of media by normal users, even without a 
corresponding /etc/fstab entry for the device in question.

In KDE, for instance, when a disc is inserted in a drive that lacks 
an /etc/fstab entry, and the user accesses it, KDE uses pmount to mounts it 
very nicely. But if the user then tries to eject the disc, from KDE or from 
a shell, it fails, since without an /etc/fstab entry, the "umount" command 
that eject runs before attempting the actual eject, doesn't work 
("umount: /media/hdc is not in the fstab (and you are not root)").

Ubuntu has a small patch which addresses this issue. It makes eject first 
try to run "pumount", before falling back to "umount". The alternative to 
this patch would be to hack KDE's eject option to first run pumount itself, 
before running eject. But this is much more invasive than this minor 
change, and wouldn't fix the case where the user wished to use eject to get 
unmount and eject a disc (originally mounted within KDE) from somewhere 
else.

The patch (which I adapted to apply to the latest Debian package) is 
attached.

Thanks,
Christopher Martin
--- eject.c
+++ eject.c
@@ -623,10 +623,13 @@
 	switch (fork()) {
 	  case 0: /* child */
 		  setuid(getuid()); /* reduce likelyhood of security holes when running setuid */
-		  if(p_option)
-			  execlp("umount", "umount", fullName, "-n", NULL);
-		  else
-			  execlp("umount", "umount", fullName, NULL);
+		  if(p_option) {
+			  execlp("pumount", "pumount", fullName, "-n", NULL);
+			  execlp("umount", "umount", fullName, "-n", NULL);
+		  } else {
+			  execlp("pumount", "pumount", fullName, NULL);
+			  execlp("umount", "umount", fullName, NULL);
+		  }
 		  fprintf(stderr, _("%s: unable to exec umount of `%s': %s\n"),
 				  programName, fullName, strerror(errno));
 		  exit(1);

Reply via email to