Bug 116037 - Rewrites CD-RW when doing "Copy CD..." and source and destination drive are the same
Summary: Rewrites CD-RW when doing "Copy CD..." and source and destination drive are t...
Status: RESOLVED FIXED
Alias: None
Product: k3b
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal with 10 votes (vote)
Target Milestone: ---
Assignee: Sebastian Trueg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-10 03:20 UTC by Francois Marier
Modified: 2005-12-05 14:52 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois Marier 2005-11-10 03:20:28 UTC
Version:           0.12.7 (using KDE KDE 3.4.2)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Sebastián Cruz <default50@yahoo.com.ar> reported the following bug on the Debian bug tracking system (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=338274):

This bug shows up when you want to duplicate a CD-RW and the option
"Automatically erase CD-RWs..." is set in the options menu.
k3b reads correctly the source image from the CD-RW but instead of
asking for the destination CD it erases the source CD-RW and writes the
image back on it.
Comment 1 Sebastian Trueg 2005-11-21 13:50:14 UTC
do you use an automounting service. If so that is probably the problem:
k3b tries to eject the medium. when that fails it reuses the same medium.

I should add an additional check...
Comment 2 Sebastian Cruz 2005-11-22 04:25:44 UTC
I do use an automounter service, the one from Gnome. I don't use KDE, I'm a Gnome user, but for me k3b is the best burning software.
It's strange but k3b never fails to eject the disc in any other ways. Even when duplicating with the CD-RW (when the bug shows) it successfully eject the CD after blanking it.
The process would be something like this:
Insert source CD (CD-RW) - Automounter mounts it - Start copying in k3b - Read the CD-RW - Erases the CD-RW - Eject and load the CD (automatically) - Write the CD-RW with same image.

Hope this info helps. If you need anything else just say so.
Comment 3 Sebastian Trueg 2005-12-05 14:52:36 UTC
SVN commit 485710 by trueg:

Stop with an error if k3b is not able to eject the source medium in case
source and burn device are the same.

BUG: 116037


 M  +8 -2      k3bcdcopyjob.cpp  
 M  +12 -2     k3bdvdcopyjob.cpp  


--- branches/stable/extragear/multimedia/k3b/libk3b/jobs/k3bcdcopyjob.cpp #485709:485710
@@ -957,8 +957,14 @@
 	d->readingSuccessful = true;
 	if( !m_onlyCreateImages ) {
 	  if( m_readerDevice == m_writerDevice ) {
-	    // eject the media
-	    K3bDevice::eject( m_readerDevice );
+	    // eject the media (we do this blocking to know if it worked
+	    // becasue if it did not it might happen that k3b overwrites a CD-RW
+	    // source)
+	    if( !m_readerDevice->eject() ) {
+	      emit infoMessage( i18n("Unable to eject media."), ERROR );
+	      finishJob( false, true );
+	      return;
+	    }
 	  }
 	  
 	  if( !writeNextSession() ) {
--- branches/stable/extragear/multimedia/k3b/libk3b/jobs/k3bdvdcopyjob.cpp #485709:485710
@@ -506,7 +506,17 @@
     }
     else {
       if( m_writerDevice == m_readerDevice )
-	m_readerDevice->eject();
+	// eject the media (we do this blocking to know if it worked
+	// becasue if it did not it might happen that k3b overwrites a CD-RW
+	// source)
+	if( !m_readerDevice->eject() ) {
+	  emit infoMessage( i18n("Unable to eject media."), ERROR );
+	  if( m_removeImageFiles )
+	    removeImageFiles();
+	  d->running = false;
+	  emit finished(false);
+	  return;
+	}
 
       if( !m_onTheFly ) {
 	if( waitForDvd() ) {
@@ -526,8 +536,8 @@
 	    removeImageFiles();
 	  if( d->canceled )
 	    emit canceled();
+	  d->running = false;
 	  emit finished(false);
-	  d->running = false;
 	}
       }
     }