Version: 3.4.0 (using KDE 3.4.0, Debian Package 4:3.4.0-0pre3 (3.1)) Compiler: gcc version 3.3.5 (Debian 1:3.3.5-8) OS: Linux (i686) release 2.4.27-1-386 When I want to format a mounted floppy, the KDE Floppy Formatter gives inappropriate error messages (something about density being 0).
Does the error message happens when full formatting or with fast formatting?
That doesn't matter. If I manually un-mount the floppy before attemting the format, it works. I guess that KFloppy fails to check that the un-mount was successful or, perhaps doesn't even attempt to unmount the device for some reason).
No indeed, KFloppy does not try to umount. On Friday 06 May 2005 16:08, Vladimir Panteleev wrote: (...) > ------- That doesn't matter. If I manually un-mount the floppy before > attemting the format, it works. I guess that KFloppy fails to check that > the un-mount was successful or, perhaps doesn't even attempt to unmount the > device for some reason).
Well... shouldn't that be fixed? A bit un-user-friendly, IMHO... Or at least give an approrpiate error message, like "Un-mount the floppy first".
On Friday 06 May 2005 16:25, Vladimir Panteleev wrote: (...) > ------- Well... shouldn't that be fixed? A bit un-user-friendly, IMHO... Or > at least give an approrpiate error message, like "Un-mount the floppy > first". I would not mind an error message, if the called program (fdformat, mkfs...) gives a correctly identifiable error message back.
SVN commit 410059 by goutte: - Try to give useful messages why a program (especially fdformat) has failed (Especially allow more than one error message to be passed to the dialog.) - Be more careful while processing fdformat errors (Checking for numbers must be last, as /dev/fd0u1440 contains a number too.) CCBUG:87637 - Give a better error message if fdformat cannot work because the device is mounted. (The work is done only for fdformat now.) CCBUG:103954 M +14 -1 trunk/KDE/kdeutils/kfloppy/floppy.cpp M +19 -12 trunk/KDE/kdeutils/kfloppy/format.cpp --- trunk/KDE/kdeutils/kfloppy/floppy.cpp #410058:410059 @@ -410,6 +410,9 @@ // formatbutton->setText(i18n("A&bort")); setEnabled(false); + // Erase text box + frame->setText( QString::null ); + if (!findDevice()) { reset(); @@ -515,7 +518,17 @@ { kdDebug(2002) << "FloppyData::formatStatus: " << s << " : " << p << endl; if (!s.isEmpty()) - frame->setText(s); + { + const QString oldText ( frame->text() ); + if ( oldText.isEmpty() ) + { + frame->setText( s ); + } + else + { + frame->setText( oldText + '\n' + s ); + } + } if ((0<=p) && (p<=100)) progress->setValue(p); --- trunk/KDE/kdeutils/kfloppy/format.cpp #410058:410059 @@ -332,13 +332,13 @@ } else { - emit status(i18n("%1 terminated with an error.").arg(theProcessName),100); + emit status(i18n("The program %1 terminated with an error.").arg(theProcessName),100); emit done(this,false); } } else { - emit status(i18n("%1 terminated abnormally.").arg(theProcessName),100); + emit status(i18n("The program %1 terminated abnormally.").arg(theProcessName),100); emit done(this,false); } } @@ -504,16 +504,6 @@ } return; } - else if ( regexp.search(s) > -1 ) - { - // Normal track number (formatting or verifying) - const int p = regexp.cap(1).toInt(); - if ((p>=0) && (p<deviceInfo->tracks)) - { - emit status(QString::null, - p * 100 / deviceInfo->tracks); - } - } else if (s.find("ioctl(FDFMTBEG)")!=-1) { emit status (i18n( @@ -522,11 +512,28 @@ "have selected a valid floppy drive."),-1); return; } + else if (s.find("busy")!=-1) // "Device or resource busy" + { + emit status(i18n("Device busy!\nPerhaps you need to unmount the floppy first!"),-1); + return; + } + // Be careful to leave "iotcl" as last before checking numbers else if (s.find("ioctl")!=-1) { emit status(i18n("Low-level format error: %1").arg(s),-1); return; } + // Check for numbers at last (as /dev/fd0u1440 has numbers too) + else if ( regexp.search(s) > -1 ) + { + // Normal track number (formatting or verifying) + const int p = regexp.cap(1).toInt(); + if ((p>=0) && (p<deviceInfo->tracks)) + { + emit status(QString::null, + p * 100 / deviceInfo->tracks); + } + } #endif return; }
SVN commit 410067 by goutte: Propagate the "device busy" error to the user (FAT, Ext2, Minix) (Unfortunately, it is shown two times currently!) (Linux only) CCBUG: 103954 CCBUG: 87637 M +55 -1 trunk/KDE/kdeutils/kfloppy/format.cpp M +9 -1 trunk/KDE/kdeutils/kfloppy/format.h --- trunk/KDE/kdeutils/kfloppy/format.cpp #410066:410067 @@ -626,11 +626,29 @@ } } +void FATFilesystem::processStdOut(KProcess *, char *b, int l) +{ +#ifdef ANY_BSD + // ### TODO: do some checks +#elif defined(ANY_LINUX) + QString s ( QString::fromLatin1( b, l ) ); + kdDebug(KFAREA) << s << endl; + if (s.find("mounted file system")!=-1) // "/dev/fd0 contains a mounted file system + { + emit status(i18n("Floppy is mounted!\nYou need to unmount the floppy first!"),-1); + return; + } + else if (s.find("busy")!=-1) // "Device or resource busy" + { + emit status(i18n("Device busy!\nPerhaps you need to unmount the floppy first!"),-1); + return; + } +#endif +} - #ifdef ANY_BSD /* static */ QString UFSFilesystem::newfs = QString::null ; @@ -758,8 +776,28 @@ } } +void Ext2Filesystem::processStdOut(KProcess *, char *b, int l) +{ +#ifdef ANY_BSD + // ### TODO: do some checks +#elif defined(ANY_LINUX) + QString s ( QString::fromLatin1( b, l ) ); + kdDebug(KFAREA) << s << endl; + if (s.find("mounted")!=-1) // "/dev/fd0 is mounted; will not make a filesystem here!" + { + emit status(i18n("Floppy is mounted!\nYou need to unmount the floppy first!"),-1); + return; + } + else if (s.find("busy")!=-1) // "Device or resource busy" + { + emit status(i18n("Device busy!\nPerhaps you need to unmount the floppy first!"),-1); + return; + } +#endif +} + #endif #ifdef ANY_LINUX @@ -833,6 +871,22 @@ } } +void MinixFilesystem::processStdOut(KProcess *, char *b, int l) +{ + QString s ( QString::fromLatin1( b, l ) ); + kdDebug(KFAREA) << s << endl; + if (s.find("mounted")!=-1) // "mkfs.minix: /dev/fd0 is mounted; will not make a filesystem here!" + { + emit status(i18n("Floppy is mounted!\nYou need to unmount the floppy first!"),-1); + return; + } + else if (s.find("busy")!=-1) // "Device or resource busy" + { + emit status(i18n("Device busy!\nPerhaps you need to unmount the floppy first!"),-1); + return; + } +} + #endif #include "format.moc" --- trunk/KDE/kdeutils/kfloppy/format.h #410066:410067 @@ -283,6 +283,9 @@ */ bool configure(bool verify, bool label, const QString &l); + /// Parse output + virtual void processStdOut(KProcess*, char* b, int l); + protected: static QString newfs_fat; @@ -313,6 +316,9 @@ /// Same args as FATFilesystem::configure bool configure(bool verify, bool label, const QString &l); + + /// Parse output + virtual void processStdOut(KProcess*, char* b, int l); protected: static QString newfs; @@ -358,7 +364,9 @@ /// Same args as FATFilesystem::configure bool configure(bool verify, bool label, const QString &l); - + + /// Parse output + virtual void processStdOut(KProcess*, char* b, int l); protected: static QString newfs;
Now in "trunk" (formally known as CVS HEAD), when needed, KFloppy gives an error message asking the user to check if he has to unmount the floppy. There is a backport to the KDE 3.4.x branch, but the error message is here one that already exist, so it is less informatively for the user. (But it is an error message at least!) As for unmounting automatically, I think that it is too dangerous. The user might not want to format the floppy that he has forgotten in the floppy drive. The floppy might have valuable data! So I prefer that the user has to make an active action to unmount the floppy, outside KFloppy. Have a nice day!