Thread: Re: BUG #15858: could not stat file - over 4GB

Re: BUG #15858: could not stat file - over 4GB

From
Emil Iggland
Date:
The following review has been posted through the commitfest application:
make installcheck-world:  not tested
Implements feature:       tested, passed
Spec compliant:           not tested
Documentation:            not tested

I ran into this problem when using psql.exe and copy command. 

I have checked out 11.6-release tarball and applied the patch. 
The patch does not apply cleanly, but can be easily modified to apply. See Note 1.
After applying the patch I built using "build psql" and ran the new psql.exe binary.

In order to test I have done the following: 
Against a PostgreSQL 11 server run two commands: 
"COPY public.table FROM 'C:/file'" and "\copy public.table FROM 'C:/file'"
The first one runs in the context of the server, and does not work. It aborts with an error saying "cannot stat file",
asexpected. 
 
The seconds on runs in the context of the new binary and does work. It copies data as expected. 



Note 1: 
src/tools/msvc/Mkvcbuild.pm should be 

-      sprompt.c strerror.c tar.c thread.c getopt.c getopt_long.c dirent.c
-      win32env.c win32error.c win32security.c win32setlocale.c);
+      sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c
+      win32env.c win32error.c win32security.c win32setlocale.c win32_stat.c);

The new status of this patch is: Waiting on Author

Re: BUG #15858: could not stat file - over 4GB

From
Juan José Santamaría Flecha
Date:


On Wed, Feb 5, 2020 at 12:47 PM Emil Iggland <emil@iggland.com> wrote:
The following review has been posted through the commitfest application:
make installcheck-world:  not tested
Implements feature:       tested, passed
Spec compliant:           not tested
Documentation:            not tested

The latest version of this patch could benefit from an update. Please find attached a new version.

Most changes are cosmetic, but they have been more extensive than a simple rebase so I am changing the status back to 'needs review'.

To summarize those changes:
- Rename 'win32_stat.c' file to  'win32stat.c', as a better match of project files.
- Improve indentation and comments.
- Remove cruft about old Windows versions.

Regards,

Juan José Santamaría Flecha
Attachment

Re: BUG #15858: could not stat file - over 4GB

From
Tom Lane
Date:
=?UTF-8?Q?Juan_Jos=C3=A9_Santamar=C3=ADa_Flecha?= <juanjo.santamaria@gmail.com> writes:
> The latest version of this patch could benefit from an update. Please find
> attached a new version.

The cfbot thinks this doesn't compile on Windows [1].  Looks like perhaps
a missing-#include problem?

            regards, tom lane

[1] https://ci.appveyor.com/project/postgresql-cfbot/postgresql/build/1.0.81541



Re: BUG #15858: could not stat file - over 4GB

From
Juan José Santamaría Flecha
Date:
On Sat, Feb 29, 2020 at 12:44 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

The cfbot thinks this doesn't compile on Windows [1].  Looks like perhaps
a missing-#include problem?

The define logic for _WIN32_WINNT includes testing of _MSC_VER, and is not a proper choice for MSVC 2013 as the cfbot is showing.

Please find attached a new version addressing this issue.
 
Regards,

Juan José Santamaría Flecha
 
Attachment

Re: BUG #15858: could not stat file - over 4GB

From
Juan José Santamaría Flecha
Date:

On Sat, Feb 29, 2020 at 9:40 AM Juan José Santamaría Flecha <juanjo.santamaria@gmail.com> wrote:
On Sat, Feb 29, 2020 at 12:44 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

The cfbot thinks this doesn't compile on Windows [1].  Looks like perhaps
a missing-#include problem?

The define logic for _WIN32_WINNT includes testing of _MSC_VER, and is not a proper choice for MSVC 2013 as the cfbot is showing.
 
The cfbot is not happy yet. I will backtrack a bit on the cruft cleanup. 
 
Please find attached a new version addressing this issue.
 
Regards,

Juan José Santamaría Flecha
 
Attachment

Re: BUG #15858: could not stat file - over 4GB

From
Greg Steiner
Date:
I assigned myself as a reviewer for this patch, as I hit this bug today and had to perform a workaround.  I have never
revieweda patch before but will try to update within the next 5 days.  I intend on performing "Implements Feature"
reviewing.