After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 96143 - Error while ejecting unformatted media from GUI.
Error while ejecting unformatted media from GUI.
Status: RESOLVED INVALID
Product: nautilus
Classification: Core
Component: File and Folder Operations
unspecified
Other Solaris
: High normal
: 2.2.x
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2002-10-18 07:06 UTC by Narayana Pattipati
Modified: 2006-12-26 18:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch which avoids error while ejecting an unmounted device (1.35 KB, patch)
2002-10-26 06:49 UTC, Narayana Pattipati
none Details | Review
Proposed patch with g_shell_quotes (3.21 KB, patch)
2002-10-30 16:37 UTC, Narayana Pattipati
none Details | Review
Proposed patch which fixes nautilus hang. (983 bytes, patch)
2002-12-24 10:56 UTC, Narayana Pattipati
none Details | Review
pstack of nautilus hang when Eject is done several times (6.00 KB, text/plain)
2002-12-24 10:58 UTC, Narayana Pattipati
  Details
pstack of nautilus on solaris-8 where hang is not seen (3.39 KB, text/plain)
2002-12-24 10:59 UTC, Narayana Pattipati
  Details

Description Narayana Pattipati 2002-10-18 07:06:45 UTC
Steps to reproduce the problem:

1) Insert an unformatted zip/floppy media.
2) Desktop icon for zip/floppy will appear on the nautilus desktop. Right  
   click on the icon and select Eject.
3) One error pops up which states "Nautilus was unable to unmount the
selected volume". Details button states 'can't access'. Yet the media is
ejected. Error shouldn't appear.
Comment 1 Narayana Pattipati 2002-10-18 07:10:22 UTC
This is happening for all the media which are unmounted(usually all
unformatted floppy/zip, read-write protected zip, audio_only CD)

When I analysed the code, I found out why there is an error like this. 

nautilus/libnautilus-private/nautilus-volume-monitor.c:mount_unmount_callback()

if (info->command != NULL) {
    open_error_pipe ();
    file = popen (info->command, "r");
    close_error_pipe (info->should_mount, info->mount_point);
    pclose (file);
    g_free (info->command);
}
if (info->should_eject) {
    eject_device
(info->device_path?info->device_path:info->mount_point);

The command for unmounting an unfomatted media is 
volrmmount -e unformatted_media (Or volrmmount -e password_protected
Or volrmmount -e audio_only)

Since unformatted media is not mounted, it can not find the file
unformatted_media/password_protected/audio_only, and gives out the
nautilus error. But it is ejected by the following call eject_device
which takes device_path for ejecting. 
Comment 2 Dave Bordoley [Not Reading Bug Mail] 2002-10-18 19:53:35 UTC
i dont know if this is at all related, but when i insert a cd and it
is automounted using magigdev, i also recieve the sam error when
trying to unmount (redhat 8 plus cvs head with fam).
Comment 3 John Fleck 2002-10-22 13:12:13 UTC
targeting for 2.2, but with lowest priority and severity - the thing
works OK, the only problem seems to be the bogus error message.
Comment 4 Narayana Pattipati 2002-10-26 06:49:54 UTC
Created attachment 11841 [details] [review]
Proposed patch which avoids error while ejecting an unmounted device
Comment 5 Narayana Pattipati 2002-10-30 16:33:35 UTC
I have found out one more problem while ejecting a media from GUI.
Currently nautilus uses "eject <device_path>" to eject the media after
unmounting it. But if the device_path has some special characters, the
shell may not recognise the path and eject may fail.

Code:
nautilus/libnautilus-private/nautilus-volume-monitor.c:eject_device()
   882  static void
   883  eject_device (const char *path)
   884  {
   885          char *command;
   886
   887          if (path != NULL) {
   888                  command = g_strdup_printf ("eject %s", path);
   889                  eel_gnome_shell_execute (command);
   890                  g_free (command);
   891          }
   892  }

So it is better to quote(using g_shell_quote() ) the device_path
before sending it to eject command. 

I have created a patch which does this. The new patch also has changes
covered in the first patch(patch id: 11841). 

Please just take the new patch. With the new patch, old patch becomes
irrelavant.
Comment 6 Narayana Pattipati 2002-10-30 16:37:16 UTC
Created attachment 11913 [details] [review]
Proposed patch with g_shell_quotes
Comment 7 Narayana Pattipati 2002-12-24 10:53:05 UTC
There is a problem with the above patch. The above patch makes Eject
happen directly without unmounting and ejecting. But I found that
nautilus hangs sometimes in Solaris-9 if I eject the media
continuously for 5-6 times. Nautilus does not hang in Solaris-8 if I
do the same. (It's because of the difference in the thread
implementation between S9 and S8.)

I could not fully understand the root cause. But if the eject command
is executed with g_spawn_command_line_async(), this is happening. 

Nautilus is already using a separate thread to mount/unmount/eject a
media. And from that thread callback, eject command is executed using
g_spawn_command_line_async(), which is asynchronous execution. Note
that the mount/unmount command is executed using a synchronous call
i.e using popen() from the same thread callback.

What is the need for executing a command asynchronously from a
thread.?? 

I have replaced asynchronous Eject command execution with popen() and
found that there is no hang.

I will attach the patch and pstack of nautilus hang in S9(also pstack
of nautilus in S8).
Comment 8 Narayana Pattipati 2002-12-24 10:56:41 UTC
Created attachment 13196 [details] [review]
Proposed patch which fixes nautilus hang.
Comment 9 Narayana Pattipati 2002-12-24 10:58:02 UTC
Created attachment 13197 [details]
pstack of nautilus hang when Eject is done several times
Comment 10 Narayana Pattipati 2002-12-24 10:59:26 UTC
Created attachment 13198 [details]
pstack of nautilus on solaris-8 where hang is not seen
Comment 11 Josh Odom 2004-01-05 17:13:16 UTC
This seems like a rather trivial fix. Is there any reason not to apply
it to HEAD? Alex?? 
Comment 12 alexander.winston 2004-01-21 06:34:27 UTC
As of 2004-01-21, the file that this file references,
<file:///cvs/gnome/nautilus/libnautilus-private/nautilus-volume-monitor.c>,
does not exist in CVS revision HEAD.
Comment 13 Narayana Pattipati 2004-02-21 08:04:40 UTC
This patch is for fixing removable media related problems in Solaris.
It does not apply on HEAD anymore as volume management code has
changed in HEAD. Hence closing the bug. Will raise a new bug if the
same problem is found to be there on Solaris running HEAD/2.6.
Comment 14 Christian Neumair 2006-12-26 18:29:58 UTC
Mass reassigning bugs with 2.2.0 milestone to 2.2.x milestone

Grep for "Mass reassigning" to filter out this bug spam.
Comment 15 Christian Neumair 2006-12-26 18:31:21 UTC
Mass reassigning from target milestone "2.2.0" to "2.2.x".

Grep for "Mass reassigning" to reduce bugspam.