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=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30148 invoked from network); 30 Mar 2023 11:12:46 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Mar 2023 11:12:46 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1680174766; b=XhFX1Gs7kgQJS3Zo5EFB3ZWrjd4A8yAzflJZToBsuDBcUOcyr5qVp808c2+jskTiJ8gCVhoX1Y XULLJDlnFVhHx4st6f1j8QjQ27MAcUFheKGqCufbuM42XCug+fUdZnKGERiQDbB6QOp5ldtFob O1SZZzOhgsyMf6A0gUulWyhS0ZFVhbgNa7w6K2133koXSn7wc/U654k9iWKhitVDoUrI03L6yT XSCs8Hc2+DAR24LDSgQVfAqLp1xz3qaPKu23Is/w8BVFlW/XLO7QPsokkEaxlcCtHP0F095WqG ILdGs7WZj46yqfFXsUcf4vOfDLzinAk2nd1DMyjoU2q0dQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f171.google.com) smtp.remote-ip=209.85.219.171; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1680174766; bh=YXd2dvHCYGb/kI1YfuR3x3MFLJxOOd2jNpn76iJiRKU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=SQHyGdXIyLNx0Vq87Y1QjJgvd4C7Kxy3LWWd1KtivFvp4rGeUgXUeVj2aVRXi2d1ZzJsu6B53G 7JFxRFyea2jgmPNlkmhzngQFnHFauIG7XELYnmJLv337EUqsxHygCVpUjjNlI9+UsR2H+gy4Hn Lg3SvbLRmc1uQe7d3rr8Yj44LntV7a89+L84uB2tHx3FNkf7ne5zivmrHHtZmnegZbeTPZosZ2 24GCE2uL8VfuNOJLZVPIZgBCJJHxYe9d0CerX1d14NgL2UJotk29LHgtoe1MK9OEFrnukC1kNM umemfDjBXrXztnNUFqx93fw5kFjt8luvzwaGHF9HdCioCQ==; 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-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=kveu4OAlFpVKrCEr34UToRHSOl8+gb9J1B5IqOXVmdc=; b=SaIA3BPfPV52DmH4c+AxTB4kZB TobAnud/zf0AA13uV92fgggkv47VeTYmWSkmt4Fux9gcbeSLNlI78xzT7SQrLF0v5WKtg3eVGHzy1 v8XIC20DYsOhVNoTo06KNML4h/qmuocO1uhrCO9ggdj9vzNQB03qv3F+7sxkbobaGXz3ba8JVE/cs S/FKxYm2iso2AONUBsO+KeBJH+b430feOLZRHR+iZJzDtTBqZ3i4eGd7qqEwPyLYLPUfyYFDJvNhc 4LQWJkr4J1QuNOHm1uwYRMApgeNAPUPK/m6UhaDgr1TRBGrGrn85Nsyps8h80zLgg3wpx8fl4jrc9 6WTQ8iWA==; Received: by zero.zsh.org with local id 1phqCz-0005Sx-3d; Thu, 30 Mar 2023 11:12:45 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f171.google.com) smtp.remote-ip=209.85.219.171; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-yb1-f171.google.com ([209.85.219.171]:41818) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1phqCF-0004jw-7M; Thu, 30 Mar 2023 11:12:00 +0000 Received: by mail-yb1-f171.google.com with SMTP id i6so22961352ybu.8 for ; Thu, 30 Mar 2023 04:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680174717; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=kveu4OAlFpVKrCEr34UToRHSOl8+gb9J1B5IqOXVmdc=; b=bLpdFHOcNmOUtCGxH2AwY18gyh4a2TWdqCdOB83dk0ox+E3kXhuILEpNOAlTOnvr4c UZc85mkoigr/7PnmQ2cV20FmJFl+4RdkclGtwa+ie2HQyke0PVXcf6w3SQaz4uh6xRTU WrieyowGX5pF+bLHx89KVL2goVNK/n41vxZ04X59Ks79zL+wgubqGLLl6QJ93CiNhLIr vhVsGZAjFB8ku9EJqusS/vwTMYrg1QSj/Ih5DnW1/nQ+xGfG38z8RDkbPcKn2FlAxXkQ dTYYVyRygZehNS0C8hYaBFiE9qy7fT4J6uG8YV294p8x2yZCrnH8+tvWfx/SFJECKgh4 sKyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680174717; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kveu4OAlFpVKrCEr34UToRHSOl8+gb9J1B5IqOXVmdc=; b=zDbhq32UA1Q+td/0WjltMOzYMYGK7Myedvl9a774fcNVh3z4HRy4KG/G+eEF1OMPIR ZtR1f6YzWUJfjccSeOfiAHRwaIwBi40qPW5hheXzvSRfPpyf5rogZkEaP7jp2stLCOBM DXDyQ+8DGJTcQvQwJDTQUp2klIXjuXtBIOjnZQsxViPPa8nCx2UZcJGi+hju1elsQLRa u4EVyAHPTLHbPYAO66tNAaGkjgBWcBxxVtAeA0q+bbKyYt5a45ZZlxWf4Ttoe9EMJP3A O8ZfXMp8TcA9lsZLsuPgV9ioXcrmCWQKCK1K5q9xZH0Rp+VSi9cw0XqY3Or9jh1vK8XD D3BA== X-Gm-Message-State: AAQBX9dd6+i5iqIGt6TkRr3F6hFA/p3Tq2ReV0k5nrozbN5khLtoNSkK /iNvLJaXxOltpckdpHgimjGP3asA8fi+eicUuOlq0Hv2N3o= X-Google-Smtp-Source: AKy350bY9v2m9wovAudxLBr6pxDvd3HkPQM9OFWC3CSzvHMrxy0PMwYZQPVwTWe+srRHSPQfLWLdnQmqeElZZEbEXR8= X-Received: by 2002:a25:3485:0:b0:b6b:d3f3:45af with SMTP id b127-20020a253485000000b00b6bd3f345afmr106728yba.1.1680174717283; Thu, 30 Mar 2023 04:11:57 -0700 (PDT) MIME-Version: 1.0 From: Felipe Contreras Date: Thu, 30 Mar 2023 05:11:46 -0600 Message-ID: Subject: Discrepancy in IFS handling (zsh is POSIX compliant) To: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 28995 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Hi, I was going to report a bug about a discrepancy in the handling of IFS, until I read what the POSIX standard says about it [1]. The example is this: IFS=, str='foo,bar,,roo,' printf '"%s"\n' $str In bash there's four fields, the last comma is ignored, in zsh there's five fields. In my system dash and ksh also output four fields, like bash. However, this is what POSIX says: 3.b. Each occurrence in the input of an IFS character that is not IFS white space, along with any adjacent IFS white space, shall delimit a field, as described previously. We ignore all the white space stuff (since we are not using white spaces), and thus: Each occurrence in the input of an IFS character shall delimit a field. In zsh each occurrence of a comma does delimit a field (4 commas, 5 fields), which to me is what POSIX says should happen. So in this particular case it seems zsh is complying with POSIX (even in zsh mode), and all other shells are not. So there's no bug (at least in zsh), I just wanted to let you know what I found, and see if you agreed with my interpretation. Cheers. [1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05 -- Felipe Contreras