From cd8d80c314e03d4117c491b8881f8b68f52f277f Mon Sep 17 00:00:00 2001 From: S Anand Date: Sat, 3 Sep 2016 18:04:15 +0530 Subject: [PATCH 1/2] tar treats Windows paths (D:\file.tar) as local files. Fixes #42 Apparently tar has capabilities for the extraction from remote locations but in my (@yarikoptic) experience I have never ran into someone using it since it requires some rmt server to be running etc. So let's just favor for files containing columns which are not generally forbidden. --- patoolib/programs/tar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patoolib/programs/tar.py b/patoolib/programs/tar.py index d8d1d36..5a275c2 100644 --- a/patoolib/programs/tar.py +++ b/patoolib/programs/tar.py @@ -19,14 +19,14 @@ import os def extract_tar (archive, compression, cmd, verbosity, interactive, outdir): """Extract a TAR archive.""" - cmdlist = [cmd, '--extract'] + cmdlist = [cmd, '--force-local', '--extract'] add_tar_opts(cmdlist, compression, verbosity) cmdlist.extend(["--file", archive, '--directory', outdir]) return cmdlist def list_tar (archive, compression, cmd, verbosity, interactive): """List a TAR archive.""" - cmdlist = [cmd, '--list'] + cmdlist = [cmd, '--force-local', '--list'] add_tar_opts(cmdlist, compression, verbosity) cmdlist.extend(["--file", archive]) return cmdlist @@ -35,7 +35,7 @@ test_tar = list_tar def create_tar (archive, compression, cmd, verbosity, interactive, filenames): """Create a TAR archive.""" - cmdlist = [cmd, '--create'] + cmdlist = [cmd, '--force-local', '--create'] add_tar_opts(cmdlist, compression, verbosity) cmdlist.extend(["--file", archive, '--']) cmdlist.extend(filenames) From c412699f66aec0b6d22b576bc97e9a6ee01f6e43 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 11 Sep 2018 23:31:49 -0400 Subject: [PATCH 2/2] BF: add --force-local ONLY to tar invocation bsdtar apparently does not provide it, and I am not aware of the other ones --- patoolib/programs/tar.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/patoolib/programs/tar.py b/patoolib/programs/tar.py index 5a275c2..9b1c423 100644 --- a/patoolib/programs/tar.py +++ b/patoolib/programs/tar.py @@ -19,14 +19,14 @@ import os def extract_tar (archive, compression, cmd, verbosity, interactive, outdir): """Extract a TAR archive.""" - cmdlist = [cmd, '--force-local', '--extract'] + cmdlist = [cmd, '--extract'] add_tar_opts(cmdlist, compression, verbosity) cmdlist.extend(["--file", archive, '--directory', outdir]) return cmdlist def list_tar (archive, compression, cmd, verbosity, interactive): """List a TAR archive.""" - cmdlist = [cmd, '--force-local', '--list'] + cmdlist = [cmd, '--list'] add_tar_opts(cmdlist, compression, verbosity) cmdlist.extend(["--file", archive]) return cmdlist @@ -35,7 +35,7 @@ test_tar = list_tar def create_tar (archive, compression, cmd, verbosity, interactive, filenames): """Create a TAR archive.""" - cmdlist = [cmd, '--force-local', '--create'] + cmdlist = [cmd, '--create'] add_tar_opts(cmdlist, compression, verbosity) cmdlist.extend(["--file", archive, '--']) cmdlist.extend(filenames) @@ -60,3 +60,5 @@ def add_tar_opts (cmdlist, compression, verbosity): cmdlist.extend(['--use-compress-program', program]) if verbosity > 1: cmdlist.append('--verbose') + if progname == 'tar': + cmdlist.append('--force-local')