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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17152 invoked from network); 26 Mar 2021 17:16:39 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Mar 2021 17:16:39 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1616778999; b=uMcZQHGYKjPsGp1xj3G7PRZAoRGmzFoSxgSb/wgNR7zDnid4PB+QmnV7Z73J4wBHwEQNkUsZJZ Jk39Jen6F2KvX1In4w8CG2EQ1w9fdY5oycd2hcAT3LT4ME9NNoXE979EWHFbavD6hp5/ll69T3 jl4fr2IC1/1Rc6XJahAgwP5cpxmMnM0L3k6HLhN0qn4x+dmtL8tKHON1bZc0feytHDYVn/atvr VEpxoZ9IbHA9poK/GiELN4YQFTwSNkZp+dFo+Z11skT6h7aZ/ebHYyZMhN1HWWcDSsKTsK5F+n OdUu3f9XYehwGcXTk1tVFwZnm/Ta1MmtInyhH+OwD0nQPg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oo1-f53.google.com) smtp.remote-ip=209.85.161.53; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1616778999; bh=PN86kMt6f5Tj9Xn3RGtjfo9LD5GaPFBVEwCsYoawweo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=bTZq+lYP2k1a1waKf9gqFBtp+zn7NVnJxsqqH/q3LU5NEd8epo5UmzBihHORizGVr2OXJ8dmng IJd9nK1F73eTCd/4M14oUwYy9t1wQcIOW0vAuaHAm8MR8pm/D4/nUh0/z2YGqSObmkPbHvkwHO QvBVR4MYOYkxTBWgZuN4OafpWZTKh25Ke5+reSkHYkJbMmtBcZMbRrnNCrTjn5Pn8lcFvPdpZi jdDLsHZpCOTgGUKVv1h9LMXP0jfZqyrkj7+cMUh16yTte8VEsQSYg8520yZ5UcSUOxalaZlyao 30qXr7EMQTnoD/aVAduxnlsupETOK2MV9LzZZYgVR7U6pg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=tFezG7TI+6id5vJDvjogAfJuuWnGv4TmaNtYO/36FP0=; b=GOTHn/mP+eKsZuV2QR94cvLoBP L9fQ7zWKFPo55IftLnaNWniJMSv3nVxPsxGS1eiY5fjP4WXZGt9OCodMRAVugDgNNuyqA5Rl2bPp6 uk8T7EKcvI4o2py66c/fXui6JbC8oSTIDjcYanakk6aU+pMcJIsapNe+yOho4QVwNrub/0LsIIF7P GVdyAhuy7tLgL7hf7Jn1w7pf9Y7LaWnMxapdzv5tbiEpPZiy3fK5AHqnPFUz6IAhkgfsrtbE/Hoft c/VQpfzhcmHVA0kSvvdH/oVoYYbvx1s63DZGcLT4DhdtxZd6WyuyIj87a0Vk8DRsU+gI/3NrI9Ikg P4AcAVrA==; Received: from authenticated user by zero.zsh.org with local id 1lPq4c-0006D2-Fx; Fri, 26 Mar 2021 17:16:38 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oo1-f53.google.com) smtp.remote-ip=209.85.161.53; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-oo1-f53.google.com ([209.85.161.53]:33728) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lPq4Q-00062F-Tl; Fri, 26 Mar 2021 17:16:29 +0000 Received: by mail-oo1-f53.google.com with SMTP id i25-20020a4aa1190000b02901bbd9429832so1470942ool.0 for ; Fri, 26 Mar 2021 10:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tFezG7TI+6id5vJDvjogAfJuuWnGv4TmaNtYO/36FP0=; b=YLaeGcZJo6SSTdBYSwlTOZzLZ4FYEHz6//Gx+QCUh4DhBnEQqZ+Qmmwoo3GVGj2PxX oLM1VuENmvetctUWqFLhPcwCvOBbguYcnWQaO26BbZr8Br5xjgyo3jWCCkplL2o0LUQ2 /ZwlAOFRK2GZ7usYjSGulSQGdsvhQ9iEzrgx6qcIcTj/vtNcOIpfKMELNJXmCz8voUYJ 4wOXxh4X66zYL//9bliIBAhrF2Gjlv1cjUDBvGO+jHORlItdmWPMdB4ou1AbaPVJLSFd K/ZNedC3TAawpc2BM6FjA8aTjqS6+7Qco5Qp4uHdZkvF37ExaaAZy6v8zz7UraJRMa8W YtDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tFezG7TI+6id5vJDvjogAfJuuWnGv4TmaNtYO/36FP0=; b=RwdMtWQCe2FvDhBJAzdONqKF9JsRbTH8NINw583GgQ5nLUzu6e0kQl0imqvlxAmcMT R+LYvgwiKnVKBCZZb7cI9FmFPKAYvZhZAPDHhJ4S9a+WRjkOXW6qwcLTKNgPrgPS6IjD 5ldxP+AMZ6xP9ydUkTqSCItyvOsNHI2V6BDndX9Tm0ehOibLSmAoIfyVSOovTgeZL2QX 2ZLCn3x+c/xk2hqhhDK9ns3GymWwOqbrCo5Z24M1fFTTVQqYkDGcVcBpB+eA7cWvfM+T xRXA2xE5aNftTWmxh2rcMmoy8ZQeP1kj3ZyMOzM+XuE+G3bnYITAwXbalu4HAaswkuaX dSWQ== X-Gm-Message-State: AOAM530xuRu1GmfR50SzBisy+aLKMacMafu1b2OrbR59rc8qOKjKb50F co04ToZ4zvQ9C/ue1ag55LDcw+ytbrx5JtQ+0vNPLQ== X-Google-Smtp-Source: ABdhPJwBoH1WKmwfxwxuNPLlQs33Kz9pFRTQGFwkCyPaghQ4L+5BVi9umrnewLeVbIoE9G57nkjdFXA33nNQ6L6vONY= X-Received: by 2002:a4a:d10f:: with SMTP id k15mr12038278oor.82.1616778985555; Fri, 26 Mar 2021 10:16:25 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Fri, 26 Mar 2021 10:16:14 -0700 Message-ID: Subject: Re: [Fixed Hardwrap][BUG] Pipe fails even when using ' || true ' To: Rudi C Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 48249 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: Archived-At: On Fri, Mar 26, 2021 at 6:09 AM Rudi C wrote: > > This pipe unexpectedly fails: > > ``` > $ setopt pipefail > $ { print -nr -- "x" || true } | eval 'print -rn -- "${(q+@)brish_stdin}"' ; echo $'\n'Returned $?:"${(j.|.)pipestatus[@]}" > '' > Returned 141:141|0 > ``` Exit status 141 indicates that the entire { ... } construct was killed by SIGPIPE,which is occurring because there's nothing in the "eval" on the right side to read the output from "print". Whether this happens depends on order of events (does the right side of the pipe exit before the left side finishes printing) which can in turn depend on OS-level process scheduling algorithms over which zsh has little or no control; or because of pipe buffering, which is also an OS thing, although with only one character sent on the pipe that is unlikely to be the cause in this case. > The behavior is nondeterministic on macOS, and it actually doesn't usually fail at all! See "order of events". Process scheduling may depend on how many actual cores are in the CPU, for example, determining whether the pipeline executes in true parallel fashion or via time-slicing. > BTW, there seems to be another weird thing going on; Adding two spaces before `echo` breaks the whole loop both on Linux and macOS: If you're copy-pasting from an edit in browser gmail, for example, it has a tendency to insert non-breaking spaces whenever there is more than one consecutive space, which the shell interprets as non-whitespace and attempts to execute as commands. Annoys the hell out of me whenever I forget that it happens.