[RARSLAVE] Fix noextract extraction
authorIra W. Snyder <devel@irasnyder.com>
Wed, 27 Dec 2006 04:25:15 +0000 (20:25 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Wed, 27 Dec 2006 04:25:15 +0000 (20:25 -0800)
This adds a fix to the noextract type of extraction (usually mv), which
will exit early (and successfully) if the same file is being moved between.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
rarslave.py

index ceb7eac..739fdc7 100644 (file)
@@ -103,6 +103,10 @@ class RarslaveExtractor (object):
                # FIXME: NOTE: mv will fail by itself if you're moving to the same dir!
                NOEXTRACT_CMD = config.get_value ('commands', 'noextract')
 
+               # Make sure that both files are not the same file. If they are, don't run at all.
+               if os.path.samefile (file, os.path.join (todir, file)):
+                       return SUCCESS
+
                cmd = NOEXTRACT_CMD % (file, todir)
                ret = run_command (cmd)