Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#10535 closed Patch - Bug Fix (fixed)

mythburn.py crash

Reported by: t.brackertz@… Owned by: Stefan Brackertz <t.brackertz@…>
Priority: minor Milestone: 0.27
Component: Plugin - MythArchive Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Burn a DVD using mytharchive:

In the very end of the process the script tries to eject the burned DVD. If this is impossible it crashes with the following backtrace:

Failed to eject the disc!
chmod: Beim Setzen der Zugriffsrechte für „/mythpuffer/mytharchive/“: Die Operation ist nicht erlaubt
chmod: Beim Setzen der Zugriffsrechte für „/mythpuffer/mytharchive/logs“: Die Operation ist nicht erlaubt
chmod: Beim Setzen der Zugriffsrechte für „/mythpuffer/mytharchive/logs/mythburn.log“: Die Operation ist nicht erlaubt
chmod: Beim Setzen der Zugriffsrechte für „/mythpuffer/mytharchive/config“: Die Operation ist nicht erlaubt
chmod: Beim Setzen der Zugriffsrechte für „/mythpuffer/mytharchive/config/mydata.xml“: Die Operation ist nicht erlaubt
chmod: Beim Setzen der Zugriffsrechte für „/mythpuffer/mytharchive/work“: Die Operation ist nicht erlaubt
------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/share/mythtv/mytharchive/scripts/mythburn.py", line 5182, in main
    processJob(job)
  File "/usr/share/mythtv/mytharchive/scripts/mythburn.py", line 4980, in processJob
    BurnDVDISO(title)
  File "/usr/share/mythtv/mytharchive/scripts/mythburn.py", line 2335, in BurnDVDISO
    tray(CDROM.CDROMEJECT)
  File "/usr/share/mythtv/mytharchive/scripts/mythburn.py", line 2266, in tray
    os.close(f)
UnboundLocalError: local variable 'f' referenced before assignment
------------------------------------------------------------

The produced DVD is fine. But the script leaves back a .lock-file which prevents the user from burning another DVD.

Path attached.

Attachments (3)

mythburn.py.patch (1.1 KB) - added by t.brackertz@… 12 years ago.
Path against current git (2012-4-1): mythtv/mythplugins/mytharchive/mythburn/scripts/mythburn.py
mythburn.py.patch_2 (3.6 KB) - added by t.brackertz@… 11 years ago.
improved path
mythburn.py.path_3 (8.7 KB) - added by t.brackertz@… 11 years ago.
Improved version of the path against current git.

Download all attachments as: .zip

Change History (11)

Changed 12 years ago by t.brackertz@…

Attachment: mythburn.py.patch added

Path against current git (2012-4-1): mythtv/mythplugins/mytharchive/mythburn/scripts/mythburn.py

comment:1 Changed 12 years ago by business.weston@…

I'm seeing this issue in .25.

comment:2 Changed 11 years ago by Mike Kutner <videoguy1080@…>

I confirmed that the patch fixes the crash in 26.1. Thank you! On my system (Mythbuntu 12.04.1) there are two subsequent issues:

  • the script calls 'pumount' which is not installed

https://bugs.launchpad.net/mythbuntu/+bug/1069823

  • in any case the disc does not eject - likely because the script should call 'eject'

I recommend incorporating this patch into mythtv.

comment:3 Changed 11 years ago by t.brackertz@…

In earlyer versions of the script the programm eject was used. Now

            r = ioctl(f,action, 0)

should eject the drive. The aim to change this was to avoid an additional dependency, get a clearer code and better error handling. This doesn't always work but eject didn't always work, either. So it was no regression.

I think we have to figure out, if using the scsi-eject command or some unlock-command has to be tried in addition.

comment:4 Changed 11 years ago by Mike Kutner <videoguy1080@…>

Ah - yes - you are absolutely correct. Your attached patch fixes the original issue and should be accepted.

I verified that my failure to eject is the same as http://code.mythtv.org/trac/ticket/4022. The root cause is that /lib/udev/rules.d/60-cdrom_id.rules locks the CD/DVD drive. I am not a python expert, but this change to mythburn.py fixes the failure to eject:

@@ -2254,6 +2254,8 @@ def BurnDVDISO(title):
         waitForDrive()
         res = False
         f = os.open(dvddrivepath, os.O_RDONLY | os.O_NONBLOCK)
+        if (action == CDROM.CDROMEJECT):
+            ioctl(f, CDROM.CDROM_LOCKDOOR, 0)
         try:
             ioctl(f,action, 0)
             res = True

I am not sure how this works for the case that the CD/DVD drive is not locked. Do you think that I should move this to a separate issue?

Changed 11 years ago by t.brackertz@…

Attachment: mythburn.py.patch_2 added

improved path

comment:5 Changed 11 years ago by t.brackertz@…

mythburn.py.patch_2​ doesn't only fix the crash issue but gives a more robust eject-mechanism in addition. "eject" is used as fallback if installed.

Fixes http://code.mythtv.org/trac/ticket/4022 too

comment:6 Changed 11 years ago by Mike Kutner <videoguy1080@…>

I confirmed that mythburn.py.patch_2 fixes both the original issue and 4022 - thank you very much.

Changed 11 years ago by t.brackertz@…

Attachment: mythburn.py.path_3 added

Improved version of the path against current git.

comment:7 Changed 11 years ago by Stefan Brackertz <t.brackertz@…>

Owner: set to Stefan Brackertz <t.brackertz@…>
Resolution: fixed
Status: newclosed

In bf10280b5fcb90b4a011e656a863e551665881fc/mythtv:

mythburn.py: fix ejecting the DVD on some systems and file encoding fixes

Fixes #10535. Refs #4022.

Signed-off-by: Paul Harrison <pharrison@…>

comment:8 Changed 11 years ago by paulh

Milestone: unknown0.27
Version: UnspecifiedMaster Head
Note: See TracTickets for help on using tickets.