From patchwork Tue Aug 6 06:16:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 95345 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0A62F385DDEE for ; Tue, 6 Aug 2024 06:17:44 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 0C032385C6C7 for ; Tue, 6 Aug 2024 06:16:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C032385C6C7 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0C032385C6C7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722925007; cv=none; b=kDeSArVIZl3ZDX4QQw7rUxT00KO32eQul3X0mLh1uw/p34aLdR6swqWLaYjdpNPdTcEIOMAgY/i8PMISjhNTq3yOY+J2JMH9LrY1daY4l1nRO36BLT1irCFTULKUOrJr1Y/zKhY0mswnk/e5yJYB01XIvHjYldTdJst0oPsrrkM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722925007; c=relaxed/simple; bh=8UT+c2d2A1mMfi83QAzvOzuhjdx23k3kO8SjfEakuz0=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=ZY/eQW4T7pFCO3+kjN4TWVyTgIin78tLuA3PPJBPe0jO1mNzgCthzXfcacpwCGdULp3Nk3wvzJvKiEOdTaQGo7ldhk/kxmIQ7sQqsk6QTYpjoj0metT+GEm9I+2dy7duySK/3SffmAI/viAZ9EXRqoBylB3QwoYAnIy0TraKG/4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722925005; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vJ9Lx1p0CMBVuOX+nSB3ppxWjoRbm8v51YQTJMJCKz8=; b=ED6QfwDX06AOpAvIVbHy8nsJ4E0byGu8XFloMx8VGORgTH5O7lAE3XZVTHEVCkugYHnmXi Xm/mW3VloXqNYW8YxgWyTtSenNcSq3c2TjrY7VgpmiqNfa4sOE1Glv8v2ax94mWk8EMBnG zQTKhAeJtDfXThdTQD4xXinosyanF44= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-zUUOTU5ANkerz5LmPJggeg-1; Tue, 06 Aug 2024 02:16:44 -0400 X-MC-Unique: zUUOTU5ANkerz5LmPJggeg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C7D9219560AD for ; Tue, 6 Aug 2024 06:16:43 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.45.224.40]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D5E0E1955D42 for ; Tue, 6 Aug 2024 06:16:42 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH v2 6/7] iconv: Multiple - on command line should not fail (bug 32050) In-Reply-To: Message-ID: References: X-From-Line: ae480c4e705870913177a9bb21ef8eb384f5479e Mon Sep 17 00:00:00 2001 Date: Tue, 06 Aug 2024 08:16:39 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Usually, the second and subsequent - return EOF immediately and do not contribute to the output, but this is not an error. Reviewed-by: DJ Delorie --- iconv/iconv_prog.c | 3 ++- iconv/tst-iconv_prog-buffer.sh | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c index 3e02db7319..dd4bc3a59a 100644 --- a/iconv/iconv_prog.c +++ b/iconv/iconv_prog.c @@ -287,7 +287,8 @@ conversions from `%s' and to `%s' are not supported"), ret = process_fd (cd, fd); /* Now close the file. */ - close (fd); + if (fd != STDIN_FILENO) + close (fd); if (ret != 0) { diff --git a/iconv/tst-iconv_prog-buffer.sh b/iconv/tst-iconv_prog-buffer.sh index 54ff871d32..a9c3729d94 100644 --- a/iconv/tst-iconv_prog-buffer.sh +++ b/iconv/tst-iconv_prog-buffer.sh @@ -265,6 +265,11 @@ expect_exit 1 run_iconv -o "$tmp/out" "$tmp/abc" "$tmp/0xff" "$tmp/def" expect_exit 1 run_iconv -o "$tmp/out" "$tmp/abc" - < "$tmp/0xff" "$tmp/def" ! test -e "$tmp/out" +# Listing standard input multiple times should not fail (bug 32050). + +run_iconv -o "$tmp/out" "$tmp/xy" - - "$tmp/zt" < "$tmp/abc" +expect_files xy abc zt + if $failure ; then exit 1 fi