Re: Replace (stat(<file>))[7] in TAP tests with -s

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Replace (stat(<file>))[7] in TAP tests with -s
Date: 2023-10-02 23:44:35
Message-ID: ZRtV46QkFvvrjYLK@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 02, 2023 at 12:44:59PM +0100, Dagfinn Ilmari Mannsåker wrote:
> I approve of removing use of the list form of stat, it's a horrible API.

Agreed, I've appied the suggestion to use -s, like we do anywhere
else.

> 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).

Right, like in 017_shm.pl. I didn't notice that.

> 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.

The removal of this code depends on a few more things, hopefully it
will be able to get rid of it during this release cycle.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Joseph Krogh 2023-10-03 00:06:00 Re: CHECK Constraint Deferrable
Previous Message Michael Paquier 2023-10-02 23:42:02 Re: pg*.dll and *.pdb files in psqlODBC have no version numbers