Bug 14980 – [REG2.068] getAddressInfo(null) broken

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-30T03:01:00Z
Last change time
2017-07-19T17:43:49Z
Keywords
pull
Assigned to
nobody
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2015-08-30T03:01:32Z
////////////////////////// test.d ////////////////////////// import std.socket; import std.stdio; void main() { auto ai = getAddressInfo(null, "1", AddressFamily.INET); assert(ai.length == 1); } //////////////////////////////////////////////////////////// On 2.068, getAddressInfo(null) is the same as getAddressInfo(""). On Windows, this binds to all external interfaces (but not localhost); on POSIX, this throws. Introduced in https://github.com/D-Programming-Language/phobos/pull/3415 Underlying problem is almost surely the same as issue 14979, but unlike 14979 this also occurs on x86.
Comment #1 by k.hara.pg — 2015-08-31T12:52:15Z
(In reply to Vladimir Panteleev from comment #0) > On 2.068, getAddressInfo(null) is the same as getAddressInfo(""). On > Windows, this binds to all external interfaces (but not localhost); on > POSIX, this throws. > > Introduced in https://github.com/D-Programming-Language/phobos/pull/3415 This is purely Phobos issue. By PR#3415, tempCtring() behavior is silently changed for the null input. import std.internal.cstring; void main() { const(char[]) str = null; auto res = tempCString(str); assert(res is null); // 2.067 is ok, but 2.068 fails } And in std.socket, the getaddrinfoPointer operation works differently for the null C string vs zero-length non-null C string at least on Win32. That's the cause of the getAddressInfo behavior change.
Comment #2 by dlang-bugzilla — 2015-08-31T12:54:42Z
Comment #3 by k.hara.pg — 2015-08-31T12:59:30Z
(In reply to Kenji Hara from comment #1) > This is purely Phobos issue. By PR#3415, tempCtring() behavior is silently > changed for the null input. Phobos fix: https://github.com/D-Programming-Language/phobos/pull/3612
Comment #4 by github-bugzilla — 2015-08-31T16:59:49Z
Commits pushed to stable at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/156bf68ef7008343755ab450facdd0e5604f6fac fix Issue 14980 - getAddressInfo(null) broken https://github.com/D-Programming-Language/phobos/commit/e06c7a9e607bc7ca37958459c079e81c35893250 Merge pull request #3612 from 9rnsr/fix14980 [REG2.068] Issue 14980 - getAddressInfo(null) broken
Comment #5 by github-bugzilla — 2015-09-01T12:14:29Z
Commits pushed to stable at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/e885e163f0acc034f98f53ca59a809a82ade064f std.socket: Add test for issue 14980 https://github.com/D-Programming-Language/phobos/commit/564389e89b6398c99c206381cdfc8599e08c63cf Merge pull request #3613 from CyberShadow/pull-20150830-042721 std.socket: Add test for issue 14980
Comment #6 by github-bugzilla — 2015-09-07T16:46:52Z
Comment #7 by github-bugzilla — 2017-07-19T17:43:49Z