Failing win64x64 builds - undeclared identifier 'PATH_MAX'

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Failing win64x64 builds - undeclared identifier 'PATH_MAX'

Ben Coman
 
Just to note that builds...
* Environment: FLAVOR=squeak.stack.spur, ARCH=win64x64,
CYG_ROOT=C:\cygwin64, CYG_SETUP=setup-x86_64.exe, MINGW_ARCH=x86_64
* Environment: FLAVOR=pharo.stack.spur, ARCH=win64x64,
CYG_ROOT=C:\cygwin64, CYG_SETUP=setup-x86_64.exe, MINGW_ARCH=x86_64
are currently failing due to...
   ../../platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c:85:17:
       error: use of undeclared identifier 'PATH_MAX'
       char fileName[PATH_MAX+1];

The change from imageNameSize() to PATH_MAX seems to be from 11 days ago per...
https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.637
"Add the B3DAcceleratorPlugin (OpenGL interface) to the 32-bit Mac build"

Diff...
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/995e7aedc3b5aeb76904f92abbd8a7a1bcf8138f

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: Failing win64x64 builds - undeclared identifier 'PATH_MAX'

Eliot Miranda-2
 
Hi Ben,

    can you tell me what path-related limits limits.h does define on win64?  e.g. there should be something like POSIX_PATH_MAS or XOPEN_PATH_MAX, and if neither of these is available, and nothing else looks relevant we can define a default.  I already put in a default; see platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c
But can we do better on win64/win32?

On Fri, May 12, 2017 at 9:38 AM, Ben Coman <[hidden email]> wrote:

Just to note that builds...
* Environment: FLAVOR=squeak.stack.spur, ARCH=win64x64,
CYG_ROOT=C:\cygwin64, CYG_SETUP=setup-x86_64.exe, MINGW_ARCH=x86_64
* Environment: FLAVOR=pharo.stack.spur, ARCH=win64x64,
CYG_ROOT=C:\cygwin64, CYG_SETUP=setup-x86_64.exe, MINGW_ARCH=x86_64
are currently failing due to...
   ../../platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c:85:17:
       error: use of undeclared identifier 'PATH_MAX'
       char fileName[PATH_MAX+1];

The change from imageNameSize() to PATH_MAX seems to be from 11 days ago per...
https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.637
"Add the B3DAcceleratorPlugin (OpenGL interface) to the 32-bit Mac build"

Diff...
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/995e7aedc3b5aeb76904f92abbd8a7a1bcf8138f

cheers -ben



--
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: Failing win64x64 builds - undeclared identifier 'PATH_MAX'

Ben Coman
 
On Sat, May 13, 2017 at 11:28 AM, Eliot Miranda <[hidden email]> wrote:
>
> Hi Ben,
>
>     can you tell me what path-related limits limits.h does define on win64?  e.g. there should be something like POSIX_PATH_MAS or XOPEN_PATH_MAX, and if neither of these is available, and nothing else looks relevant we can define a default.  I already put in a default; see platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c

I see that here https://git.io/v9QbB
and the error disappears in
https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.665

> But can we do better on win64/win32?

I found  _MAX_PATH in <stdlib.h>
at "Path Field Limits" for MSVC here...
https://msdn.microsoft.com/en-us/library/930f87yf.aspx

but I'm not sure how that relates to Cygwin.  I see PATH_MAX defined
in "limits.h" here...
https://cygwin.com/ml/cygwin-patches/2005-q1/msg00084.html

cheers -ben

>
> On Fri, May 12, 2017 at 9:38 AM, Ben Coman <[hidden email]> wrote:
>>
>>
>> Just to note that builds...
>> * Environment: FLAVOR=squeak.stack.spur, ARCH=win64x64,
>> CYG_ROOT=C:\cygwin64, CYG_SETUP=setup-x86_64.exe, MINGW_ARCH=x86_64
>> * Environment: FLAVOR=pharo.stack.spur, ARCH=win64x64,
>> CYG_ROOT=C:\cygwin64, CYG_SETUP=setup-x86_64.exe, MINGW_ARCH=x86_64
>> are currently failing due to...
>>    ../../platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c:85:17:
>>        error: use of undeclared identifier 'PATH_MAX'
>>        char fileName[PATH_MAX+1];
>>
>> The change from imageNameSize() to PATH_MAX seems to be from 11 days ago per...
>> https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.637
>> "Add the B3DAcceleratorPlugin (OpenGL interface) to the 32-bit Mac build"
>>
>> Diff...
>> https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/995e7aedc3b5aeb76904f92abbd8a7a1bcf8138f
>>
>> cheers -ben
>
>
>
>
> --
> _,,,^..^,,,_
> best, Eliot
>
Reply | Threaded
Open this post in threaded view
|

Re: Failing win64x64 builds - undeclared identifier 'PATH_MAX'

Ben Coman
 
On Sun, May 14, 2017 at 1:30 AM, Ben Coman <[hidden email]> wrote:
> On Sat, May 13, 2017 at 11:28 AM, Eliot Miranda <[hidden email]> wrote:
>>
>> Hi Ben,
>>
>>     can you tell me what path-related limits limits.h does define on win64?  e.g. there should be something like POSIX_PATH_MAS or XOPEN_PATH_MAX, and if neither of these is available, and nothing else looks relevant we can define a default.  I already put in a default; see platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c

btw, I also should have said, "thanks Eliot"

Now the win64x64-squeak.stack.spur build is green,
but pharo seems to have a problem with deployment.
   https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.671

I guess Esteban will need to deal with that when he gets a chance to
breath outside the Pharo 6 Release.


btw2, For the curious, I produced a diff of the Squeak and Pharo build logs...
https://www.diffchecker.com/dJQIzvYk

cheers -ben



>
> I see that here https://git.io/v9QbB
> and the error disappears in
> https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.665
>
>> But can we do better on win64/win32?
>
> I found  _MAX_PATH in <stdlib.h>
> at "Path Field Limits" for MSVC here...
> https://msdn.microsoft.com/en-us/library/930f87yf.aspx
>
> but I'm not sure how that relates to Cygwin.  I see PATH_MAX defined
> in "limits.h" here...
> https://cygwin.com/ml/cygwin-patches/2005-q1/msg00084.html
>



> cheers -ben
>
>>
>> On Fri, May 12, 2017 at 9:38 AM, Ben Coman <[hidden email]> wrote:
>>>
>>>
>>> Just to note that builds...
>>> * Environment: FLAVOR=squeak.stack.spur, ARCH=win64x64,
>>> CYG_ROOT=C:\cygwin64, CYG_SETUP=setup-x86_64.exe, MINGW_ARCH=x86_64
>>> * Environment: FLAVOR=pharo.stack.spur, ARCH=win64x64,
>>> CYG_ROOT=C:\cygwin64, CYG_SETUP=setup-x86_64.exe, MINGW_ARCH=x86_64
>>> are currently failing due to...
>>>    ../../platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c:85:17:
>>>        error: use of undeclared identifier 'PATH_MAX'
>>>        char fileName[PATH_MAX+1];
>>>
>>> The change from imageNameSize() to PATH_MAX seems to be from 11 days ago per...
>>> https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.637
>>> "Add the B3DAcceleratorPlugin (OpenGL interface) to the 32-bit Mac build"
>>>
>>> Diff...
>>> https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/995e7aedc3b5aeb76904f92abbd8a7a1bcf8138f
>>>
>>> cheers -ben
>>
>>
>>
>>
>> --
>> _,,,^..^,,,_
>> best, Eliot
>>
Reply | Threaded
Open this post in threaded view
|

Re: Failing win64x64 builds - undeclared identifier 'PATH_MAX'

alistairgrant
In reply to this post by Ben Coman
 
Hi Ben & Eliot,

On Sun, May 14, 2017 at 01:30:36AM +0800, Ben Coman wrote:

>  
> On Sat, May 13, 2017 at 11:28 AM, Eliot Miranda
> <[hidden email]> wrote:
> >
> > Hi Ben,
> >
> >     can you tell me what path-related limits limits.h does define on
> >     win64?  e.g. there should be something like POSIX_PATH_MAS or
> >     XOPEN_PATH_MAX, and if neither of these is available, and
> >     nothing else looks relevant we can define a default.  I already
> >     put in a default; see
> >     platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c
>
> I see that here https://git.io/v9QbB and the error disappears in
> https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.665
>
> > But can we do better on win64/win32?
>
> I found  _MAX_PATH in <stdlib.h> at "Path Field Limits" for MSVC
> here...  https://msdn.microsoft.com/en-us/library/930f87yf.aspx
>
> but I'm not sure how that relates to Cygwin.  I see PATH_MAX defined
> in "limits.h" here...
> https://cygwin.com/ml/cygwin-patches/2005-q1/msg00084.html
>
> cheers -ben

Did you agree on a solution for this?

I'm getting close to finishing the FileAttributes plugin discussed in
the "Extending primitiveDirectoryEntry" thread and have also realised
that PATH_MAX = 260 on win32.  The plugin also uses the unicode versions
of the windows function, so should work with paths up to 32k characters.

Thanks,
Alistair

Reply | Threaded
Open this post in threaded view
|

Re: Failing win64x64 builds - undeclared identifier 'PATH_MAX'

Eliot Miranda-2
 
Hi Alistair,

> On May 15, 2017, at 7:28 AM, Alistair Grant <[hidden email]> wrote:
>
>
> Hi Ben & Eliot,
>
>> On Sun, May 14, 2017 at 01:30:36AM +0800, Ben Coman wrote:
>>
>> On Sat, May 13, 2017 at 11:28 AM, Eliot Miranda
>> <[hidden email]> wrote:
>>>
>>> Hi Ben,
>>>
>>>    can you tell me what path-related limits limits.h does define on
>>>    win64?  e.g. there should be something like POSIX_PATH_MAS or
>>>    XOPEN_PATH_MAX, and if neither of these is available, and
>>>    nothing else looks relevant we can define a default.  I already
>>>    put in a default; see
>>>    platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c
>>
>> I see that here https://git.io/v9QbB and the error disappears in
>> https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.665
>>
>>> But can we do better on win64/win32?
>>
>> I found  _MAX_PATH in <stdlib.h> at "Path Field Limits" for MSVC
>> here...  https://msdn.microsoft.com/en-us/library/930f87yf.aspx
>>
>> but I'm not sure how that relates to Cygwin.  I see PATH_MAX defined
>> in "limits.h" here...
>> https://cygwin.com/ml/cygwin-patches/2005-q1/msg00084.html
>>
>> cheers -ben
>
> Did you agree on a solution for this?
>
> I'm getting close to finishing the FileAttributes plugin discussed in
> the "Extending primitiveDirectoryEntry" thread and have also realised
> that PATH_MAX = 260 on win32.  The plugin also uses the unicode versions
> of the windows function, so should work with paths up to 32k characters.

Is there a manifest constant (#define) in Cygwin for the 32k limit?  Which APIs have a 32k limit and which have a 260 limit?

[why are C APIs such a mess?]

>
> Thanks,
> Alistair
>
Reply | Threaded
Open this post in threaded view
|

Re: Failing win64x64 builds - undeclared identifier 'PATH_MAX'

Tobias Pape
 

> On 15.05.2017, at 16:31, Eliot Miranda <[hidden email]> wrote:
>
>
> Hi Alistair,
>
>> On May 15, 2017, at 7:28 AM, Alistair Grant <[hidden email]> wrote:
>>
>>
>> Hi Ben & Eliot,
>>
>>> On Sun, May 14, 2017 at 01:30:36AM +0800, Ben Coman wrote:
>>>
>>> On Sat, May 13, 2017 at 11:28 AM, Eliot Miranda
>>> <[hidden email]> wrote:
>>>>
>>>> Hi Ben,
>>>>
>>>>   can you tell me what path-related limits limits.h does define on
>>>>   win64?  e.g. there should be something like POSIX_PATH_MAS or
>>>>   XOPEN_PATH_MAX, and if neither of these is available, and
>>>>   nothing else looks relevant we can define a default.  I already
>>>>   put in a default; see
>>>>   platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c
>>>
>>> I see that here https://git.io/v9QbB and the error disappears in
>>> https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.665
>>>
>>>> But can we do better on win64/win32?
>>>
>>> I found  _MAX_PATH in <stdlib.h> at "Path Field Limits" for MSVC
>>> here...  https://msdn.microsoft.com/en-us/library/930f87yf.aspx
>>>
>>> but I'm not sure how that relates to Cygwin.  I see PATH_MAX defined
>>> in "limits.h" here...
>>> https://cygwin.com/ml/cygwin-patches/2005-q1/msg00084.html
>>>
>>> cheers -ben
>>
>> Did you agree on a solution for this?
>>
>> I'm getting close to finishing the FileAttributes plugin discussed in
>> the "Extending primitiveDirectoryEntry" thread and have also realised
>> that PATH_MAX = 260 on win32.  The plugin also uses the unicode versions
>> of the windows function, so should work with paths up to 32k characters.
>
> Is there a manifest constant (#define) in Cygwin for the 32k limit?  Which APIs have a 32k limit and which have a 260 limit?
>
> [why are C APIs such a mess?]

It does not work that way.
AFAIK, all Ansi-APIs are 260-limited (correct me if I'm wrong),
but even the Unicode-APIs are, if not used in the correct way.
See:
        https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/win32/plugins/FilePlugin/sqWin32File.h#L6
and hence
        http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#maxpath

TL;DR: MAX_PATH is 260, path _can_ be longer if used correctly ('\\?\')

-t

>
>>
>> Thanks,
>> Alistair

Reply | Threaded
Open this post in threaded view
|

Re: Failing win64x64 builds - undeclared identifier 'PATH_MAX'

alistairgrant
In reply to this post by Eliot Miranda-2
 
On Mon, May 15, 2017 at 07:31:50AM -0700, Eliot Miranda wrote:

> Hi Alistair,
> > On May 15, 2017, at 7:28 AM, Alistair Grant <[hidden email]> wrote:
> >
> > Hi Ben & Eliot,
> >
> >> On Sun, May 14, 2017 at 01:30:36AM +0800, Ben Coman wrote:
> >> On Sat, May 13, 2017 at 11:28 AM, Eliot Miranda
> >> <[hidden email]> wrote:
> >>>
> >>> Hi Ben,
> >>>
> >>>    can you tell me what path-related limits limits.h does define on
> >>>    win64?  e.g. there should be something like POSIX_PATH_MAS or
> >>>    XOPEN_PATH_MAX, and if neither of these is available, and
> >>>    nothing else looks relevant we can define a default.  I already
> >>>    put in a default; see
> >>>    platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c
> >>
> >> I see that here https://git.io/v9QbB and the error disappears in
> >> https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.665
> >>
> >>> But can we do better on win64/win32?
> >>
> >> I found  _MAX_PATH in <stdlib.h> at "Path Field Limits" for MSVC
> >> here...  https://msdn.microsoft.com/en-us/library/930f87yf.aspx
> >>
> >> but I'm not sure how that relates to Cygwin.  I see PATH_MAX defined
> >> in "limits.h" here...
> >> https://cygwin.com/ml/cygwin-patches/2005-q1/msg00084.html
> >>
> >> cheers -ben
> >
> > Did you agree on a solution for this?
> >
> > I'm getting close to finishing the FileAttributes plugin discussed in
> > the "Extending primitiveDirectoryEntry" thread and have also realised
> > that PATH_MAX = 260 on win32.  The plugin also uses the unicode versions
> > of the windows function, so should work with paths up to 32k characters.
>
> Is there a manifest constant (#define) in Cygwin for the 32k limit?  Which APIs have a 32k limit and which have a 260 limit?
>
> [why are C APIs such a mess?]

It's a mess seems to be the best summary...

I couldn't find any constant in cygwin for 32k.  Although in some ways
it doesn't matter...  

As Tobias said, the 32k limit only applies to the wide version of
functions that have appropriately formatted file names, i.e. "\\?\"
prepended to the name, and the expansion means that the actual limit may
be less.  That is, of course, assuming the underlying file system
supports it, otherwise it might still be 260 characters.  The cynical
part of me is also wondering whether it really is 32k characters, or 32k
bytes, in which case the coding may influence the available length.

It looks like the best that can be done is to have our own #define of
32768, use the wide character version of the functions and hope for the
best.

Just to add to my frustration, it looks like the gcc version of stat()
handles timezones properly, while the mingw version doesn't.  Grrr...
(If anyone happens to know something here, please tell me).

Cheers,
Alistair

Reply | Threaded
Open this post in threaded view
|

Re: Failing win64x64 builds - undeclared identifier 'PATH_MAX'

Ben Coman
In reply to this post by Eliot Miranda-2
 
On Mon, May 15, 2017 at 10:31 PM, Eliot Miranda <[hidden email]> wrote:

>
>
> Hi Alistair,
>
> > On May 15, 2017, at 7:28 AM, Alistair Grant <[hidden email]> wrote:
> >
> >
> > Hi Ben & Eliot,
> >
> >> On Sun, May 14, 2017 at 01:30:36AM +0800, Ben Coman wrote:
> >>
> >> On Sat, May 13, 2017 at 11:28 AM, Eliot Miranda
> >> <[hidden email]> wrote:
> >>>
> >>> Hi Ben,
> >>>
> >>>    can you tell me what path-related limits limits.h does define on
> >>>    win64?  e.g. there should be something like POSIX_PATH_MAS or
> >>>    XOPEN_PATH_MAX, and if neither of these is available, and
> >>>    nothing else looks relevant we can define a default.  I already
> >>>    put in a default; see
> >>>    platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c
> >>
> >> I see that here https://git.io/v9QbB and the error disappears in
> >> https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.665
> >>
> >>> But can we do better on win64/win32?
> >>
> >> I found  _MAX_PATH in <stdlib.h> at "Path Field Limits" for MSVC
> >> here...  https://msdn.microsoft.com/en-us/library/930f87yf.aspx
> >>
> >> but I'm not sure how that relates to Cygwin.  I see PATH_MAX defined
> >> in "limits.h" here...
> >> https://cygwin.com/ml/cygwin-patches/2005-q1/msg00084.html
> >>
> >> cheers -ben
> >
> > Did you agree on a solution for this?
> >
> > I'm getting close to finishing the FileAttributes plugin discussed in
> > the "Extending primitiveDirectoryEntry" thread and have also realised
> > that PATH_MAX = 260 on win32.  The plugin also uses the unicode versions
> > of the windows function, so should work with paths up to 32k characters.
>
> Is there a manifest constant (#define) in Cygwin for the 32k limit?

I couldn't find one.

>  Which APIs have a 32k limit and which have a 260 limit?

fopen() seems to have a 260 limit.
_wfopen()  "might"  have a higher limit, but is unclear and I think
also non-portable.

In this particular case where the VM seems to be output a debug log,
maybe we don't need to consider too much the longer file limit.

Actually looking more closely at print3Dlog() in sqOpenGLRenderer.c
there seems potential for a crash when strlen(getImageName()) equals
PATH_MAX - 2.

So perhaps something more dynamic would be useful anyway...
    char *fileName;
    getImageName = interpreterProxy->ioLoadFunctionFrom("getImageName", "");
    if (!getImageName)
        imageName = "./";
    else
        imageName = getImageName();
    filename = malloc(strlen(imageName) + strlen("Squeak3D.log") + 1);
    strcpy(filename, imageName);
    strcpy(slash ? slash + 1 : fileName, "Squeak3D.log");)
    logfile = fopen(fileName, "at");
    free(filename);
    if (!logfile) {....

i.e. If you can't solve the problem, change the problem.

>
> [why are C APIs such a mess?]

Maybe the comment below the dotted line...
https://cygwin.com/ml/cygwin/2004-10/msg01330.html


cheers -ben