pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Allowing printf("%m") only where it actually works
Date: Sat, 26 May 2018 21:00:33 -0400
Message-ID: <2576.1527382833@sss.pgh.pa.us> (raw)
In-Reply-To: <1673.1527381483@sss.pgh.pa.us>
References: <2975.1526862605@sss.pgh.pa.us>
	<CAEepm=29o4wi5WEBFfwhBUuiYSymbTcORw_cvdaaxPPoAkrsvA@mail.gmail.com>
	<14176.1526874887@sss.pgh.pa.us>
	<24986.1526877413@sss.pgh.pa.us>
	<CAEepm=2-7qBw6U-vy2OgL=Z=J6VeOzPS5jsK2PwmG0PWTDv1cg@mail.gmail.com>
	<31054.1526918600@sss.pgh.pa.us>
	<6025.1527351693@sss.pgh.pa.us>
	<CAEepm=0oVAR8AOKjK-Yq34KoAMXqZbTHsF_rpZqA5skDXe95Rg@mail.gmail.com>
	<1673.1527381483@sss.pgh.pa.us>

I wrote:
> ... It doesn't take much to make one nontrivial either.  If
> memory serves, malloc() can trash errno on some platforms such as macOS,
> so even just a palloc creates a hazard of a hard-to-reproduce problem.

After digging around in the archives, the closest thing that we seem to
know for certain is that some versions of free() can trash errno, cf

https://www.postgresql.org/message-id/flat/E1UcmpR-0004nn-2i%40wrigleys.postgresql.org

as a result of possibly calling madvise() which might or might not
succeed.  But in the light of that knowledge, how much do you want
to bet that malloc() can't change errno?  And there's the possibility
that a called function does both a palloc and a pfree ...

			regards, tom lane




view thread (50+ messages)  latest in thread

Message-ID: <2576.1527382833@sss.pgh.pa.us>
Permalink:  ../2576.1527382833@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2576.1527382833@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, thomas.munro@enterprisedb.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Allowing printf("%m") only where it actually works
  In-Reply-To: <2576.1527382833@sss.pgh.pa.us>

* 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