From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp11.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms5.migadu.com with LMTPS
	id 0AEvIgYvoWNCJQAAbAwnHQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 20 Dec 2022 04:41:58 +0100
Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp11.migadu.com with LMTPS
	id QDY/IgYvoWPFBwAA9RJhRA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 20 Dec 2022 04:41:58 +0100
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id 418272B056
	for <larch@yhetil.org>; Tue, 20 Dec 2022 04:41:58 +0100 (CET)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces@gnu.org>)
	id 1p7TV8-0003Ec-D6; Mon, 19 Dec 2022 22:41:10 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <matt@excalamus.com>)
 id 1p7TV6-0003EN-2Y
 for emacs-orgmode@gnu.org; Mon, 19 Dec 2022 22:41:08 -0500
Received: from sender3-op-o19.zoho.com ([136.143.184.19])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <matt@excalamus.com>)
 id 1p7TV0-0004sa-PW
 for emacs-orgmode@gnu.org; Mon, 19 Dec 2022 22:41:07 -0500
ARC-Seal: i=1; a=rsa-sha256; t=1671507654; cv=none; 
 d=zohomail.com; s=zohoarc; 
 b=GYMwGZvU1UnWG5obdn7Rj7HLIfC56vsgY3hplOoQ/+RrDtc9pRbfoNzPLOTejo59Ux2VkZQ6S/OKjTMScxvOleKJtTO98yHSeFhtPysjhv2mpRuG+nsY9YzPK84LRXSqixIm/pvfCmbqH87Mqjnu9fD5RXHgSK4zq0aLGPMTWB4=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc; t=1671507654;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To;
 bh=DCau5ePYxNL7lyjH7p4JL2AvVU28QbuIlaWegLy0kR8=; 
 b=k5Ea91Xm6khu/fj5OCLgOIzLUfapd5KQ7KhVihZyxYHeNCkjJqAnN34lDNmkw54bFb7ZeTTwemx7uCu6ldSfp51a6AtRIbKCHEJNLIpYfqqL5GtvsTHlhIVZt4Yd/X+/UJMa/0mGyplydg8CY0vQ7bOV2I+sl1Z3U7Xtdsu++tc=
ARC-Authentication-Results: i=1; mx.zohomail.com;
 dkim=pass  header.i=excalamus.com;
 spf=pass  smtp.mailfrom=matt@excalamus.com;
 dmarc=pass header.from=<matt@excalamus.com>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1671507654; 
 s=zmail; d=excalamus.com; i=matt@excalamus.com;
 h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To;
 bh=DCau5ePYxNL7lyjH7p4JL2AvVU28QbuIlaWegLy0kR8=;
 b=UQUBUz1aQP9Sgxxfr6nXpHVPY7Fs6cWormD+/J0orLh+iopzfx6xpydM+LakaOmO
 aw9mfGWO4z9/4jAZhsCvb1WZ9JMF3lkwQklupDx4CeqRA5q+iRNrLeSgOP3vFrwfdRF
 bsPTPyTZOEGcjdi2XTSQs+9RmtkhsDr5s7EwPa7w=
Received: from mail.zoho.com by mx.zohomail.com
 with SMTP id 1671507653949993.9897685831615;
 Mon, 19 Dec 2022 19:40:53 -0800 (PST)
Date: Mon, 19 Dec 2022 22:40:53 -0500
From: Matt <matt@excalamus.com>
To: =?UTF-8?Q?=22Rudolf_Adamkovi=C4=8D=22?= <salutis@me.com>
Cc: "ihor radchenko" <yantar92@posteo.net>,
 "emacs-orgmode" <emacs-orgmode@gnu.org>
Message-ID: <1852d9eb52f.c4c534f9581400.7140516675874523594@excalamus.com>
In-Reply-To: <m2r0wu29b7.fsf@me.com>
References: <m2tu1v8gj8.fsf@me.com> <878rj7s0ti.fsf@localhost>
 <87pmch6js6.fsf@localhost> <m2r0wu29b7.fsf@me.com>
Subject: Re: Bash results broken?
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Importance: Medium
User-Agent: Zoho Mail
X-Mailer: Zoho Mail
Received-SPF: pass client-ip=136.143.184.19; envelope-from=matt@excalamus.com;
 helo=sender3-op-o19.zoho.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, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-orgmode@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
X-Migadu-Country: US
X-Migadu-Flow: FLOW_IN
ARC-Authentication-Results: i=2;
	aspmx1.migadu.com;
	dkim=pass header.d=excalamus.com header.s=zmail header.b=UQUBUz1a;
	spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org";
	dmarc=none;
	arc=pass ("zohomail.com:s=zohoarc:i=1")
ARC-Seal: i=2; s=key1; d=yhetil.org; t=1671507718; a=rsa-sha256; cv=pass;
	b=atWBwAm9i43vCzTSUCcQkOFepdmCrdYVFw6SQWyq4zDVQRS9yo6HcNuoTxc9sJDQmFJM9G
	tRYO5fXxHubDgFd0EoPV3CiLkV5+ZPvs2h5W48xxnCGx4X9UBplG3miY1u1HiD6IHOOFnk
	RXRi8nh6vgBIA72JmtKP/TU7dLS8IOVDiOQntEj1gse9vNDgxYdMxuVMJpLCsTAsaJE3Cs
	udWLLs80CrbkTMGFtI3cm+aqx66W6jZDz3FJynIdtBuShFzLg1/k4MrrTn6ctOjFdWmOVT
	UgEbny1Su1dlYhj5yiRV4lWABcrcrFZIYUHwnIV9Jw46wilns5TD8vBLJKXC6g==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1671507718;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-unsubscribe:list-subscribe:list-post:dkim-signature;
	bh=DCau5ePYxNL7lyjH7p4JL2AvVU28QbuIlaWegLy0kR8=;
	b=FGSpScMNthQxrrp/Gs8mcV1p1dNlzA6oJllk8CfDDABl3OrJN+eWE3/Az9YyF48aJQyk53
	DdZU2NIvYk6sNUnBf/2Gbc9naEocDxiRIVe/aSovEM0ZsbzlcAWKaRExxpcH5TJMNLJGtM
	hJUoMElH5FA1j7Py/mOzzEeWMtSYP8jAbW/MK4d+E4b9KjmrlRaGgfb+SZE6r1ZL6Mlx4w
	TJcQcDQJjpbZS4FrpFXXE1lzfm35po45j2Sw57a172iYhrx8nYHpTKcaw5WyVnn9x2m6sY
	bAmQtLpTtYueS0SlSuuMttYvFwwMhTmH5GQeaPgqQs7BHMFFLU0u2qnJLvA/dQ==
X-Migadu-Scanner: scn0.migadu.com
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=excalamus.com header.s=zmail header.b=UQUBUz1a;
	spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org";
	dmarc=none;
	arc=pass ("zohomail.com:s=zohoarc:i=1")
X-Migadu-Spam-Score: -5.28
X-Spam-Score: -5.28
X-Migadu-Queue-Id: 418272B056
X-TUID: jVDBLKtmuM37


 ---- On Mon, 19 Dec 2022 19:44:12 -0500  Rudolf Adamkovi=C4=8D  wrote ---=
=20
 > Ihor Radchenko yantar92@posteo.net> writes:
 >=20
 > > Fixed on bugfix.
 >=20
 > I can confirm that the fix works.  Thank you!

I can confirm it works, too, for the 1 2 3 example.  However, it puts doubl=
e quotes around text:

#+BEGIN_SRC sh :results list
echo hello
echo world
echo !
#+END_SRC

#+RESULTS:
- "hello"
- "world"
- "!"

I was working on other ob-shell related stuff and my Emacs got into a mixed=
 state where =3Dob-shell/results-list=3D was defined, but the fix wasn't (o=
r wasn't loaded).  I fixed the failing test before I saw this thread and Ih=
or's fix.  The way I solved it was to wrap either =3Dorg-babel-import-elisp=
-from-file=3D or =3Dorg-babel-sh-evaluate=3D like,

(mapcar #'car (org-babel-import-elisp-from-file tmp-file))

or=20

(mapcar #'car  (org-babel-sh-evaluate session full-body params stdin cmdlin=
e))

Doing this (without Ihor's fix in place) returns:

#+BEGIN_SRC sh :results list
echo "hello"
echo "world"
echo "!"
#+END_SRC

#+RESULTS:
- hello
- world
- !

The underlying issue, so far as I understand it, is that =3Dorg-babel-impor=
t-elisp-from-file=3D returns a list-of-lists.  For example, ((1) (2) (3)) o=
r (("hello") ("world") ("!")).  I thought it appropriate to flatten it out =
to (1 2 3) or ("hello" "world" "!").

Independently from how I addressed the bug, I feel it raises an important q=
uestion: how should :results list handle text/strings?=20

I'm not sure which approach is more "appropriate".   If I echo a string wit=
hout quotes, as I did in the first example, should it return a list that's =
got quotes?  The hello world example is a little contrived=E2=80=93it's goo=
d practice to use double-quotes.  I think a more realistic use case would b=
e listing a directory.  In that case, I'd probably want the list of items t=
o be unquoted:

Original:

#+BEGIN_SRC sh :results list
ls /home/ahab/.emacs.d/straight/repos/org/testing/lisp/ | head -n 3
#+END_SRC

#+RESULTS:
- ("test-ob-awk.el")
- ("test-ob-C.el")
- ("test-ob-clojure.el")

Ihor solution:

#+BEGIN_SRC sh :results list
ls /home/ahab/.emacs.d/straight/repos/org/testing/lisp/ | head -n 3
#+END_SRC

#+RESULTS:
- "test-ob-awk.el"
- "test-ob-C.el"
- "test-ob-clojure.el"

MAPCAR solution:

#+BEGIN_SRC sh :results list
ls /home/ahab/.emacs.d/straight/repos/org/testing/lisp/ | head -n 3
#+END_SRC

#+RESULTS:
- test-ob-awk.el
- test-ob-C.el
- test-ob-clojure.el

For :results list, the manual says, "Interpret the results as an Org list. =
 If the result is a single value, create a list of one element".  I don't f=
ind that clarifies what would be best.

Thoughts?