Re: zic: fix PostgreSQL build failure on filesystems without hard link support

From: Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: zic: fix PostgreSQL build failure on filesystems without hard link support
Date: 2026-07-31 14:55:04
Message-ID: e04b65925d5b34b7225dba29f86094a9@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane писал(а) 2026-07-31 17:08:
> Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru> writes:
>> Tom Lane писал(а) 2026-07-31 02:57:
>>> Also, it occurs to me to wonder if we're doing this to ourselves.
>>> Specifically, it looks like src/port/win32error.c's _dosmaperr
>>> will map ERROR_NOT_SUPPORTED to EINVAL, due to the lack of any
>>> table entry for ERROR_NOT_SUPPORTED. Can you confirm which
>>> underlying Windows error code is being returned?
>
>> I have confirmed that the Windows error code returned by
>> CreateHardLinkA() on exFAT is ERROR_INVALID_FUNCTION (numeric value
>> 1).
>> This code has no mapping in PostgreSQL's _dosmaperr(), which
>> falls back to returning EINVAL (errno == 22). This is why zic
>> receives EINVAL instead of ENOTSUP.
>
> Interesting. I wonder if it'd be sane to put in an explicit mapping
> for ERROR_INVALID_FUNCTION, although I'm not quite sure whether to
> prefer ENOTSUP or EOPNOTSUPP. (If so, I'd be inclined to also add a
> mapping for ERROR_NOT_SUPPORTED, but apparently that's not relevant to
> the immediate problem.)
>
We could try other approach - avoid changing zic and _dosmaperr()
and fix link() like this in src/port/win32link.c:

if (CreateHardLinkA(dst, src, NULL) == 0)
{
int returncode;

returncode = GetLastError();

if (returncode == ERROR_INVALID_FUNCTION)
errno = ENOTSUP;
else
dosmaperr(returncode);
return -1;
}
It will not affect other places where link() is called, and resolve
zic issue.
--
Best regards,

Vladlen Popolitov.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2026-07-31 14:58:32 Re: WAL compression setting after PostgreSQL LZ4 default change
Previous Message Tomas Vondra 2026-07-31 14:33:19 Re: hashjoins vs. Bloom filters (yet again)