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 4734 invoked from network); 30 Jan 2021 18:52:34 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Jan 2021 18:52:34 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1612032754; b=MvhnEus3aYmJLG9+QSbnV85+w6oifK78CiPFAbMcw2odTYQHYkEStJTdzeSOUzJUawb9y6ZKSS XJbaKYY9gVBoSY+hZQ3D+gI1aNpwQIXoFD08YeYTKFQ4IGbsA3AXcFhFuDtpwKiTdLq0aEQ+07 dvyUL02+/OZPAADB0dISro5RIz75wtmcQ9O93Gngtkvih8f+TnyDiy1ZUHC3h8JrUN0j1oS1EV P7um8Lxp96xucUXlmUUBrOiDl944Dsv9+S3XByrDKd0s3ndZKSD27VYH4FSE6jtXZgfw4XmWfi eyUbM1+hnQQiCjyzn/i3HRrWXMHNVS5y+h818AUwwi5drA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oo1-f45.google.com) smtp.remote-ip=209.85.161.45; 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=1612032754; bh=rIt/oCKxG0AAqOENP1PORIosRrZaWmHedHpANv8d/P8=; 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=ArT7pcNyJmLgnTP3ouZ0oAIJNPHEuVFAYDo+VSqfviA4Nw0t7o81LRhtah+tbfuxSQVv07tDjx fDfTYKc6DhNLjyxpkhrA4Hom47KqWBjtIYancD6JgS7y9xUbcG6DZgL6WTz/78WcOsBbKa1EPu nxfcVyWqbIP2pRXm5njRReNq9Ghp5InhpS+hra8oTK+vWRpln6FTvJrSQAi3Mt3253EY7uEMUx TqhWORp8j1Wl6q00j72UUuguHx8MAZXrUWQFxyK0C+LlUuj2WkBj5R1wv4ZmA3h/33q/xcjTK5 xUBJUDnv/GGTNoT2BzT4/ib3MHk1SQ802pXC3cjlCE4Vdw==; 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=FEbyaCghV/byd6F2UtYsPQ2FLBzeQTRr7bNcEfBWGOQ=; b=rr/ClewL60qXagl5IJiteT4ntB dMqtvZfuHhoImUO8HEIAYxwDlYT9MunS0pDEnOeIB82IrTwuMUh7Keg8mbKHHPsGRzwcQgGoeY9Bg uwVoI4PNfnJsEWTbODEwKdoQG8Q9rAI1ndcK5IUtHc4kFDuc/RUJjbtiAZJ4SIE7I/lPmvAoskLjX mHHRxO6FIft7RxABXPBm261FbPLDVwFXC35+qk1GGlG6yukOLMvPARFxjnZWZaeuWoqvgCXyBgYIH GqeEEpHxEaif2JJ3tCV5ireD77gSPHjGy0JoGgaIknF8fHQjsvmQwganIOD0W3qkW1dIpGwOdWR8L /+sNyDxA==; Received: from authenticated user by zero.zsh.org with local id 1l5vMF-000LZt-E1; Sat, 30 Jan 2021 18:52:31 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oo1-f45.google.com) smtp.remote-ip=209.85.161.45; 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-f45.google.com ([209.85.161.45]:34597) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1l5vLx-000LQd-A3; Sat, 30 Jan 2021 18:52:14 +0000 Received: by mail-oo1-f45.google.com with SMTP id x23so3213925oop.1 for ; Sat, 30 Jan 2021 10:52:12 -0800 (PST) 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=FEbyaCghV/byd6F2UtYsPQ2FLBzeQTRr7bNcEfBWGOQ=; b=S96SgfQO3Z7pFg4X1XlBfID4dPhOUV1p0r4NS6Y4nF85092E8rrgnzupWIgu/RwMRq /AcjO0MInZd+FESzBigMAAsoVQiejeBpULHhWZ6x8OjCbvkYJtlms5Oct3/k2wCgqtno tGH6Aw0AoSq/AO1lHEq7oMqTA/qEz2MZHl4WN1cKLpszZ7NOAI6XYYdeg4uIjO42hkzU ymwJZf69JVnnhTi+NW+/6Xoq35LrrzDa46JCfOQ8sKZI8AiC6fZNkm3U2111i2LSJ6pq VhzOB2O6Z/+HL7tDLefYluWdi0/PSpLaEfL14E7D/yNquly/lv9BZLmbhSjs9RbKka2y iK/g== 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=FEbyaCghV/byd6F2UtYsPQ2FLBzeQTRr7bNcEfBWGOQ=; b=E++V3hjv79WHH+WYoY7O+mWwnXKMdgadGBoex/YR1O6gvwpybizmz2TQ6kYlL/IcuB 2UKlcojYHtxlZAldhPG6zbnSP38qBmNk9kBZJl9631+2jV7PDaQNDrRqwCg51Jo5LUMM 7SpP+uTScWzGmyee6qHMQvtEgWPI1f903B8hWqugSzQoWQvx0thbdFC17Hhj2JD6F8py /D1WL4NkI2L9fceH5P+TH5sqeT51MeutzlLqLQ5ERg+XwNes2M4ffygzID8A/iAlrVzo zlUhE88oW5z4d99t2wHMFXp+dT1rsknm1VFwSjHaupamu1qQnN1cOgfBOwDywNdaSPO1 xsHg== X-Gm-Message-State: AOAM530Mlu5xf1OZzB/wAO72SjJn1arXvls2RXG4wJy8X4G3bOl+ATue /IZcRBJcPAdq4LfnKkhBgANrFrUNV50g+/NgTcrtkskpMPWLRQ== X-Google-Smtp-Source: ABdhPJzgzsxj2wt5KAh0/bxRdXFFwD4cpbBwg5SmgDsnCzy6S0t1Fht+bntPGlKmQUrrYDOpZ5m3LvQgu5cQqb+pVV8= X-Received: by 2002:a4a:b387:: with SMTP id p7mr7059468ooo.82.1612032731665; Sat, 30 Jan 2021 10:52:11 -0800 (PST) MIME-Version: 1.0 References: <0421713D-25C5-477A-90AD-C0BD2B40EED2@gmail.com> In-Reply-To: <0421713D-25C5-477A-90AD-C0BD2B40EED2@gmail.com> From: Bart Schaefer Date: Sat, 30 Jan 2021 10:51:58 -0800 Message-ID: Subject: print -C and terminators To: Zsh hackers list Cc: Beverly Pope , Roman Perepelitsa Content-Type: text/plain; charset="UTF-8" X-Seq: 47890 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 Sat, Jan 30, 2021 at 7:00 AM Beverly Pope wrote: > > On Jan 30, 2021, at 4:50 AM, Roman Perepelitsa wrote: > > > print -rC1 -- > > > > This command doesn't print anything. > > % print -rC1 -- no_such_file(N) > > zsh 5.8 (Ubuntu): prints nothing > zsh 5.7.1 (Mac): prints return Hm; I get no output, in both cases. Similarly on Centos (zsh 5.0). This behavior seems like a bug to me. Neither -n nor -N were specified, so "print" should always output at least a newline. However, it's been around for quite some time and obviously some people know about it, so I suppose it should just be documented. The doc does make a very oblique reference to it under the -N option: print -rNC1 -- "$list[@]" is a canonical way to print an arbitrary list as null-delimited records. The implication is that -C prevents the terminating NUL byte from being printed when $list is empty. ubuntu% print -rN -- | od -c 0000000 \0 0000001 ubuntu% print -rN -- 1 2 3 | od -c 0000000 1 \0 2 \0 3 \0 0000006 ubuntu% print -rNC1 -- | od -c 0000000 ubuntu% print -rNC1 -- 1 2 3 | od -c 0000000 1 \0 2 \0 3 \0 0000006 The related behavior of -n is a bit weird: ubuntu% print -rnN -- | od -c 0000000 ubuntu% print -rnN -- 1 2 3 | od -c 0000000 1 \0 2 \0 3 0000005 This, however, is more questionable: ubuntu% print -raNC1 -- 1 2 3 | od -c 0000000 1 \0 2 \0 3 \0 0000011 This explains the trailing spaces on the test case for globbing that I posted a few days ago. I sort of get why -a needs to do that when the column count is >1, but it shouldn't be inserting trailing spaces when the column count is 1.