Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zyubc-0008Ov-U8 for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Nov 2015 04:44:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zyubc-0001DM-24 for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Nov 2015 04:44:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zyuay-0000WK-Nf for pgsql-bugs@postgresql.org; Wed, 18 Nov 2015 04:43:48 +0000 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Zyuaq-0001ZY-M0 for pgsql-bugs@postgresql.org; Wed, 18 Nov 2015 04:43:47 +0000 Received: by pacej9 with SMTP id ej9so31623160pac.2 for ; Tue, 17 Nov 2015 20:43:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=OQxp/klySDWhIaGS10XA2ufOqAT0EHuaCvK9U/bE3mU=; b=esYubaWvjN+xVrBeThhyKYBkV1nAXRjdJl6CnKX9EYk4H3k35C13ef/F8g3ZM3Mpeu 1AmklCj2j0MvqgAevWHadvuot2pNi+sjByPIPHXzR2Q+6jWMKCZn3aSV/8AexGXbEYj5 lsLBrct+4sXXcxqYWyIYJ5OfHc8XHmuaSu2NQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=OQxp/klySDWhIaGS10XA2ufOqAT0EHuaCvK9U/bE3mU=; b=kRae/tJTsAjAdrtaWILF8vo26vEXFVHrLnZECB9ELASOCBN7bS9U7aVJj0shGYmlVg cXElhcAGKVeNA2p+nicolik4AhAYWs/4tMpyRc26x2TaxzNk4cINLklo4DkReSFi1aYE elfOGwbFE8Q97/OCdpItg80ua0km62+VFCC7NdsZT7dAWalT3fo4aiz1S9FOiJOEIQNV yk5IHPJi6wpVg9wEmT7UBQ6FCEZ6Ghx73K09GQScnHM/80mHftDlgjAJMVgwaIjBMCvI P6wPt1LG2OUQ0j6niEQ8ejoCuyQaiBS473LUqfbIPdddACTPRvIdutgeoBB7m1rWvi9t nh4g== X-Gm-Message-State: ALoCoQm1mQgTg+RZvgrcG+/ivRTz2JIM0wmL0xUPsfP0xqSsESXB5eUW04/Vhhd62RepklvI3D2S X-Received: by 10.68.226.105 with SMTP id rr9mr68825538pbc.29.1447821817426; Tue, 17 Nov 2015 20:43:37 -0800 (PST) Received: from tornado.leadboat.com (c-98-248-47-228.hsd1.ca.comcast.net. [98.248.47.228]) by smtp.gmail.com with ESMTPSA id hr3sm897437pbc.77.2015.11.17.20.43.36 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Nov 2015 20:43:36 -0800 (PST) Date: Tue, 17 Nov 2015 23:43:34 -0500 From: Noah Misch To: Bruce Momjian Cc: manu@coopapotheken.be, pgsql-bugs@postgresql.org Subject: Re: BUG #13774: upgrade from 9.1 to 9.4 'succeeds' without enough disk space Message-ID: <20151118044334.GA1410299@tornado.leadboat.com> References: <20151112195735.9795.39615@wrigleys.postgresql.org> <20151114012402.GC27916@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151114012402.GC27916@momjian.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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