From 6a8355b1097afbdca4e7c2e0a6622815495cfdbb Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Tue, 22 Mar 2011 17:31:36 +0000 Subject: [PATCH] * morituri/common/program.py: * morituri/rip/offset.py: When finding the offset, also load and possibly unmount, resolving to the real path for the device. --- ChangeLog | 7 +++++++ morituri/common/program.py | 4 ++++ morituri/rip/offset.py | 13 +++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46c797b..733f1da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-03-22 Thomas Vander Stichele + + * morituri/common/program.py: + * morituri/rip/offset.py: + When finding the offset, also load and possibly unmount, resolving + to the real path for the device. + 2011-03-20 Thomas Vander Stichele * morituri/common/encode.py: diff --git a/morituri/common/program.py b/morituri/common/program.py index eaebfff..9ea1b48 100644 --- a/morituri/common/program.py +++ b/morituri/common/program.py @@ -189,7 +189,11 @@ class Program(log.Loggable): """ Unmount the given device if it is mounted, as happens with automounted data tracks. + + If the given device is a symlink, the target will be checked. """ + device = os.path.realpath(device) + self.debug('possibly unmount real path %r' % device) proc = open('/proc/mounts').read() if device in proc: print 'Device %s is mounted, unmounting' % device diff --git a/morituri/rip/offset.py b/morituri/rip/offset.py index 81266a9..36f71d5 100644 --- a/morituri/rip/offset.py +++ b/morituri/rip/offset.py @@ -26,7 +26,7 @@ import tempfile import gobject gobject.threads_init() -from morituri.common import logcommand, task, accurip, drive +from morituri.common import logcommand, task, accurip, drive, program from morituri.image import image from morituri.program import cdrdao, cdparanoia @@ -86,10 +86,19 @@ CD in the AccurateRip database.""" def do(self, args): + prog = program.Program() runner = task.SyncRunner() + device = self.options.device + + # if necessary, load and unmount + print 'Checking device', device + + prog.loadDevice(device) + prog.unmountDevice(device) + # first get the Table Of Contents of the CD - t = cdrdao.ReadTOCTask(device=self.options.device) + t = cdrdao.ReadTOCTask(device=device) try: runner.run(t)