Re: What happens when an error does not have a POSIX translation?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joe English wrote:
> David Gravereaux wrote:
>
>>Say I'm using the [socket] command and try to connect to a non-existent
>>host and the name lookup fails:
>>
>>% set s [socket qweasdzxc.com 80]
>>couldn't open socket: invalid argument
>>% set errorCode
>>POSIX EINVAL {invalid argument}
>>%
>>
>>That's wrong --^
>>
>>Why is it wrong? because the name lookup on "qweasdzxc.com" returned
>>WSAHOST_NOT_FOUND and without a proper translation into a POSIX error
>>(because of the generic side of the socket command), whats returned is
>>EINVAL. That is an *extreme* loss of valuable info.
>
>
>
> This issue came up on tcl-core recently in connection
> with TIP #219 "Tcl Channel Reflection". But yeah,
> using ANSI C and POSIX errno codes to report errors
> is a deficient interface.
>
>
>
>>This is seriously lame. I don't know of a solution.
>
>
> Vince Darley came up with a reasonable-sounding approach;
> this will hopefully get fixed in 8.5.
>
>
> --Joe English


I did write a set of procedures for a complete (yes, all of them!)
"WIN32" table in the same fashion as how the "POSIX" ones work, but
seeing how the generic layer doesn't have a way to switch tables, it
doesn't help..

http://sf.net/support/tracker.php?aid=800716

Probably fine for commands that only have a Win32 side, but won't play
for generic stuff where errno is used.

- --
David Gravereaux <davygrvy@xxxxxxxxx>
[species:human; planet:earth,milkyway(western spiral arm),alpha sector]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCWLPqlZadkQh/RmERAra3AKCv0NYGAZi2EaSsjnOZUzd6o1sjFACdHSuH
o3NPWIDss13xnRMLvUXL7u8=
=WM6m
-----END PGP SIGNATURE-----
.