From unknown Wed Jun 18 23:03:45 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#55838 <55838@debbugs.gnu.org> To: bug#55838 <55838@debbugs.gnu.org> Subject: Status: 29.0.50; Eshell string-split subscript indexing splits too much Reply-To: bug#55838 <55838@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:03:45 +0000 retitle 55838 29.0.50; Eshell string-split subscript indexing splits too mu= ch reassign 55838 emacs submitter 55838 Jim Porter severity 55838 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 07 21:36:21 2022 Received: (at submit) by debbugs.gnu.org; 8 Jun 2022 01:36:21 +0000 Received: from localhost ([127.0.0.1]:41977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nykcP-0003i5-5C for submit@debbugs.gnu.org; Tue, 07 Jun 2022 21:36:21 -0400 Received: from lists.gnu.org ([209.51.188.17]:41150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nykcK-0003ht-38 for submit@debbugs.gnu.org; Tue, 07 Jun 2022 21:36:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nykcJ-0001ar-Rr for bug-gnu-emacs@gnu.org; Tue, 07 Jun 2022 21:36:15 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:56083) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nykcF-0002Z1-99 for bug-gnu-emacs@gnu.org; Tue, 07 Jun 2022 21:36:15 -0400 Received: by mail-pj1-x1034.google.com with SMTP id e9so6703583pju.5 for ; Tue, 07 Jun 2022 18:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:subject:to:message-id:date:mime-version:content-language :content-transfer-encoding; bh=bnCJzBZNhTk6vDjOQjcZeg/Z6UqF9cJ0xp29YQab/eQ=; b=m/EIaeafSBEss68JwppgTANNB13iGSemRIbyw5sm0nlQzmsgSz17tOjItSEemvOQ6b d6VgqMrchppXpzqTWK7zlaHFT7xU8tRtylVDIBFbyexYMp+/oQzFJF7ROKCZukMqTGZa jHWWInoaOABLM6LsHgpsLEGnb446fQcj7d5QBpaFENhcwHuCO9vUxIhp9kLao0gLoQny UgWRTNxg/2KUHGBunbddBqRvbV+FZo4CSBCREaE67QZthaBuEHNaCahyFfGfsdxhG6MP N5XNeIjwRsWYkojvC3MgQGQcxBGAo5mb+dMTdYqOxSanRCSUDszr+074FKrGyY8cFDju Jasw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:subject:to:message-id:date:mime-version :content-language:content-transfer-encoding; bh=bnCJzBZNhTk6vDjOQjcZeg/Z6UqF9cJ0xp29YQab/eQ=; b=LemdI4MkzR0pxfzGkYN8eKlSSFfK4N8izINYLZ8Vzq8YCBg7dYVtrZi15nk3KP28+M BTCY646rvhqTXFcRQ3n5awTb3Sf5f4HBPvbab9SIC4PPU+ccfwpcbyVa5A5xBsAivatO XCvXHyDUXd9xg+NYYGmLvEc8JzKDLR2bFs/yEJ6LG/d+jngW7O1M70K396WlJuNX1cCN 9QkCIQk6HtM6cMKbgO33nOuM5C6T9Y659ULbGLKXxe9hKJrd5cDvF3dKGP/X0iiaEMHs B5m9Dfa8o2tGSKzYf7v4QXqPz+crf+992adIK41PHFVPttYL5pZeKM/7XhiWm+y9G1gA mC+Q== X-Gm-Message-State: AOAM530MKsIcLRPHu/nEO3s28v9GmJvBzuZnyQk6QLBfKr6oitmDwNJZ US1JU5vIQA0EiABYnsFviBmvp4U5kc8= X-Google-Smtp-Source: ABdhPJwbrn+kmEzJo1X8QDPsJ65CcIsEWsoy5tuo5C3Pr/L0o3WETBEpBX8sGpZ4BWuEzd+Ecd5Y3A== X-Received: by 2002:a17:90b:1e4f:b0:1e8:4e3c:e212 with SMTP id pi15-20020a17090b1e4f00b001e84e3ce212mr23420231pjb.25.1654652169991; Tue, 07 Jun 2022 18:36:09 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id x140-20020a633192000000b003f84815f6bdsm13763889pgx.82.2022.06.07.18.36.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jun 2022 18:36:09 -0700 (PDT) X-Mozilla-News-Host: news://news.gmane.org:119 From: Jim Porter Subject: 29.0.50; Eshell string-split subscript indexing splits too much To: bug-gnu-emacs@gnu.org Message-ID: Date: Tue, 7 Jun 2022 18:36:09 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=jporterbugs@gmail.com; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) From "emacs -Q -f eshell": M-: (setq foo "a\nb:c") ~ $ echo $foo a b:c ~ $ echo $foo[: 0] ("a" "b") The first command is normal, and just shows that Eshell outputs the string with no manipulation. In the second command, we split the string on ":" and get the 0th element. However, that gets split *again* (on newlines) and returns a list. I think this is overly aggressive. It's due to `eshell-apply-indices' calling `eshell-convert' on the split element(s) of the string. However, `eshell-convert' is primarily designed to turn output from external command line programs into a Lispy form (so it splits by line to make a list, among other things). This would normally happen when doing something like this: ~ $ echo ${cat some-file.txt} ("line 1" "line 2" ...) In the original case above, I think the split-subscript operator [: 0] should only be doing the one thing the user requested: split on ":" and get the 0th element. Patch forthcoming momentarily. Just getting a bug number. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 07 21:41:40 2022 Received: (at 55838) by debbugs.gnu.org; 8 Jun 2022 01:41:40 +0000 Received: from localhost ([127.0.0.1]:41983 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nykhX-0003pn-PY for submit@debbugs.gnu.org; Tue, 07 Jun 2022 21:41:40 -0400 Received: from mail-pl1-f171.google.com ([209.85.214.171]:33733) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nykhV-0003pa-O7 for 55838@debbugs.gnu.org; Tue, 07 Jun 2022 21:41:38 -0400 Received: by mail-pl1-f171.google.com with SMTP id f9so5884345plg.0 for <55838@debbugs.gnu.org>; Tue, 07 Jun 2022 18:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:from:to:references:message-id:date:mime-version:in-reply-to :content-language; bh=CTUlS3JvK8KuP/XSxyUxQEnEVc/lAj46Dhx8FJoG4A8=; b=liZaL27FttsZeMHnPqgNnq0AtEfauki8vVnGk3eWgJ5UOn/7Y6IhEdeH7EZ2rcMFe0 K6QhxSY1OpmSjq27bymlCrto1E9rpV+Ug7KKY7BczpZVpbs5Zd1lBAghizMiAknkaqk5 yEKX6sMfCWWbWZSsWtza63Cvz6MwxgoVf3wnLQG0FzkdRgO8Kssf0g4W5HgLn7lD2Z1q G2ixFoObLxdmk4kI6LHdYy94ZR8/OtmkbF4m0BJ7fhzlQXdtXx4sYaf/jJTcCUdOf7+m N6LqNdein9qtnXugqS/16KUpq/DvO8icmVAKm06DSrdtP53rtVfqfiViCupFTJl0Mmdq eQYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:references:message-id:date :mime-version:in-reply-to:content-language; bh=CTUlS3JvK8KuP/XSxyUxQEnEVc/lAj46Dhx8FJoG4A8=; b=Deo5CX7p3X5ENcZSuuGxQ+DMKf9xW+U7XDX+YwxNXZFdGK/8fbSx8JnjHNTELCPspz BaE5mTFKKXKpQSe/thxkjygxRSv30nRVwHsaM8ocfMyxLw6Jss/G7tKuT7QHxkkINXTM rr3Vd/0GlneVFqnqUsv0CvFLvOS+PWwEcnsfoPX4lgsIyGPaf1eDfs0OeA6gDtFdeEaf YdCQCBEKXd5MHNgW2uj32ziS+bcrV0Mliva4WkpbAiT2vi+yc2p6icruXuuFKzDEoH6S qnJmSjDQdQi8HiYY7h+ah+f4BQ6oGGtpDqLVMCkhcYJarMCJpwTsON+N1c2wQacPohqD ui/A== X-Gm-Message-State: AOAM533QDocqMu+GKEpI+LzXtqKGjMLiHh5RgU9ZgoDLTNVuwPB7dXVq 0Zr0VSUkpK5zf3wsmG74ihYM/PcfrY8= X-Google-Smtp-Source: ABdhPJzHeA3qVrmikdT+YXNo1kRQhsuLgeLZCwbZ3qX4JTIAaXRD+a0jR106qJAJXhgv9Zxb/2qo6g== X-Received: by 2002:a17:903:2451:b0:167:8179:62a8 with SMTP id l17-20020a170903245100b00167817962a8mr11911852pls.148.1654652491646; Tue, 07 Jun 2022 18:41:31 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id u7-20020a056a00158700b00519cfca8e30sm7621946pfk.209.2022.06.07.18.41.30 for <55838@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jun 2022 18:41:31 -0700 (PDT) Subject: Re: bug#55838: 29.0.50; [PATCH] Eshell string-split subscript indexing splits too much From: Jim Porter To: 55838@debbugs.gnu.org References: Message-ID: Date: Tue, 7 Jun 2022 18:41:30 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------DB94E34519052C654D36BE2F" Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55838 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------DB94E34519052C654D36BE2F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 6/7/2022 6:36 PM, Jim Porter wrote: > From "emacs -Q -f eshell": > >   M-: (setq foo "a\nb:c") > >   ~ $ echo $foo >   a >   b:c >   ~ $ echo $foo[: 0] >   ("a" "b") > > The first command is normal, and just shows that Eshell outputs the > string with no manipulation. In the second command, we split the string > on ":" and get the 0th element. However, that gets split *again* (on > newlines) and returns a list. Here's a patch for this. It changes the behavior of `eshell-apply-indices' to use `eshell-convert-to-number' (when the expansion isn't wrapped in double-quotes) instead of the more-aggressive `eshell-convert'. I think `eshell-convert-to-number' is the right thing here, since Eshell already converts number-like strings to actual numbers in most cases. As a note, if you wanted the old behavior, you could do something like this: ~ $ echo $foo[: 0][0 1] ("a" "b") There's also a suggestion in the "Bugs and ideas" section of the Eshell manual to add "*" as a subscript to mean "all indices", so you could do the above in a more generic fashion like: ~ $ echo $foo[: 0][*] ;; Doesn't currently work, but it could. --------------DB94E34519052C654D36BE2F Content-Type: text/plain; charset=UTF-8; name="0001-Don-t-split-Eshell-expansions-by-line-when-using-spl.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-Don-t-split-Eshell-expansions-by-line-when-using-spl.pa"; filename*1="tch" RnJvbSAyMWNkYTExMTRkNjI2OWI0Nzk2M2M4ODM1ZWUyM2E1YmQzMWRjYjM5IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IE1vbiwgNiBKdW4gMjAyMiAxOTo1MzozOSAtMDcwMApTdWJqZWN0OiBbUEFU Q0hdIERvbid0IHNwbGl0IEVzaGVsbCBleHBhbnNpb25zIGJ5IGxpbmUgd2hlbiB1c2luZwog c3BsaXQtc3Vic2NyaXB0IG9wZXJhdG9yCgoqIGxpc3AvZXNoZWxsL2VzaC12YXIuZWwgKGVz aGVsbC1hcHBseS1pbmRpY2VzKTogVXNlCidlc2hlbGwtY29udmVydC10by1udW1iZXInIGlu c3RlYWQgb2YgJ2VzaGVsbC1jb252ZXJ0Jy4KCiogdGVzdC9saXNwL2VzaGVsbC9lc2gtdmFy LXRlc3RzLmVsCihlc2gtdmFyLXRlc3QvaW50ZXJwLWNvbnZlcnQtdmFyLXNwbGl0LWluZGlj ZXMpOiBFeHBhbmQgdGVzdAooYnVnIzU1ODM4KS4KLS0tCiBsaXNwL2VzaGVsbC9lc2gtdmFy LmVsICAgICAgICAgICAgfCAxNSArKysrKysrKy0tLS0tLS0KIHRlc3QvbGlzcC9lc2hlbGwv ZXNoLXZhci10ZXN0cy5lbCB8ICA5ICsrKysrKysrLQogMiBmaWxlcyBjaGFuZ2VkLCAxNiBp bnNlcnRpb25zKCspLCA4IGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2xpc3AvZXNoZWxs L2VzaC12YXIuZWwgYi9saXNwL2VzaGVsbC9lc2gtdmFyLm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10ZXN0L2ludGVy cC1jb252ZXJ0LXF1b3RlZC12YXItbnVtYmVyICgpCiAgICJJbnRlcnBvbGF0ZSBudW1lcmlj IHF1b3RlZCBudW1lcmljIHZhcmlhYmxlIgotLSAKMi4yNS4xCgo= --------------DB94E34519052C654D36BE2F-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 08:11:43 2022 Received: (at 55838) by debbugs.gnu.org; 8 Jun 2022 12:11:43 +0000 Received: from localhost ([127.0.0.1]:42686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyuXH-0003i6-8Q for submit@debbugs.gnu.org; Wed, 08 Jun 2022 08:11:43 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyuXF-0003hs-VL for 55838@debbugs.gnu.org; Wed, 08 Jun 2022 08:11:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nlXqdOwh+5mgv86p+Mug3AgDjq39Vn+4kEpUndGqees=; b=RkUxciQjthChaGNmENSJpsbF3e tVmz885gJ+riLwW0Mz2yD3YVFSSqdGafpf8cZjC64X8jRqePltOHq8XdQpt+LgXU9d5rRZ/RuApDS FuJfHrem1qlju8BNqxw6kRSwbjWSy6IVXzrQK+i9n0gK+T0JrYzsbWZpjZxDRVZCd9rg=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyuX7-0006Oy-Pt; Wed, 08 Jun 2022 14:11:36 +0200 From: Lars Ingebrigtsen To: Jim Porter Subject: Re: bug#55838: 29.0.50; Eshell string-split subscript indexing splits too much References: Date: Wed, 08 Jun 2022 14:11:33 +0200 In-Reply-To: (Jim Porter's message of "Tue, 7 Jun 2022 18:41:30 -0700") Message-ID: <87o7z39wy2.fsf_-_@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Jim Porter writes: > Here's a patch for this. It changes the behavior of > `eshell-apply-indices' to use `eshell-convert-to-number' (when the > expansion isn't wrapped in double-quotes) instead of the > more-aggressive [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 55838 Cc: 55838@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Jim Porter writes: > Here's a patch for this. It changes the behavior of > `eshell-apply-indices' to use `eshell-convert-to-number' (when the > expansion isn't wrapped in double-quotes) instead of the > more-aggressive `eshell-convert'. I think `eshell-convert-to-number' > is the right thing here, since Eshell already converts number-like > strings to actual numbers in most cases. Sounds good to me; pushed to Emacs 29. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 08:11:47 2022 Received: (at control) by debbugs.gnu.org; 8 Jun 2022 12:11:47 +0000 Received: from localhost ([127.0.0.1]:42689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyuXL-0003iN-GQ for submit@debbugs.gnu.org; Wed, 08 Jun 2022 08:11:47 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyuXK-0003hy-Bp for control@debbugs.gnu.org; Wed, 08 Jun 2022 08:11:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=mzYp+os/XaU91fRZ410a8Lxtbg7TtfvXYU7i2bo+uTA=; b=BpnNRYd20T9B9JYyaDZiCz191S 3qdyrHNwrDSTBx6ooqHowKvK3IYno1V6OFbQ5PMwiXH5wBrF6UocGPcv6qzPvAjsZ33hJDvhFvLnK G0IYM5uF9ewNU+9eeUvwmZhr+tdUPDn0+2ZLO6qq6OAHYIg2dsw2//adBQ9lHBOPwvxA=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyuXC-0006PE-JM for control@debbugs.gnu.org; Wed, 08 Jun 2022 14:11:40 +0200 Date: Wed, 08 Jun 2022 14:11:38 +0200 Message-Id: <87mten9wxx.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #55838 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 55838 29.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 55838 29.1 quit From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 09:39:15 2022 Received: (at 55838) by debbugs.gnu.org; 8 Jun 2022 13:39:15 +0000 Received: from localhost ([127.0.0.1]:42785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyvty-0001jE-QO for submit@debbugs.gnu.org; Wed, 08 Jun 2022 09:39:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyvtw-0001iz-JT for 55838@debbugs.gnu.org; Wed, 08 Jun 2022 09:39:12 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33030) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyvtq-0001cb-RO; Wed, 08 Jun 2022 09:39:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zSDxVOLpOAnEt1Ystcf9vehYiS92iIAlF9SfL3SKoYg=; b=b54XKFfUSX5j 5SHuKhFdwGNF86gDEUIaChC9MngyOy5Eo7gSyuWR9ErsnTM0a2+7wHGNNQv5h+uxX3mfFKibu+eYO DZQ7C79XnbNW+ygYHh3dFnsZayxc4vD6ZDF6EShO9OQHgbtuznd6J2RMeGI17bJb3OpHvwlw3X2RL WsQjUNob/szMCGb4lknvFzowSq9Q92eS4x6ia6Jge2pXlT94w4ltQLtlxQSd3isnsLk9MMHj2/tdy YWHqJ+0CRwDMN+r68BF+rzFD0kCNN2tgzMHyF8azkTykLfnhIRhxK6Q1jRMIurOD9tmAYVb3tYu5Z 61vmS/UL5CHLPClU31SYrQ==; Received: from [87.69.77.57] (port=2108 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyvtq-0005rI-4B; Wed, 08 Jun 2022 09:39:06 -0400 Date: Wed, 08 Jun 2022 16:38:59 +0300 Message-Id: <83edzz5l70.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: (message from Jim Porter on Tue, 7 Jun 2022 18:41:30 -0700) Subject: Re: bug#55838: 29.0.50; [PATCH] Eshell string-split subscript indexing splits too much References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 55838 Cc: 55838@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Jim Porter > Date: Tue, 7 Jun 2022 18:41:30 -0700 > > > The first command is normal, and just shows that Eshell outputs the > > string with no manipulation. In the second command, we split the string > > on ":" and get the 0th element. However, that gets split *again* (on > > newlines) and returns a list. > > Here's a patch for this. It changes the behavior of > `eshell-apply-indices' to use `eshell-convert-to-number' (when the > expansion isn't wrapped in double-quotes) instead of the more-aggressive > `eshell-convert'. I think `eshell-convert-to-number' is the right thing > here, since Eshell already converts number-like strings to actual > numbers in most cases. > > As a note, if you wanted the old behavior, you could do something like this: > > ~ $ echo $foo[: 0][0 1] > ("a" "b") > > There's also a suggestion in the "Bugs and ideas" section of the Eshell > manual to add "*" as a subscript to mean "all indices", so you could do > the above in a more generic fashion like: > > ~ $ echo $foo[: 0][*] > ;; Doesn't currently work, but it could. I don't have any objections based on actual experience, and I don't know what was the original design goals of this feature in Eshell. However, please note that you are changing the behavior significantly, and the only reason is that it doesn't make much sense to you. I wonder whether this is a strong enough motivation to make such incompatible behavior changes. Eshell is not a "normal" shell, in that it attempts to make sense even if Lisp expressions are mixed with Posix-ish shell features, so what may not make sense in Bash, Zsh, and their ilk is not necessarily nonsensical in Eshell. So maybe we should raise the bar for considering reasons for behavior changes as valid? From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 19:06:58 2022 Received: (at 55838) by debbugs.gnu.org; 8 Jun 2022 23:06:58 +0000 Received: from localhost ([127.0.0.1]:44535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nz4lN-0004Tv-TM for submit@debbugs.gnu.org; Wed, 08 Jun 2022 19:06:58 -0400 Received: from mail-pj1-f41.google.com ([209.85.216.41]:42931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nz4lJ-0004TZ-4p for 55838@debbugs.gnu.org; Wed, 08 Jun 2022 19:06:57 -0400 Received: by mail-pj1-f41.google.com with SMTP id d12-20020a17090abf8c00b001e2eb431ce4so19647129pjs.1 for <55838@debbugs.gnu.org>; Wed, 08 Jun 2022 16:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=J0PU6BhjLKsVfk/fgbme+LV+IlMNFGOfJq07QBfnSJs=; b=OObQ4qhSnZ0cY4Twu8RaaCeNbWYuamMs5oxUOi2pCwPdL0tiAEhu2/HA4FGUrcfV/6 yu2ag5DBVl1uH1IYDpYAhWVbEP4AF4vq5rlbYrRpk/3/VLE/W7PbCQRTUekmnZncFvib AR5AanDgCCIOll4HD7Ax05uwQvztNMlQnjbMbJujgMUZk+xvdiccS532LWVl8fWVV/LM X4Ro/HOSvBhRKLfxTYEQj2IA2DezLW9TT7wGIJHrqcqkhp3BwS1rRTlBL719uDALNM1H ubRQrMXSh2ExJ3mPz7D2mCztOFQewhMECsKfbOJdC6NbhOATO+aHYz1Iw3cPjs2UN8qd +44Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=J0PU6BhjLKsVfk/fgbme+LV+IlMNFGOfJq07QBfnSJs=; b=dhTi81wqrljpfwustkJW3LPPbKneYYDJyGYbVUdSgZ9pZFUAZCLVlI9RdF5Z11Uhj+ wRnzESJ9p2FIfrohNQq2RfqFOoAMUAKR3K7jerxhuatTkKvaqLpyhrAu5u+PrhCkR5MK 76tqj9MaM+Z6s2e15JsCq64mY45vz0djSFnnan9MySGG7syVYRQ7DaSUMhlz2UST/U27 fZRjwr7Oh876SD3sH/fp/G3sQrzQ7r+OD6cgIguYfXF4W49jKI9iiL2p5yOBjpgV5fVs Wo9/64lqy1LuiXsmsF0LUjIO6g/roEywB+VvQMtTy7V2Ayso4A5Zg2/HPLd/8cTngF6v kfrw== X-Gm-Message-State: AOAM530X+aaf8NeZT+Ne2Uwbs0rsbrdArzgydQXQi1XvCrNPrlKW2R8q DPt1PZ8eeQg/N8kY1bs5PlweMwpuBwE= X-Google-Smtp-Source: ABdhPJx5mAmo93TmrJHi1L9vON2vONXAwZ27kfDAluNMTXwJbUNwu+HMWCklt17rrcgyQzWYL7F+/w== X-Received: by 2002:a17:902:c2c3:b0:168:9498:a0f6 with SMTP id c3-20020a170902c2c300b001689498a0f6mr5659009pla.0.1654729606164; Wed, 08 Jun 2022 16:06:46 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id d62-20020a623641000000b0051baaa40028sm16000945pfa.11.2022.06.08.16.06.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jun 2022 16:06:45 -0700 (PDT) Subject: Re: bug#55838: 29.0.50; [PATCH] Eshell string-split subscript indexing splits too much To: Eli Zaretskii References: <83edzz5l70.fsf@gnu.org> From: Jim Porter Message-ID: Date: Wed, 8 Jun 2022 16:06:45 -0700 MIME-Version: 1.0 In-Reply-To: <83edzz5l70.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55838 Cc: 55838@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 6/8/2022 6:38 AM, Eli Zaretskii wrote: > I don't have any objections based on actual experience, and I don't > know what was the original design goals of this feature in Eshell. > However, please note that you are changing the behavior significantly, > and the only reason is that it doesn't make much sense to you. I probably should have elaborated a bit more on my reasoning in the original report. My goal with this (and other Eshell patches in this area) is mainly to add tests for some of the more-advanced Eshell syntax and also to ensure that it works as documented. There are a few cases where it's tricky to decide whether the code is right and the documentation is wrong, or vice-versa. This is one of those cases. Here's what the Emacs 27/28 manuals have to say about this syntax (I've already changed/expanded this section in 29, so I'm going back to 28 to show what the docs said before I changed them): $var[i] Expands to the ith element of the value bound to var. If the value is a string, it will be split at whitespace to make it a list. Again, raises an error if the value is not a sequence. $var[: i] As above, but now splitting occurs at the colon character. $var[: i j] As above, but instead of returning just a string, it now returns a list of two strings. If the result is being interpolated into a larger string, this list will be flattened into one big string, with each element separated by a space. I would interpret the above to mean that the only splitting that should happen for `$var[: i]' is with the ":". The last section says that `$var[: i]' returns "just a string", and `$var[: i j]' returns a list of two strings. However, in my example in the original message, `$foo[: 0 1]' would return a list containing a list and a string. That's inconsistent with what the manual says, and in this case I think it's the manual that was right, and the code that wasn't. Note: the last sentence in the manual excerpt above is also incorrect. When the list is "flattened into one big string", it will look like '("first" "second")', not 'first second'. Unlike the original bug here, which people probably don't encounter very often in practice, changing how the list is flattened would probably cause problems for users. It's a really common occurrence. Something as simple as `echo a b' will return '("a" "b")'. This problem is also discussed in bug#12689. From unknown Wed Jun 18 23:03:45 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 07 Jul 2022 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator