pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Drouvot, Bertrand <bertranddrouvot.pg@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Michael Paquier <michael@paquier.xyz>
Subject: Re: Replace (stat(<file>))[7] in TAP tests with -s
Date: Mon, 02 Oct 2023 12:44:59 +0100
Message-ID: <87o7hhnt8k.fsf@wibble.ilmari.org> (raw)
In-Reply-To: <b2020df7-d0fc-4ea5-b2a9-7efc6d36b2ac@gmail.com>
References: <b2020df7-d0fc-4ea5-b2a9-7efc6d36b2ac@gmail.com>

"Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com> writes:

> Hi hackers,
>
> Please find attached a tiny patch to $SUBJECT.
>
> It:
>
>  - provides more consistency to the way we get files size in TAP tests
>  - seems more elegant that relying on a hardcoded result position

I approve of removing use of the list form of stat, it's a horrible API.

If we weren't already using -s everywhere else, I would prefer
File::stat, which makes stat (in scalar context) return an object with
methods for the fields, so you'd do stat($file)->size.  It's included in
Perl core since 5.4, and we're already using it in several places for
other fields (mode and ino at least).

I see another use of stat array positions (for mtime) in
src/tools/msvc/Solution.pm, but that's on the chopping block, so not
much point in fixing.

- ilmari





view thread (3+ messages)  latest in thread

Message-ID: <87o7hhnt8k.fsf@wibble.ilmari.org>
Permalink:  ../87o7hhnt8k.fsf@wibble.ilmari.org/
Also on:    postgresql.org/message-id/87o7hhnt8k.fsf@wibble.ilmari.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: ilmari@ilmari.org, bertranddrouvot.pg@gmail.com, pgsql-hackers@lists.postgresql.org, michael@paquier.xyz
  Subject: Re: Replace (stat(<file>))[7] in TAP tests with -s
  In-Reply-To: <87o7hhnt8k.fsf@wibble.ilmari.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox