From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#12689: 24.2; Eshell ${cmd} substitution Date: Wed, 9 Feb 2022 11:01:05 -0800 Message-ID: <25243bc1-06d5-59d5-14f9-d13aad818227@gmail.com> References: <87wqyl1sa6.fsf@dimension8.tehua.net> <87czjwo12i.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24921"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 12689@debbugs.gnu.org To: Lars Ingebrigtsen , Aidan Gauland Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 09 20:33:37 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nHsif-0006Ec-4r for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Feb 2022 20:33:37 +0100 Original-Received: from localhost ([::1]:39398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHsie-0000vw-1i for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Feb 2022 14:33:36 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHsEA-00041O-Vl for bug-gnu-emacs@gnu.org; Wed, 09 Feb 2022 14:02:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58734) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHsE7-0003Y3-QL for bug-gnu-emacs@gnu.org; Wed, 09 Feb 2022 14:02:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nHsE6-0004id-Ji for bug-gnu-emacs@gnu.org; Wed, 09 Feb 2022 14:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Feb 2022 19:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12689 X-GNU-PR-Package: emacs Original-Received: via spool by 12689-submit@debbugs.gnu.org id=B12689.164443327518077 (code B ref 12689); Wed, 09 Feb 2022 19:02:02 +0000 Original-Received: (at 12689) by debbugs.gnu.org; 9 Feb 2022 19:01:15 +0000 Original-Received: from localhost ([127.0.0.1]:52631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHsDK-0004hV-Vy for submit@debbugs.gnu.org; Wed, 09 Feb 2022 14:01:15 -0500 Original-Received: from mail-pf1-f173.google.com ([209.85.210.173]:36799) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHsDJ-0004hE-4t for 12689@debbugs.gnu.org; Wed, 09 Feb 2022 14:01:13 -0500 Original-Received: by mail-pf1-f173.google.com with SMTP id u16so206036pfg.3 for <12689@debbugs.gnu.org>; Wed, 09 Feb 2022 11:01:13 -0800 (PST) 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=T9G+f4N8kXJEJL7lQLsw5GZoCKQQToYFYPN9yt4fKEc=; b=Vxg/w4b6b97KmuoylHuwohgNlTUzbJT98xuOZx+4ssSGrGUYilD9jVaAv1Hz+ajBJx tsrQ6oohW5lmE5G9txDJ5YSz9mJfaftvSSrzaqjaw/+HyoTdiY0uf8dU9jDTqLbJi9aL IRjhy6DteebBd0MR1F531XXktGUgkuiX1S6mMbFFrhfjMHVU3inpTUjLnuNhDmTid86S C9yHw/VhqYIh2cEZc42046rxKhTy9/gGeLQN2KpeZZcp0Ns6wJKQSBU2rB/kK1zsJ7PG 88uDWjWu5IBSabIuiCAoL16D6Nw43uSXaGcEGa3TNpcHrgiQPJoTxdMg1y/Btf/xw0W0 VKCQ== 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=T9G+f4N8kXJEJL7lQLsw5GZoCKQQToYFYPN9yt4fKEc=; b=thF5qGzLwF5WyVk61nYLW5LOfe6nKPKNarYPTXwVExeQjikjZ/dS55jzMaIOaoUPxo SCHO5R0PLUcWTubzbibSFOb4H4Hx4FYDzWrUZgCVdYzDkeIWjyu287+Aqs6TiUA6Ep55 +EY7pV4zV3/5cY42FFjAhhtNb6fZpWXwmca39LY+rq8QoNYHuJ1rMR3YJJ1mfw6LxtHZ iLXPz2BGjV72W/U1oGJ61GMofVUB+Dej6+eonMdOQWps+Tcn4vZ7F41gWenMXlmz+ypw bb+TtQLBdheQ5ANHl46npTITQ6jMKqpuohZsl1+PAoG9L92Nr6sOVGWuggDQW8qj92aF Yh8Q== X-Gm-Message-State: AOAM532MYUtV/K/K3tXwIquXJQJGZaGp0Y9b5VuN2L2tQODRYBhXr2pn +ULZb8qoXNVTp+ftiW14r+4XBzZ60NwHuw== X-Google-Smtp-Source: ABdhPJzs5zRNYJGuRdP7CaD63tWWiqkjLrIc/tNNbZaaNqMZNyp5m9LumGLkcw1oemDrIRIshjGsdg== X-Received: by 2002:a63:6c01:: with SMTP id h1mr3050775pgc.118.1644433266943; Wed, 09 Feb 2022 11:01:06 -0800 (PST) Original-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 k12sm21449597pfc.107.2022.02.09.11.01.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Feb 2022 11:01:06 -0800 (PST) In-Reply-To: <87czjwo12i.fsf@gnus.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:226502 Archived-At: On 2/9/2022 1:12 AM, Lars Ingebrigtsen wrote: > Aidan Gauland writes: > >> In Eshell, ${cmd} expands to nil. >> e.g. >> $ echo ${/bin/echo -e "foo\nbar"} >> $ >> Note the absence of any output from `echo'. >> >> $ echo ${/bin/echo -e "foo\nbar"}-foo >> nil-foo >> n$ > > (I'm going through old bug reports that unfortunately weren't resolved > at the time.) > > Looks like this has been fixed in the decade since it was reported: > > / $ echo ${/bin/echo -e "foo\nbar"} > ("foo" "bar") > / $ echo ${/bin/echo -e "foo\nbar"}-foo > ("foo" "bar")-foo > > So I'm therefore closing this bug report. If there's more to be done > here, please respond to the debbugs address and we'll reopen. I think the fix is from bug#30725. I'd meant to post an update to this bug as well, but I haven't had a chance to investigate the other half of this bug yet. Specifically, I think there's at least an argument that the result *should* look like this: / $ echo ${/bin/echo -e "foo\nbar"} foo bar / $ echo ${/bin/echo -e "foo\nbar"}-foo foo bar-foo I'm still not 100% sure what's going on here, but I think the ${} subcommand evaluation splits the output on "\n" to make a list (which seems reasonable to me). However, when it gets converted back to a string (either to print directly, as in the first case, or to concatenate, as in the second case), it ends up looking like '("foo" "bar")'. You can see a little more clearly how these cases are different by calling `message' instead of `echo': ~ $ message %S ${*echo -e "foo\nbar"} ("foo" "bar") ~ $ message %S ${*echo -e "foo\nbar"}-foo "(\"foo\" \"bar\")-foo" So the result of "${...}" is a list, and the result of "${...}-foo" is a string. I think it would make sense to do something to improve how "foo\nbar" gets round-tripped here so that the result is more consistent with regular shells. I have a couple of ideas, but I'll need a bit of time to tinker with things to see how they work, and to find a solution that keeps incompatible changes to a minimum.