Hi Ray,

Thanks a lot for quick reply.

On Thu, Mar 12, 2015 at 1:11 AM, Ray Donnelly <[email protected]> wrote:
> From an msys2 shell:
>
> $ pacman -Qo /usr/bin/hostname.exe
> /usr/bin/hostname.exe is owned by coreutils 8.23-4
>

Thanks, very useful. I didn't tried that hard because pacman on Wine
doesn't work yet ;-)


>
> I can take a look but not very soon (perhaps this weekend - depending
> on how deep this bug goes), so if anyone else wants to take a look in
> the meantime that'd be great.
>
Thanks for the information, after reading the code it seems to me that
cygwin_gethostname doesn't map Windows error case to Unix error case
accurate enough:

 999 extern "C" int
1000 cygwin_gethostname (char *name, size_t len)
1001 {
1002   myfault efault;
1003   if (efault.faulted (EFAULT))
1004     return -1;
1005
1006   if (gethostname (name, len))
1007     {
1008       DWORD local_len = len;
1009
1010       if (!GetComputerNameA (name, &local_len))
1011         {
1012           set_winsock_errno ();
1013           return -1;
1014         }
1015     }
1016   debug_printf ("name %s", name);
1017   return 0;
1018 }

According to this test, Windows set error to WSAEFAULT when string
buffer length is insufficient:
https://testbot.winehq.org/JobDetails.pl?Key=12064

set_winsock_errno maps WSAEFAULT to EFAULT:

 200   {WSAEFAULT, "WSAEFAULT", EFAULT},

However, xgethostname() in coreutils expects error code like
ENAMETOOLONG for insufficient buffer length:

 62       else if (errno != 0 && errno != ENAMETOOLONG && errno != EINVAL
 63                /* OSX/Darwin does this when the buffer is not
large enough */
 64                && errno != ENOMEM)

So it seems the code to fix is in cygwin.

Should I report to cygwin mailing list, or is there anyone here
planing to take a look? Thanks very much :)

>>
>> I'm working on Wine to improve MSYS2 support,
>
> Great news to hear, many thanks. If GNU/Linux users can use and
> contribute to MSYS2 without having to run a VM then it will hopefully
> increase the MSYS2 user/developer community.

And it will bring very good test coverage to Wine :)
I'll report here once I have good news.


-- 
Regards,
Qian Hong

-
http://www.winehq.org

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Msys2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/msys2-users

Reply via email to