From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-2.2 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A9CBB20163 for ; Mon, 13 Apr 2015 01:04:36 +0000 (UTC) Received: from localhost ([::1]:46659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhSnk-0005Cw-0D for dtas-all@80x24.org; Sun, 12 Apr 2015 21:04:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhSnh-0005Bs-BO for dtas-all@nongnu.org; Sun, 12 Apr 2015 21:04:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YhSnf-0002yG-RK for dtas-all@nongnu.org; Sun, 12 Apr 2015 21:04:33 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:36049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhSnf-0002xR-Lk for dtas-all@nongnu.org; Sun, 12 Apr 2015 21:04:31 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 3209A20137 for ; Mon, 13 Apr 2015 01:04:28 +0000 (UTC) From: Eric Wong To: Subject: [PATCH 2/3] escape INFILE and related environment variables Date: Mon, 13 Apr 2015 01:04:23 +0000 Message-Id: <1428887064-18715-3-git-send-email-e@80x24.org> In-Reply-To: <1428887064-18715-1-git-send-email-e@80x24.org> References: <1428887064-18715-1-git-send-email-e@80x24.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: dtas-all-bounces+dtas-all=80x24.org@nongnu.org We may expand them, so ensure they're properly escaped, first for use in shell snippets. --- lib/dtas/partstats.rb | 2 +- lib/dtas/source/av_ff_common.rb | 2 +- lib/dtas/source/sox.rb | 2 +- lib/dtas/splitfx.rb | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/dtas/partstats.rb b/lib/dtas/partstats.rb index 9d3312b..bc13480 100644 --- a/lib/dtas/partstats.rb +++ b/lib/dtas/partstats.rb @@ -55,7 +55,7 @@ class DTAS::PartStats rd, wr = IO.pipe env = opts[:env] env = env ? env.dup : {} - env["INFILE"] = @infile + env["INFILE"] = xs(@infile) env["TRIMFX"] = "trim #{trim_part.tbeg}s #{trim_part.tlen}s" opts = { pgroup: true, close_others: true, err: wr } pid = spawn(env, CMD, opts) diff --git a/lib/dtas/source/av_ff_common.rb b/lib/dtas/source/av_ff_common.rb index 189e135..9f29b02 100644 --- a/lib/dtas/source/av_ff_common.rb +++ b/lib/dtas/source/av_ff_common.rb @@ -158,7 +158,7 @@ module DTAS::Source::AvFfCommon # :nodoc: e["PROBE"] = @probe_harder ? @probe_harder.join(' ') : nil # make sure these are visible to the source command... - e["INFILE"] = @infile + e["INFILE"] = xs(@infile) e["AMAP"] = amap e["SSPOS"] = sspos e["RGFX"] = rg_state.effect(self) || nil diff --git a/lib/dtas/source/sox.rb b/lib/dtas/source/sox.rb index 91a3c40..6f02f99 100644 --- a/lib/dtas/source/sox.rb +++ b/lib/dtas/source/sox.rb @@ -78,7 +78,7 @@ class DTAS::Source::Sox # :nodoc: def src_spawn(player_format, rg_state, opts) raise "BUG: #{self.inspect}#src_spawn called twice" if @to_io e = @env.merge!(player_format.to_env) - e["INFILE"] = @infile + e["INFILE"] = xs(@infile) # make sure these are visible to the "current" command... e["TRIMFX"] = trimfx diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb index 022fbfe..fcd0028 100644 --- a/lib/dtas/splitfx.rb +++ b/lib/dtas/splitfx.rb @@ -362,8 +362,10 @@ class DTAS::SplitFX # :nodoc: end def infile_env(env, infile) - env["INFILE"] = infile - env["INDIR"], env["INBASE"] = File.split(File.expand_path(infile)) + env["INFILE"] = xs(infile) + dir, base = File.split(File.expand_path(infile)) + env["INDIR"] = xs(dir) + env["INBASE"] = xs(base) end def _expand_cmd(env, command) -- EW