You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucy.apache.org by nwellnhof <gi...@git.apache.org> on 2016/10/08 14:49:16 UTC

[lucy-dev] [GitHub] lucy pull request #52: Stop using strerror

GitHub user nwellnhof opened a pull request:

    https://github.com/apache/lucy/pull/52

    Stop using strerror

    Especially with non-English locales, 'strerror' can return strings in
    arbitrary encodings. Now that CB_VCatF has more thorough UTF-8 checks,
    this can result in unwanted exceptions.
    
    'strerror' also isn't thread-safe.
    
    Add some utility functions to set the global error object, optionally
    followed by a textual representation of the error in 'errno' or
    returned by 'GetLastError' on Windows. Convert 'errno' values using
    custom messages for all 'errno' macros from current Linux and Darwin
    kernels.
    
    Also make some error messages more informative by adding the reason
    for the error, e.g. in FSDH_do_open which may fail when opening an
    index.
    
    Fixes LUCY-311.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nwellnhof/lucy 0.6

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/lucy/pull/52.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #52
    
----
commit 7467be5a0425db53ec7e7080063310f810092712
Author: Nick Wellnhofer <we...@aevum.de>
Date:   2016-10-08T14:16:48Z

    Stop using strerror
    
    Especially with non-English locales, 'strerror' can return strings in
    arbitrary encodings. Now that CB_VCatF has more thorough UTF-8 checks,
    this can result in unwanted exceptions.
    
    'strerror' also isn't thread-safe.
    
    Add some utility functions to set the global error object, optionally
    followed by a textual representation of the error in 'errno' or
    returned by 'GetLastError' on Windows. Convert 'errno' values using
    custom messages for all 'errno' macros from current Linux and Darwin
    kernels.
    
    Also make some error messages more informative by adding the reason
    for the error, e.g. in FSDH_do_open which may fail when opening an
    index.
    
    Fixes LUCY-311.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Re: [lucy-dev] [GitHub] lucy pull request #52: Stop using strerror

Posted by Marvin Humphrey <ma...@rectangular.com>.
On Mon, Oct 10, 2016 at 7:49 AM, Nick Wellnhofer <we...@aevum.de> wrote:
> On 08/10/2016 16:49, nwellnhof wrote:
>>
>>     Convert 'errno' values using
>>     custom messages for all 'errno' macros from current Linux and Darwin
>>     kernels.
>
>
> Ultimately, I'd like see to Lucy's Windows I/O code move to the windows.h
> API for all operations which would allow us to use strerror_l on POSIX
> systems. Also see LUCY-252:
>
>     https://issues.apache.org/jira/browse/LUCY-252

Sounds like a plan.  System i/o is abstracted via FileHandle, DirHandle,
Folder etc.  In the early days, we wrapped plain old C stdio.h and POSIX file
descriptors.  When we moved to `mmap` on Unixen, we had to access more
sophisticated system-specific functionality including `MapViewOfFile`.
Continuing to move towards more system-specific internal implementations in
order to better support the abstracted i/o interface makes sense.

Marvin Humphrey

Re: [lucy-dev] [GitHub] lucy pull request #52: Stop using strerror

Posted by Nick Wellnhofer <we...@aevum.de>.
On 08/10/2016 16:49, nwellnhof wrote:
>     Convert 'errno' values using
>     custom messages for all 'errno' macros from current Linux and Darwin
>     kernels.

Ultimately, I'd like see to Lucy's Windows I/O code move to the windows.h API 
for all operations which would allow us to use strerror_l on POSIX systems. 
Also see LUCY-252:

     https://issues.apache.org/jira/browse/LUCY-252

Nick


[lucy-dev] [GitHub] lucy pull request #52: Stop using strerror

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/lucy/pull/52


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---