From: Jim Porter <jporterbugs@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>,
Aidan Gauland <aidalgol@no8wireless.co.nz>
Cc: 12689@debbugs.gnu.org
Subject: bug#12689: 24.2; Eshell ${cmd} substitution
Date: Wed, 9 Feb 2022 11:01:05 -0800 [thread overview]
Message-ID: <25243bc1-06d5-59d5-14f9-d13aad818227@gmail.com> (raw)
In-Reply-To: <87czjwo12i.fsf@gnus.org>
On 2/9/2022 1:12 AM, Lars Ingebrigtsen wrote:
> Aidan Gauland <aidalgol@no8wireless.co.nz> 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.
next prev parent reply other threads:[~2022-02-09 19:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-20 8:06 bug#12689: 24.2; Eshell ${cmd} substitution Aidan Gauland
2014-12-14 12:44 ` samer
2015-02-24 10:56 ` Samer Masterson
2015-03-03 15:54 ` Eli Zaretskii
2015-03-04 12:14 ` Samer Masterson
2015-03-04 17:38 ` Eli Zaretskii
2015-03-05 10:34 ` Samer Masterson
2015-04-06 3:41 ` Samer Masterson
2015-04-06 4:19 ` John Wiegley
2015-04-06 4:54 ` Samer Masterson
2022-02-09 9:12 ` Lars Ingebrigtsen
2022-02-09 19:01 ` Jim Porter [this message]
2022-02-09 20:12 ` Lars Ingebrigtsen
2022-05-03 3:52 ` Jim Porter
2022-05-03 10:37 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25243bc1-06d5-59d5-14f9-d13aad818227@gmail.com \
--to=jporterbugs@gmail.com \
--cc=12689@debbugs.gnu.org \
--cc=aidalgol@no8wireless.co.nz \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.