Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rDmrS-0038WW-V7 for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Dec 2023 14:38:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rDmrQ-008tAM-R4 for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Dec 2023 14:38:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rDmrQ-008tAE-Gb for pgsql-bugs@lists.postgresql.org; Thu, 14 Dec 2023 14:38:48 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rDmrL-00Bygb-HZ for pgsql-bugs@lists.postgresql.org; Thu, 14 Dec 2023 14:38:47 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3363880e9f3so1592449f8f.3 for ; Thu, 14 Dec 2023 06:38:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702564722; x=1703169522; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7Kh5Ym3SrzOjClfy1puMob/Bk+dIYBHEMypDq0/f500=; b=D/QY9dT/AgONqsuE2HywAdCHYoqzSKzFQqRusF/fxD7AyXz3eD6CtKGou5UHwcLxOA LU8yVGNxeljFj4opaei5l0qaDLf6nd2Nk86Eix6RSXIDCQcVB9+xn1n9fNsJob+fZHEx AUY82OmgwV1KeKaBUMWgb4iMe9mNrC4crWY/8eNenyUqHU1MrI3GJj5sxLv+BHEWzOCt nRR0BommFRQm3sjD+FXelSekFDCULRe+/qt03WqZnvDsqpxt6m2mwH7yXRD7BDX+wCqT j9wwlicqeQJQsG++1euiKyb+RugHvKukuF5H8kUQd2813ZVUTKF1edWw4xBlJ7CLc4kx I7Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702564722; x=1703169522; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7Kh5Ym3SrzOjClfy1puMob/Bk+dIYBHEMypDq0/f500=; b=QUv6WbeNuiBBExOXuNQl8wQM+oWVeaMVhKw5HWKCtMYN8y9poTaDqzwPb1vfXwBd4X z6YYhzXmYpyU9a+3p4Eop8nWDtGP6rXouNmWhzvAIzrotNRDQfbaUhrAI7hoCynklWjC l2vWdyjTBVrRD+a3sRwjGPT+U9M/pxXD5KN59mzVWPjkiAUC8b0ZvaTe+TsJM6/GB2OX nJ0onrG8+e9UT+pWMHhxEVJ0mCuK1NG/prDeuYvO4JqGFfelImuiJfuOtKg4oKXjSv5g qETX6bzcT3Iqjvz0oXoxZHt5FLjtkE0PU+rjgm+GSJlASfJFOhLV+XFsUi0d0mK8lK01 Yqsg== X-Gm-Message-State: AOJu0YwSRhmcJavNwrLg3EJtwBNrqmaMCz/8T4tNvrJkN8muJ0cQAwOy +3IgAMCk1lDOKgRsJWA5Bk8= X-Google-Smtp-Source: AGHT+IEuNOeqiqceGOvGOZ25Jua4Qr+pFqtYdVT1XSqhrXAg/cchQrsRRKLHeH1CpXBjQkMEsla3Gg== X-Received: by 2002:a05:600c:3105:b0:40c:46eb:e6ad with SMTP id g5-20020a05600c310500b0040c46ebe6admr3655088wmo.175.1702564721927; Thu, 14 Dec 2023 06:38:41 -0800 (PST) Received: from jrouhaud ([2a01:e0a:c:bcf0:9169:d12f:aadc:d32]) by smtp.gmail.com with ESMTPSA id bd21-20020a05600c1f1500b0040c25abd724sm27583215wmb.9.2023.12.14.06.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 06:38:41 -0800 (PST) Date: Thu, 14 Dec 2023 15:38:39 +0100 From: Julien Rouhaud To: Daniel Gustafsson Cc: mb.alzouabi@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18245: pg_restore accepts same output file name as input file name Message-ID: References: <18245-eed25801b2d599c9@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Wed, Dec 13, 2023 at 09:44:26AM +0100, Daniel Gustafsson wrote: > > On 13 Dec 2023, at 04:39, PG Bug reporting form wrote: > > > Please let it fail when the user passes the same name for the output as the > > input. > > I think this sounds like a fair restriction, input and output being the same > seems much more likely to be a copy/paste issue than an interesting usecase. +1 > Something like the attached (untested) sketch should be enough I think. I'm wondering if it would be worth adding some canonicalize_path() calls while at it, ISTM that such mistakes are likely to happen when invoking pg_restore manually, so having slightly different wording for the exact same file wouldn't surprising.