From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 2F0A51F5AE for ; Tue, 25 May 2021 10:31:22 +0000 (UTC) Received: from localhost ([::1]:58202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llULF-00058t-6f for e@80x24.org; Tue, 25 May 2021 06:31:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llULA-00058e-W8 for dtas-all@nongnu.org; Tue, 25 May 2021 06:31:13 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:40738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llUL8-00037J-68 for dtas-all@nongnu.org; Tue, 25 May 2021 06:31:12 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2C0031F5AE for ; Tue, 25 May 2021 10:30:05 +0000 (UTC) From: Eric Wong To: dtas-all@nongnu.org Subject: [PATCH] do not shell-quote filenames for environment Date: Tue, 25 May 2021 10:30:05 +0000 Message-Id: <20210525103005.17234-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=64.71.152.64; envelope-from=e@80x24.org; helo=dcvr.yhbt.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: duct tape audio suite List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+e=80x24.org@nongnu.org Sender: "dtas-all" This allows dtas-player to play files with wonky filenames when piping ffmpeg (or avconv) to sox. SoX-only code dtas-player paths are not affected since they don't require an extra Bourne shell. All of our internal shell pipelines quote "$INFILE", anyways, so there was never any need to escape for those. This may cause compatibility problems for splitfx users, but splitfx is probably too esoteric to have any users besides myself. And I expect anybody editing audio with dtas-splitfx to pick shell-friendly filenames. dtas-player is far more general, and likely to encounter shell-unfriendly filenames which require quoting. --- lib/dtas/partstats.rb | 3 +-- lib/dtas/source/av_ff_common.rb | 2 +- lib/dtas/source/sox.rb | 2 +- lib/dtas/splitfx.rb | 8 +++----- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/dtas/partstats.rb b/lib/dtas/partstats.rb index 75f9236..45eff34 100644 --- a/lib/dtas/partstats.rb +++ b/lib/dtas/partstats.rb @@ -3,7 +3,6 @@ # License: GPL-3.0+ # frozen_string_literal: true require_relative '../dtas' -require_relative 'xs' require_relative 'process' require_relative 'sigevent' @@ -56,7 +55,7 @@ def partstats_spawn(trim_part, opts) rd, wr = IO.pipe env = opts[:env] env = env ? env.dup : {} - env["INFILE"] = xs(@infile) + env["INFILE"] = @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 88bfe50..6f92762 100644 --- a/lib/dtas/source/av_ff_common.rb +++ b/lib/dtas/source/av_ff_common.rb @@ -186,7 +186,7 @@ def src_spawn(player_format, rg_state, opts) e["PROBE"] = @probe_harder ? @probe_harder.join(' ') : nil # make sure these are visible to the source command... - e["INFILE"] = xs(@infile) + e["INFILE"] = @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 d63f0df..3a7fe7d 100644 --- a/lib/dtas/source/sox.rb +++ b/lib/dtas/source/sox.rb @@ -113,7 +113,7 @@ def __load_comments 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"] = xs(@infile) + e["INFILE"] = @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 58c8ff4..9e1cfd0 100644 --- a/lib/dtas/splitfx.rb +++ b/lib/dtas/splitfx.rb @@ -4,7 +4,6 @@ require_relative '../dtas' require_relative 'format' require_relative 'process' -require_relative 'xs' require 'tempfile' # The backend for dtas-splitfx(1) command, but also supported by dtas-player @@ -13,7 +12,6 @@ class DTAS::SplitFX # :nodoc: CMD = 'sox "$INFILE" $COMMENTS $OUTFMT $OUTDST $TRIMFX $FX $RATEFX $DITHERFX' include DTAS::Process - include DTAS::XS attr_reader :infile, :env, :command # for --trim on the command-line @@ -404,10 +402,10 @@ def cuebreakpoints end def infile_env(env, infile) - env["INFILE"] = xs(infile) + env["INFILE"] = infile dir, base = File.split(File.expand_path(infile)) - env["INDIR"] = xs(dir) - env["INBASE"] = xs(base) + env["INDIR"] = dir + env["INBASE"] = base end def expand_cmd(env, command) # for display purposes only