From: Noah Misch <noah@leadboat.com>
To: Bruce Momjian <bruce@momjian.us>
Cc: manu@coopapotheken.be
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13774: upgrade from 9.1 to 9.4 'succeeds' without enough disk space
Date: Tue, 17 Nov 2015 23:43:34 -0500
Message-ID: <20151118044334.GA1410299@tornado.leadboat.com> (raw)
In-Reply-To: <20151114012402.GC27916@momjian.us>
References: <20151112195735.9795.39615@wrigleys.postgresql.org>
<20151114012402.GC27916@momjian.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On Fri, Nov 13, 2015 at 08:24:02PM -0500, Bruce Momjian wrote:
> Thank you for the report. This is embarrassing, but the code was
> testing for the wrong return value on Windows. We used a macro to
> define the same symbol on Windows and Unix (pg_copy_file)
> *** a/src/bin/pg_upgrade/file.c
> --- b/src/bin/pg_upgrade/file.c
> *************** copyAndUpdateFile(pageCnvCtx *pageConver
> *** 34,40 ****
> {
> if (pageConverter == NULL)
> {
> ! if (pg_copy_file(src, dst, force) == -1)
> return getErrorText(errno);
> else
> return NULL;
> --- 34,44 ----
> {
> if (pageConverter == NULL)
> {
> ! #ifndef WIN32
> ! if (copy_file(src, dst, force) == -1)
> ! #else
> ! if (CopyFile(src, dst, force) == 0)
> ! #endif
> return getErrorText(errno);
Thanks. This passage of code has at least two other problems on Windows. The
third CopyFile() argument means the opposite of the third copy_file()
argument. Next, getErrorText() is wrong on Windows:
const char *
getErrorText(int errNum)
{
#ifdef WIN32
_dosmaperr(GetLastError());
#endif
return pg_strdup(strerror(errNum));
}
Calling _dosmaperr() to set errno is futile, because we nonetheless proceed to
use the passed-in errNum.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: noah@leadboat.com, bruce@momjian.us, manu@coopapotheken.be
Subject: Re: BUG #13774: upgrade from 9.1 to 9.4 'succeeds' without enough disk space
In-Reply-To: <20151118044334.GA1410299@tornado.leadboat.com>
References: <20151112195735.9795.39615@wrigleys.postgresql.org> <20151114012402.GC27916@momjian.us> <20151118044334.GA1410299@tornado.leadboat.com>
* 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