pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix get_dirent_type() for symlinks on MinGW/MSYS.
Date: Thu, 28 Jul 2022 02:30:36 +0000
Message-ID: <E1oGtIJ-001ZSb-JN@gemulon.postgresql.org> (raw)

Fix get_dirent_type() for symlinks on MinGW/MSYS.

On Windows with MSVC, get_dirent_type() was recently made to return
DT_LNK for junction points by commit 9d3444dc, which fixed some
defective dirent.c code.

On Windows with Cygwin, get_dirent_type() already worked for symlinks,
as it does on POSIX systems, because Cygwin has its own fake symlinks
that behave like POSIX (on closer inspection, Cygwin's dirent has the
BSD d_type extension but it's probably always DT_UNKNOWN, so we fall
back to lstat(), which understands Cygwin symlinks with S_ISLNK()).

On Windows with MinGW/MSYS, we need extra code, because the MinGW
runtime has its own readdir() without d_type, and the lstat()-based
fallback has no knowledge of our convention for treating junctions as
symlinks.

Back-patch to 14, where get_dirent_type() landed.

Reported-by: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://postgr.es/m/b9ddf605-6b36-f90d-7c30-7b3e95c46276%40dunslane.net

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4fc6b6eefcf98f79211bb790ee890ebcb05c178d

Modified Files
--------------
src/common/file_utils.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)



view thread (3+ messages)  latest in thread

Message-ID: <E1oGtIJ-001ZSb-JN@gemulon.postgresql.org>
Permalink:  ../E1oGtIJ-001ZSb-JN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oGtIJ-001ZSb-JN@gemulon.postgresql.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tmunro@postgresql.org
  Subject: Re: pgsql: Fix get_dirent_type() for symlinks on MinGW/MSYS.
  In-Reply-To: <E1oGtIJ-001ZSb-JN@gemulon.postgresql.org>
  References: <E1oGtIJ-001ZSb-JN@gemulon.postgresql.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