From owner-freebsd-bugs@FreeBSD.ORG Tue Jan 6 20:03:51 2015 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7CFBEC14 for ; Tue, 6 Jan 2015 20:03:51 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9AC18270E for ; Tue, 6 Jan 2015 18:13:15 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t06IDFkn014650 for ; Tue, 6 Jan 2015 18:13:15 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 196567] iconv() function crashes with cryptic error message if linked statically Date: Tue, 06 Jan 2015 18:13:15 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 10.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: quintus@quintilianus.eu X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jan 2015 20:03:51 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D196567 Bug ID: 196567 Summary: iconv() function crashes with cryptic error message if linked statically Product: Base System Version: 10.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: quintus@quintilianus.eu Hi everyone, I=E2=80=99ve been trying to link a program statically that calls the iconv(= 3) function and was confronted with it printing the rather cryptic message "Service unavailable" and immediately exiting the program. After some websearch, I f= ound this thread on the freebsd-current mailinglist: * https://docs.freebsd.org/cgi/getmsg.cgi?fetch=3D140017+0+archive/2013/freeb= sd-current/20130825.freebsd-current * https://docs.freebsd.org/cgi/getmsg.cgi?fetch=3D177755+0+archive/2013/freeb= sd-current/20130825.freebsd-current * https://docs.freebsd.org/cgi/getmsg.cgi?fetch=3D195390+0+archive/2013/freeb= sd-current/20130825.freebsd-current It appears nothing has happened since that thread, so I add it to the track= er now so it won=E2=80=99t get forgotten and because I just experienced that i= ssue as well. Here=E2=80=99s the minimal example program from that ML thread to reproduce= the crash: ~~~~~~~~~~~~~~~~~~~~~~ int main(void) { iconv_t ic =3D iconv_open("UTF-8", "ISO-8859-1"); if (ic =3D=3D (iconv_t)-1) err(1, "iconv_open failed"); iconv_close(ic); return 0; } ~~~~~~~~~~~~~~~~~~~~~~ Save in `foo.c` and compile like this: ~~~~~~~~~~~~~~~~~~~~~~ $ cc -static foo.c -o foo ~~~~~~~~~~~~~~~~~~~~~~ Then run: ~~~~~~~~~~~~~~~~~~~~~~ $ ./foo foo: iconv_open failed: Invalid argument Service unavailable ~~~~~~~~~~~~~~~~~~~~~~ I can confirm this behaviour stil exists in FreeBSD 10.1-RELEASE. The above example program still "works" (i.e. fails and demonstrates the problem). Expected behaviour is to print a useful and understandable error message if= it really isn=E2=80=99t possible to get iconv() to work in a statically linked= program. Greetings, Marvin --=20 You are receiving this mail because: You are the assignee for the bug.=