Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJVia-0008Hg-M9 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2020 05:15:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJViZ-0006Yx-Kk for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2020 05:15:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJViZ-0006Ya-6G for pgsql-hackers@lists.postgresql.org; Wed, 01 Apr 2020 05:15:11 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jJViW-0000mU-Lr for pgsql-hackers@postgresql.org; Wed, 01 Apr 2020 05:15:10 +0000 Received: by mail-pj1-x1036.google.com with SMTP id ng8so2191936pjb.2 for ; Tue, 31 Mar 2020 22:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2/0j7EweTExSqHIR8FWQr5SGBwMdpX+6svDxSYisMEY=; b=OagtbgvFIDqkyjFQKpjcjcSoj0ZXnQmtPV+5HDpuL4tLiLaQYAgooeA2q2OmVi/rfV qVK3ABZv4rWXpU0FI9+TrwNnxwXoz8cGa8aPImw2ZeOTbXyKU+5Ehar3uxFGeiRCgfDt hw28nYTmfY0RJpcn38N1aBRFCEne+1PFyXAzI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2/0j7EweTExSqHIR8FWQr5SGBwMdpX+6svDxSYisMEY=; b=sOFhRdjza91SZXRTW7kL2nToR0OQDN7Vb9D6l6ddflhz7D5zB4glggtNDbEwvtqLnV 56b+X/QEIUpindSEedzjBxAUp64HPCCM3UPFlas9LEANH/4WsoaS02Lmma2dr+16nB85 NG7IarwlzSf9zgCuf+MEAjrbfDiRqHJ/USl8GNk6lKa33O3wT7VrLE/q5Y2APR81hB2K MmtpaEYx1DSdxqleHvLDt6JAYcvbEhsedfIY7c0omnz/oAXcwbDOirjBw7wJPouXBy9K XzdNHzT8bBviwAffw2Y6BKDWzW4tZnJ9kR9dL+++TLgpoGRVe988dPUQwAmL9gIPc7+j Vtdg== X-Gm-Message-State: ANhLgQ1mnp08sWwMSjXmLzbEga+u2zp0hT+d0Y3FqQlFIegH1jDeyCZy i6MrFrkVAAdAotmtA0iEzpDY4A== X-Google-Smtp-Source: ADFU+vtLXPG3aDlFRBiSYNBUZUyRL/zrpJBLyFzogAbl/O9n6SQwTAkvUACKCfaaMvRxiSS/QIdQBw== X-Received: by 2002:a17:902:7809:: with SMTP id p9mr20722501pll.190.1585718107643; Tue, 31 Mar 2020 22:15:07 -0700 (PDT) Received: from rfd.leadboat.com (108-233-125-46.lightspeed.sntcca.sbcglobal.net. [108.233.125.46]) by smtp.gmail.com with ESMTPSA id u13sm526194pgp.49.2020.03.31.22.15.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2020 22:15:06 -0700 (PDT) Date: Tue, 31 Mar 2020 22:15:04 -0700 From: Noah Misch To: Andres Freund Cc: Robert Haas , David Steele , Stephen Frost , Amit Kapila , Suraj Kharage , tushar , Rajkumar Raghuwanshi , Rushabh Lathia , Tels , Andrew Dunstan , PostgreSQL Hackers , Jeevan Chalke , vignesh C Subject: Re: backup manifests Message-ID: <20200401051504.GA3366291@rfd.leadboat.com> References: <20200329034010.GB2247658@rfd.leadboat.com> <20200330010740.4remdjgnftyuiz2v@alap3.anarazel.de> <20200330020814.nspra4mvby42yoa4@alap3.anarazel.de> <20200330185944.42bxysvem6b757ew@alap3.anarazel.de> <20200331225034.odt3l2w4h3dr6ggk@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200331225034.odt3l2w4h3dr6ggk@alap3.anarazel.de> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Mar 31, 2020 at 03:50:34PM -0700, Andres Freund wrote: > On 2020-03-31 14:10:34 -0400, Robert Haas wrote: > > +/* > > + * Attempt to parse the WAL files required to restore from backup using > > + * pg_waldump. > > + */ > > +static void > > +parse_required_wal(validator_context *context, char *pg_waldump_path, > > + char *wal_directory, manifest_wal_range *first_wal_range) > > +{ > > + manifest_wal_range *this_wal_range = first_wal_range; > > + > > + while (this_wal_range != NULL) > > + { > > + char *pg_waldump_cmd; > > + > > + pg_waldump_cmd = psprintf("\"%s\" --quiet --path=\"%s\" --timeline=%u --start=%X/%X --end=%X/%X\n", > > + pg_waldump_path, wal_directory, this_wal_range->tli, > > + (uint32) (this_wal_range->start_lsn >> 32), > > + (uint32) this_wal_range->start_lsn, > > + (uint32) (this_wal_range->end_lsn >> 32), > > + (uint32) this_wal_range->end_lsn); > > + if (system(pg_waldump_cmd) != 0) > > + report_backup_error(context, > > + "WAL parsing failed for timeline %u", > > + this_wal_range->tli); > > + > > + this_wal_range = this_wal_range->next; > > + } > > +} > > Should we have a function to properly escape paths in cases like this? > Not that it's likely or really problematic, but the quoting for path > could be "circumvented". Are you looking for appendShellString(), or something different?