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 1jJBv9-0005LU-Nh for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2020 08:06:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJBv8-0004ll-Je for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2020 08:06:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJBv8-0004le-A3 for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2020 08:06:50 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jJBv6-00087l-2l for pgsql-hackers@postgresql.org; Tue, 31 Mar 2020 08:06:49 +0000 Received: by mail-qk1-x743.google.com with SMTP id k13so22080329qki.2 for ; Tue, 31 Mar 2020 01:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=1ZD4jLP7YA73w6MFKsmPdqJ7vqIf+RA5F9NYwJLErOg=; b=VVJ3ni4woccpVNnBJtmr3CJB7bnych/aEo4WWgOHOG0SVIrisD8nAfFupzc5KXDzzw kpMIb2Pt6IGGUgzwAUHuLq0KCSlHZuvan5xNQ/XaVNDU1uHwE6Ju54I3qqjJGemkDGMP zGk+Xe9Whsi1doXlqHa7CUzQQsPeT0hio7USNlKo5EQ9kwKo64TTeJsV9vdxhwwDK4js iVDuYn3ffBqjuQqJRWWuIclPG0g9MhnOHlYURRpZT2O3j6XnlcLFupnZYXdlJ5siFUvg vAxP4JP7EO1YJcGccZbFSyklXUSg1uOZooPrHcYbs4MXKekvbnrptB3PgluUsdTsLkE1 61Uw== 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:content-transfer-encoding :in-reply-to:user-agent; bh=1ZD4jLP7YA73w6MFKsmPdqJ7vqIf+RA5F9NYwJLErOg=; b=UAxLfbLSKzPqt/rRLcrfTFysFLWbZOFsO8doE4qBSzLtbwd6GBUQ/RwsKLfsWEYhvH 5b8vz52oJP7YHV8iT+tZZsj9I/OFEMiivKpPspEW3wBBVVFQnRB8lsK3l8v/uaXw0Bcw Aj0pB3KcEGqynxlA+9J3EQIqSOadEvtS571nAyCb9A9koqH3PMt9VkHG0NSQ+VH5WgOV XeANiq6kzZXW+tmeiOOpgkd5U1YfHQpXjhX77LIE8nUuNcen6xlA15pMi7nljm/PmZs+ UBGo1KkrkgTyj1kiROSEXKIfdUuJzcqbyD+g1PhEoqSqhMeZoHpXV8o+gs56Jg4nQ9+k knVg== X-Gm-Message-State: ANhLgQ3JfNo7GYCmGjVXLlKkmgAgRgopKqs2rG1X3NyObmR3T2mqLmHL NxWE8RlZKv1bpOwhuSTsRr3jwQ== X-Google-Smtp-Source: ADFU+vtCb65bPPWxHuljxJDvu2AHvjwxcwINHuXn41VA5wAdrktqKZKrAdsnpG5AN1uB3wPXikjwMQ== X-Received: by 2002:a37:9a83:: with SMTP id c125mr3707601qke.25.1585642006312; Tue, 31 Mar 2020 01:06:46 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id p9sm12630648qtu.3.2020.03.31.01.06.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2020 01:06:45 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 616D58007F7; Tue, 31 Mar 2020 03:06:43 -0500 (CDT) Date: Tue, 31 Mar 2020 03:06:43 -0500 From: Justin Pryzby To: Fabien COELHO Cc: Tom Lane , pgsql-hackers@postgresql.org, Alvaro Herrera , David Steele , "Bossart, Nathan" , Thomas Munro Subject: Re: pg11+: pg_ls_*dir LIMIT 1: temporary files .. not closed at end-of-transaction Message-ID: <20200331080643.GE14618@telsasoft.com> References: <24244.1585415634@sss.pgh.pa.us> <20200328183904.GI20103@telsasoft.com> <28906.1585422475@sss.pgh.pa.us> <27064.1585499825@sss.pgh.pa.us> <20200329171415.GL20103@telsasoft.com> <29512.1585502524@sss.pgh.pa.us> <20200329201215.GM20103@telsasoft.com> <4028.1585579463@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Mar 31, 2020 at 07:36:03AM +0200, Fabien COELHO wrote: > > > As I wrote about an earlier version of the patch, ISTM that instead of > > > reinventing, extending, adapting various ls variants (with/without > > > metadata, which show only files, which shows target of links, which shows > > > directory, etc.) we would just need *one* postgres "ls" implementation > > > which would be like "ls -la arg" (returns file type, dates), and then > > > everything else is a wrapper around that with appropriate filtering that > > > can be done at the SQL level, like you started with recurse. > > > > Yeah, I agree that some new function that can represent symlinks > > explicitly in its output is the place to deal with this, for > > people who want to deal with it. > > > > In the meantime, there's still the question of what pg_ls_dir_files > > should do exactly. Are we content to have it ignore symlinks? > > I remain inclined to think that's the right thing given its current > > brief. > > My 0.02€: > > I agree that it is enough to reproduce the current behavior of various > existing pg_ls* functions, but on the other hand outputing a column type > char like ls (-, d, l…) looks like really no big deal. I'd say that the only > reason not to do it may be to pass this before feature freeze. Remember, there's two threads here, and this one is about the bug in stable releases ($SUBJECT), and now the instability in the test that was added with its fix. I suggest to leave stat() alone in your patch for stable releases. I think it's okay if we change behavior so that a broken symlink is skipped instead of erroring (as a side effect of skipping ENOENT with stat()). But not okay if we change pg_ls_logdir() to hide symlinks in back braches. -- Justin