From e6665b17a20b5797ec9596fe3f2967b3d8d25206 Mon Sep 17 00:00:00 2001 From: SHIMADA Koji Date: Wed, 10 Aug 2011 16:57:27 +0900 Subject: [PATCH 1/3] fix SiteBackup#TAR_CMD not to specify path directly. --- lib/qwik/act-sitebackup.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/qwik/act-sitebackup.rb b/lib/qwik/act-sitebackup.rb index 8d71056..dff6bff 100644 --- a/lib/qwik/act-sitebackup.rb +++ b/lib/qwik/act-sitebackup.rb @@ -102,9 +102,9 @@ def ext_tgz end class SiteBackup - TAR_CMD = '/bin/tar' # path to tar command (GNU version is required) + TAR_CMD = `which tar`.chomp # path to tar command (GNU version is required) def self.command_exist? - TAR_CMD.path.executable? + !TAR_CMD.empty? end def initialize(site, config) From d295aec1ef7b05cd6e58499a808bd0d819105fb4 Mon Sep 17 00:00:00 2001 From: SHIMADA Koji Date: Wed, 10 Aug 2011 17:18:55 +0900 Subject: [PATCH 2/3] fix check leakage --- lib/qwik/act-sitebackup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/qwik/act-sitebackup.rb b/lib/qwik/act-sitebackup.rb index dff6bff..da53faf 100644 --- a/lib/qwik/act-sitebackup.rb +++ b/lib/qwik/act-sitebackup.rb @@ -104,7 +104,7 @@ def ext_tgz class SiteBackup TAR_CMD = `which tar`.chomp # path to tar command (GNU version is required) def self.command_exist? - !TAR_CMD.empty? + !TAR_CMD.empty? && TAR_CMD.path.executable? end def initialize(site, config) From 11b83275b4f1916e35e77dd1d3a63a16cc70d76f Mon Sep 17 00:00:00 2001 From: SHIMADA Koji Date: Thu, 11 Aug 2011 20:26:41 +0900 Subject: [PATCH 3/3] canditates of tar path is /bin/tar and /usr/bin/tar --- lib/qwik/act-sitebackup.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/qwik/act-sitebackup.rb b/lib/qwik/act-sitebackup.rb index da53faf..3b8a76e 100644 --- a/lib/qwik/act-sitebackup.rb +++ b/lib/qwik/act-sitebackup.rb @@ -102,9 +102,10 @@ def ext_tgz end class SiteBackup - TAR_CMD = `which tar`.chomp # path to tar command (GNU version is required) + TAR_CMD = %w(/bin/tar /usr/bin/tar).detect{|tar| tar.path.executable?} # path to tar command (GNU version is required) + def self.command_exist? - !TAR_CMD.empty? && TAR_CMD.path.executable? + !!TAR_CMD end def initialize(site, config)