From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20754 invoked from network); 2 Mar 2022 22:38:58 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 2 Mar 2022 22:38:58 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1646260738; b=eSL/fYBM143jVvABBWphd9/HaI8tv5cT31bV8RetU5aie8jkcsgMbUPNX9aI1fBYf6m7kK+RVw IStIhvHRkDXBtcDGlKZvcMPIrP/cv9YsrNS2FOdUgb/a+HroP36T9/ULggQA8YnQWEfVvW6MAB bCfPyDudDLhEWOubS3XCc53DVm+eAdaKU3f7Kyb1uTTUmrk/j0OK2RqwL1h9mXVhH+54NCzG6e nP/41XFZ2DC97zNzi4qPpwcCtz4xZJFgZNdghnD9HGcvTNKPlqN7LZN2lVswaMZYHBwG6sSi0Q rEVFpSCyaWtE9nLm1KpQGpXWNA2i9Ykgnl3r5YLGRP4Amg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (us-smtp-delivery-124.mimecast.com) smtp.remote-ip=170.10.129.124; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.a=rsa-sha256; dmarc=pass header.from=redhat.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1646260738; bh=xDRpJRDL1LAffM3K9bJfdbY7TVDd9eRLTpni7h8C28c=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version:Date:To: From:Subject:Message-ID:DKIM-Signature:DKIM-Signature; b=nLNTIJYOP92MnGJDZykgYl6k89OPLvC222kof8Irv/cBd8E3tCIVlXQoBUT8RpGz+jdOs+U9wm yjNRtuuAUywM9e7hnq+hFN1DezxIrdiDBE6I7r7mWHrDLoWWyx3BXAR5tCmQsVxOnoTvqVETf+ PhupS3FNZijZ4LGe2LQXCm1Mo9AwxBuIFQAFYWe1WKrTAfprvDncJ0gw/7BmciSWdU8Ar8C1ow NItY9dF2Vle50LJEdMdf9A9pqOnn8T8x6iNzUD/jm+pPXW/SYLfAuDMw0Uidbhqp0WFJ2T1ygn 8kxG2Ycw5qiRS9xfFGHIDH+KOrUa87Z4xB+X7LBdtetrSQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Date:To:From:Subject:Message-ID:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=4JczmqWr7YBh1zM/CAZ2FateFmsTKKHJsTjiCd2jx0w=; b=kzxjzpxJ/g544iNo/m3+CTTOwB ULS+J1q8DmgatfI6GUdDmAczOGkmNNhjjpwrcy0zOHpX3YiEjfJ5EjWxtuz5WHzextcy9KRcaJkV1 MPbBK39wpgpUwkZWbszsFYU0s1sk8DEWLIrcRt1X+PfaLfw6tRPBsDmwWZmDk5CXpG4J+ilLsfbAz cIPUqN/Mhlo9lnktX27gFx/nAldbdqb3pBbjwsReMNNCPthoQyKNgLvioO1wcDyOupK/dl5n2qaTL qJbS9tQFpXtmHkggq+Xd64u+BfX8FiKvS+rnQmRDqe+SMZqhTdpYuqBA2wBe58bx9AMB1isSpJ2pN /hKn7kyg==; Received: from authenticated user by zero.zsh.org with local id 1nPXcW-0005U5-Rq; Wed, 02 Mar 2022 22:38:56 +0000 Authentication-Results: zsh.org; iprev=pass (us-smtp-delivery-124.mimecast.com) smtp.remote-ip=170.10.129.124; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.a=rsa-sha256; dmarc=pass header.from=redhat.com; arc=none Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:45110) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1nPXbz-0005Aj-BR; Wed, 02 Mar 2022 22:38:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646260702; 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=4JczmqWr7YBh1zM/CAZ2FateFmsTKKHJsTjiCd2jx0w=; b=IapdisME1unWqkQgcp5cIlT0Aaq3OX+xtxRZkJwilPXyr/qII/BICmUZqDkEshll5b7kSJ 0lZRw5UxSMuaY3SSutfbpbop5OF7TC3/rZeioS0Dzn8h7uLhNKSTblKuPw2WliM71ITGX3 ByOpqmLcHmfQkUImrItK9VH+eL6cRys= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-175-G8EX7UlMN46VuE6dXcaZvQ-1; Wed, 02 Mar 2022 17:38:18 -0500 X-MC-Unique: G8EX7UlMN46VuE6dXcaZvQ-1 Received: by mail-qv1-f69.google.com with SMTP id b3-20020a056214134300b004352de5b5f0so1284794qvw.20 for ; Wed, 02 Mar 2022 14:38:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:organization :user-agent:mime-version:content-transfer-encoding; bh=4JczmqWr7YBh1zM/CAZ2FateFmsTKKHJsTjiCd2jx0w=; b=uUek39a4Va6P2hBJl/AqUUzZe1nte5h+l5+A+VdzA7Mbu7vDUVMQLhfXde7dAdNlyY Ja/GP5pia22HV3stNZutbunGBqgtSqHSxERRojOkm2EdiTqPEF6ydL5i8u+RIkVdBIoa xsk2pHlLDMtetq3x5YVvJFla39NzdIJg1g4DRfNjY9umXFWm9aUrT4zBpJSuk/CbNcWO lwUzmKeKEKgT3gXlMJRc2IJktdib/oslVj+U/EdeXFL/kbdi8C3UQBXHkAfq1SaL2E22 RJ0AoeaDZHhpcLK/E7LjbWN0Rxe9qhbw+7rl7Tds4bJfYtvUJwTVTUpt/6dLFeAqe0hB dcqA== X-Gm-Message-State: AOAM531ksgwd7VqhK44K/GEQr2B5LxdibnnZNu3pHr4jPWt/mNj4Hmq1 n+uDwjwKwoCOD3C1zZINWpA1T0Tak5CECWtm/E3FoXzA32AlY+JIiTMk4dmeRZzBjKF2lASRz35 aIJRsHbgEH+tXJiY9AgHHS+9EgllwshMRyKU+TSMP7Ldj8TaJ+IqZRFD5YjQU X-Received: by 2002:ad4:4342:0:b0:432:af62:2041 with SMTP id q2-20020ad44342000000b00432af622041mr21683484qvs.24.1646260697431; Wed, 02 Mar 2022 14:38:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJwS46ICBFFJ4yEkpxI/OLdtbuVlwX1p9dHQHOyhlulnSJ7sm+ocNZigUGhAPHjzBduSmkR9Mg== X-Received: by 2002:ad4:4342:0:b0:432:af62:2041 with SMTP id q2-20020ad44342000000b00432af622041mr21683467qvs.24.1646260697003; Wed, 02 Mar 2022 14:38:17 -0800 (PST) Received: from [192.168.8.138] (pool-96-230-100-15.bstnma.fios.verizon.net. [96.230.100.15]) by smtp.gmail.com with ESMTPSA id s19-20020ac85cd3000000b002de4e165ae0sm181327qta.75.2022.03.02.14.38.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 14:38:16 -0800 (PST) Message-ID: <5e9cdfc2b807bfc4aa4695938b70156742c2e120.camel@redhat.com> Subject: Regression with stdin handling in non-interactive mode between 5.8 and 5.8.1 From: Lyude Paul To: zsh-workers@zsh.org Date: Wed, 02 Mar 2022 17:38:15 -0500 Organization: Red Hat Inc. User-Agent: Evolution 3.42.4 (3.42.4-1.fc35) MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lyude@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Seq: 49788 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Hi! I'm reporting this here because after some discussion in #zsh, it was determined this is likely both a regression, and also isn't POSIX compliant. Keep in mind I don't have as clear of an understanding of what's happening below the hood here as I'd like, so I'm not 100% the subject line here is correct. I've got plenty of examples to clarify though :) Basically, what seems to be happening is that since 5.8.1 zsh no longer seems to correctly handle input from stdin unless the terminal is in interactive mode. Here's a simple example script that demonstrates what I mean: printf '%s\n' 'echo Shell is $$' sh 'echo Shell is $$' | zsh Running on zsh 5.8 returns: Shell is 70 Shell is 71 Running on zsh 5.8.1 however, returns: Shell is 86396 Shell is 86396 This can end up being an issue when trying to do things like (assuming sudo is configured on this system to not request a password, and zsh is the default shell): ssh foo <<- _EOF_ whoami sudo -s whoami _EOF_ While that's maybe not the best way of doing such things in shell, I have quite a number of scripts that rely on this working and have for quite some time. According to llua from #zsh as well, this is also likely not POSIX compliant according to: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html (see the section labeled "INPUT FILES") llua suggested that this breakage may have come from e5cd2dd980302f328d232d933f646c3dc02828bf ("49290: Replace stdio for buffered shell input."), which I've confirmed to be true by bisecting this locally. For reference: I originally reproduced this on Fedora 35, although I have a feeling that probably doesn't matter too much here. If there's any other information I can provide that would help with getting this fixed, don't hesistate to ask. And thank you ahead of time! -- Cheers, Lyude Paul (she/her) Software Engineer at Red Hat