hi

I (probably) tracked down a nasty bug that has been biting my freevo box
for few months; and it rendered CDROMs usage almost impossible

symptoms: when accessing the CDROM, either freevo would crash, or,
(after I patched the code) when I tried to access deeper into the CDROM
filesystem tree, freevo would jump off the directories of the CDROM

The traceback of the crash  is
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/freevo/main.py", line 290, in
eventhandler
    app.eventhandler(event)
  File "/usr/lib/python2.4/site-packages/freevo/menu.py", line 673, in
eventhandler
    action( arg=arg, menuw=self )
  File "/usr/lib/python2.4/site-packages/freevo/directory.py", line 477,
in cwd
    self.check_password_and_build(arg=None, menuw=menuw)
  File "/usr/lib/python2.4/site-packages/freevo/directory.py", line 532,
in check_password_and_build
    self.build(arg=arg, menuw=menuw)
  File "/usr/lib/python2.4/site-packages/freevo/directory.py", line 788,
in build
    dirwatcher.cwd(menuw, self, item_menu, self.dir)
  File "/usr/lib/python2.4/site-packages/freevo/directory.py", line
1004, in cwd    self.last_time = vfs.mtime(self.dir)
  File "/usr/lib/python2.4/site-packages/freevo/util/vfs.py", line 131,
in mtime    t = os.stat(name)[ST_MTIME]
OSError: [Errno 2] No such file or directory: '/cdrom/Rock'


so I patched as follows, to avoid the crash:
--- freevo-1.7.1/src/directory.py       2007-03-27 21:48:47.000000000 +0200
+++ /usr/lib/python2.4/site-packages/freevo/directory.py
2007-05-06 16:35:58.000000000 +0200
@@ -1001,7 +1001,12 @@
             self.last_time = item.__dirwatcher_last_time__
             self.files     = item.__dirwatcher_last_files__
         except AttributeError:
-            self.last_time = vfs.mtime(self.dir)
+            #if self.dir is on a removable media, this may fail
+            try:
+                self.last_time = vfs.mtime(self.dir)
+            except OSError:
+                print 'FILE has disappeared ??? ',self.dir
+                return
             self.files     = self.listoverlay()
             self.item.__dirwatcher_last_time__  = self.last_time
             self.item.__dirwatcher_last_files__ = self.files


I then used 'freevo -trace' and I noted those lines
when accessing my CD datas:


....
rom_drives.py (357): Mounting disc in drive CD-1
rom_drives.py (366): Unmounting disc in drive CD-1
FILE has disappeared ???  /cdrom/Classica
....
directory.py (1023): Dirwatcher: unable to read directory /cdrom/Classica
main.py (264): handling event MENU_BACK_ONE_MENU
.....


So it seems that the whole problem is that 'dirwatcher' is not aware
that my CDROM is a removable drive; and when the rom drive is
automatically unmounted (and this happens very often, even while I am
browsing) there is either a crash (if the code at directory.py 1004 is
invoked) or the menu jumps out of the CDROM (if the code at directory.py
1023 is invoked)

what is the correct way to fix this?

solution a) do not unmount the CDROMS while the user is browsing it
solution b) fix directory.c so that it remounts the CDROM where this is
needed

a.

ps: I found this crash after debugging the other one, that was due to
the encodings.... indeed I had a lot of problems using CDs in my freevo box

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to