NetBSD Problem Report #47813
From cheusov@tut.by Tue May 14 01:45:01 2013
Return-Path: <cheusov@tut.by>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id 4AF2663F058
for <gnats-bugs@gnats.netbsd.org>; Tue, 14 May 2013 01:45:01 +0000 (UTC)
Message-Id: <87bo8e2v3j.fsf@asrock.chizhovka.net>
Date: Tue, 14 May 2013 04:44:48 +0300
From: cheusov@tut.by
To: gnats-bugs@gnats.NetBSD.org
Subject: iconv(1): Inappropriate ioctl for device
X-Send-Pr-Version: 3.95
>Number: 47813
>Category: bin
>Synopsis: iconv(1): Inappropriate ioctl for device
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue May 14 01:50:01 +0000 2013
>Closed-Date: Fri Sep 30 08:22:40 +0000 2016
>Last-Modified: Fri Sep 30 08:22:40 +0000 2016
>Originator: Aleksey Cheusov
>Release: NetBSD 6.1_RC2
>Organization:
>Environment:
System: NetBSD asrock.chizhovka.net 6.1_RC2 NetBSD 6.1_RC2 (GENERIC) #4: Sun Mar 24 00:02:51 FET 2013 cheusov@asrock.chizhovka.net:/srv/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
iconv(1) unexpectedly fails iff more than 512 bytes are given on input
and stdout is redirected to /dev/null.
0 ~>a=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
0 ~>echo $a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a | iconv -f utf-8 -t ucs-4le > /dev/null
iconv: iconv(): Inappropriate ioctl for device
0 1 ~>echo $a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a | iconv -f utf-8 -t ucs-4le > log
0 0 ~>echo $a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a | wc -c
513
0 0 ~>echo short string | iconv -f utf-8 -t ucs-4le > /dev/null
0 0 ~>
Function __iconv called from iconv.c:do_conv returns -1 because
internal buffer is not big enough (513*4 > 2048) and sets errno to E2BIG
which is then overriden to ENOTTY by fwrite(3).
>How-To-Repeat:
See above. It is reproducible on narn.n.o
>Fix:
Unknown
>Release-Note:
>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47813 CVS commit: src/usr.bin/iconv
Date: Mon, 7 Oct 2013 02:00:46 +0000
Module Name: src
Committed By: dholland
Date: Mon Oct 7 02:00:46 UTC 2013
Modified Files:
src/usr.bin/iconv: iconv.c
Log Message:
Save errno around fwrite(), which can otherwise trash it; PR 47813.
This appears to fully resolve the problem described in the PR, even
though one might think it wouldn't.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/iconv/iconv.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 07 Oct 2013 02:13:17 +0000
State-Changed-Why:
I think that change is enough to fix the problem - please test.
State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 30 Sep 2016 08:22:40 +0000
State-Changed-Why:
feedback timeout
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.