From nobody Thu Aug 11 16:43:46 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M3Xgk3Pdrz4Ywx3; Thu, 11 Aug 2022 16:43:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M3Xgk2q44z3xxd; Thu, 11 Aug 2022 16:43:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660236226; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HG/KUyq5e7a1zrInqu0SUGRemRm+LYcZ06e4vYPVi1k=; b=NGe+XhjkFOqpzSL+A1qaCOC7DJn9FubkP3X/28HvfuHTUzgxAK/PombiRUm6xCbePEXB/v xNLGiJRFykHvzyySuzNv00kpdRbW/E+7vSZw4clXXdeQPasri5zmS1f9Fto7iEC1hi1IRc 7OSnHz1tSng3V3wTgwdrSq2UuZ/289vfOKrIeM5Wb6ZioEfmExAmvAzCt9+DTvPrDx6DVE d5hsGRHd6fY7xGYwJ9YX050qlpUcaUgWTxfXR4PhzrnBvMNnP2Iv7YW8cta1Fxn53G4TGU WALBUjidCRKfSAYrZvDEtU4R4ahnOhuGh8mpIPVwFfeHw/gqEObIJMSByuhHqA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M3Xgk1rsqzyn5; Thu, 11 Aug 2022 16:43:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27BGhk4o082636; Thu, 11 Aug 2022 16:43:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27BGhkSL082635; Thu, 11 Aug 2022 16:43:46 GMT (envelope-from git) Date: Thu, 11 Aug 2022 16:43:46 GMT Message-Id: <202208111643.27BGhkSL082635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: ea0f37dec65d - main - iconv: only conditionally use ICONV_SET_DISCARD_ILSEQ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea0f37dec65daf2b7e05712738cd1720aae129eb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660236226; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HG/KUyq5e7a1zrInqu0SUGRemRm+LYcZ06e4vYPVi1k=; b=yGGyzt3p390XtV5czUOPlsomoc8U5ZUiJzS7JvwLXODCVO1qZD9ajpBHw650gswc/dLDWs 8FznNZfJLoodWYc8muOMpElMbjSSfW5SwKx5CYxddPC2439mQaKEYdiljz8R2fhQjAa5RA zfGBRjY9521/XZj4RbYhiQomZuTy1zok29iCc4cijzem0xX2ab1H+P76iMZjD2gCmL5cQC 2SKHkK5MHTyYfOXGA75rSRhlhvxlHRizXK2iOZvn6zdScMr0qU4jfgj0gdJVvOqinDBr4C Pn+LOm5OvuHraxrQj0OTX2ANksgRvyYa57IexW+SHbsJ1c3iUC56+sq+ZaY7Aw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660236226; a=rsa-sha256; cv=none; b=XfMtqTBNXOQhldQ9awiWVkjc8LEv2JAPnB86ssgJIMQ3wAMbj4BmWqW92nwQl0oDa4ggSz evOw+3nRkz/B9bfXYOISrgY76rIB8MS3lMJY6lehpTVd1Sn4FWo+BkEvnURmV5aiLID2Hg U9I+8C0Qd6bCMTnjnpQVFu0OqBbnQOUcouxw/68uKV7Wau2naMDJF5DpfZyrXgpzpyf+3o FSV0nYY4DKYlZmP9Q1Vfrpw9e23mwuFQJeZOzhHPD8QPWfBj3vTSYP8bsQGHLH6qM1LKAo RZXP26fFaANKY2c7P8YGXgypvV66ClrjExeNCRLbjiZLhwqNZ4jNOocqxVHfOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ea0f37dec65daf2b7e05712738cd1720aae129eb commit ea0f37dec65daf2b7e05712738cd1720aae129eb Author: Kyle Evans AuthorDate: 2022-02-22 05:05:28 +0000 Commit: Kyle Evans CommitDate: 2022-08-11 16:33:28 +0000 iconv: only conditionally use ICONV_SET_DISCARD_ILSEQ If the -c flag is used, then we can set it with ICONV_SET_DISCARD_ILSEQ; otherwise, leave it alone. The user may have specified //IGNORE in the 'to' codeset specification, there's no reason we can't allow that but we'll currently turn it off. Reviewed by: thj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D34342 --- usr.bin/iconv/iconv.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/usr.bin/iconv/iconv.c b/usr.bin/iconv/iconv.c index 7e911b4432e5..ba099f8af520 100644 --- a/usr.bin/iconv/iconv.c +++ b/usr.bin/iconv/iconv.c @@ -77,9 +77,16 @@ do_conv(FILE *fp, iconv_t cd, bool silent, bool hide_invalid) unsigned long long invalids; size_t inbytes, outbytes, ret; - int arg = (int)hide_invalid; - if (iconvctl(cd, ICONV_SET_DISCARD_ILSEQ, (void *)&arg) == -1) - err(EXIT_FAILURE, "iconvctl(DISCARD_ILSEQ, %d)", arg); + /* + * Don't touch ICONV_SET_DISCARD_ILSEQ if -c wasn't specified. It may + * be that the user has specified //IGNORE in the -t specification, and + * we don't want to clobber that. + */ + if (hide_invalid) { + int arg = (int)hide_invalid; + if (iconvctl(cd, ICONV_SET_DISCARD_ILSEQ, (void *)&arg) == -1) + err(EXIT_FAILURE, "iconvctl(DISCARD_ILSEQ, %d)", arg); + } invalids = 0; while ((inbytes = fread(inbuf, 1, INBUFSIZE, fp)) > 0) {