emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: Greg Minshall <minshall@umich.edu>
Cc: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Change: no longer automatically evaluate embedded elisp in code block output Was: babel awk with table input: Code block produced no output.
Date: Mon, 06 Aug 2012 09:37:22 -0600	[thread overview]
Message-ID: <873940xc99.fsf@gmx.com> (raw)
In-Reply-To: <72741.1344211064@gregair> (Greg Minshall's message of "Sun, 05 Aug 2012 16:57:44 -0700")

> so, the first question is, are the semantics of parsing results such
> that random e-lisp-looking code should be executed?  (this seems
> dangerous, but may nevertheless be the intended semantics.)  if one did
> *not* want that behavior, one can call org-babel-read with the
> inhibit-lisp-eval parameter 't, which causes it to *not* try to execute
> any embedded lisp-looking code [2].
>

The reading of values that "look like lisp" as lisp is intended behavior
of the `org-babel-read' function at large (e.g., this is how we are able
to pass in the current file name through a header argument), however I
agree that this should probably not be the default behavior when reading
results from a code block.  It is much more likely that a person will
intentionally embed elisp in a header argument, but much less likely
that someone would intentionally write an awk script which returns elisp
(and if that is their goal they can simple pass the awk output to an
emacs-lisp code block).

For this reason I've just pushed up a change which does as you suggest
and inhibits lisp evaluation in the `org-babel-import-elisp-from-file'
function which is only used to import emacs-lisp results from code
blocks.

If anyone is relying on the current behavior please complain about this
change and we can look at other options.

>
> the error that eval throws is caught by
> org-babel-import-elisp-from-file, which then just silently returns a
> nil.  the second question is, should it report an error to the user?
>

This will now report the error with a message, but will still return nil
for the table cell's value.

Thanks,

>
> cheers, Greg Minshall
>
> ----
>
>> hi.  it appears that a left or right paren in an entry in a table makes
>> awk not execute.  here's an example (change ":stdin fails" to ":stdin
>> works" to see it work).  cheers, Greg
>> ----
>> #+tblname: fails
>> | proto          | no c code                   |            |
>> | pscl           | c code, just fine           |            |
>> | quadprog       | (minimal) c code, just fine |            |
>> 
>> #+tblname: works
>> | proto          | no c code                   |            |
>> | pscl           | c code, just fine           |            |
>> | quadprog       | minimal c code, just fine   |            |
>> 
>> #+begin_src awk :stdin fails
>>   BEGIN {
>>       print "starting"
>>   }
>>   {
>>       print $0
>>   }
>> #+end_src
> ----
>
> [1] in spite of its documentation, i'm not sure what
> org-babel-string-read does.  i thought it was removing quotation marks
> from strings (but wasn't sure why).  but, running this in *scratch*
> gives:
> ----
> (org-babel-string-read "this is \"a\" test")
> "a"
> ----
> rather than "this is a test", as i had assumed.  maybe that was a bogus
> test?
>
> [2] changing org-babel-string-read to call org-babel-read with
> inhibit-lisp-eval 't causes *my code* to work.  my code *also* works if
> i say ":results output" or ":results scalar"; i will defensively use one
> of these for my code.
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

  parent reply	other threads:[~2012-08-06 16:24 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30  2:26 are super-hidden technical blocks required? Torsten Wagner
2012-07-30  7:26 ` Bastien
2012-07-30 10:27   ` Rasmus
2012-07-30 14:27     ` Russell Adams
     [not found]   ` <CAPaq-gMV-+n6OAN4PnBsh1eiJ5wA=Ns_m_qwHqz1pxbOxeYCCQ@mail.gmail.com>
2012-07-31  2:04     ` Fwd: " Torsten Wagner
2012-07-30 14:42 ` Ivy Foster
2012-07-30 15:23   ` Jonathan Leech-Pepin
2012-07-31 13:23     ` Robert Horn
2012-07-31 13:47       ` Torsten Wagner
2012-08-04 18:10       ` Ilya Shlyakhter
2012-08-05  9:16         ` Bastien
2012-08-05 20:04           ` Ilya Shlyakhter
2012-08-05 22:20             ` Nicolas Goaziou
2012-08-05 22:50               ` Ilya Shlyakhter
2012-08-06  2:46                 ` Torsten Wagner
2012-08-06  3:01                   ` Ilya Shlyakhter
2012-08-06 12:12                     ` Jonathan Leech-Pepin
2012-08-06 17:25                       ` Ilya Shlyakhter
2012-08-06 18:16         ` Allen S. Rout
2012-08-06 19:01           ` Michael Brand
2012-08-07 21:29           ` Ilya Shlyakhter
2012-07-31  2:48 ` Torsten Wagner
2012-08-01 13:29   ` Bastien
2012-08-02  1:19     ` Torsten Wagner
2012-08-06 15:02       ` Christopher J. White
2012-08-01 17:11   ` Achim Gratz
2012-08-01 18:39     ` Bernt Hansen
2012-08-01 18:49       ` Achim Gratz
2012-08-02  1:16     ` Torsten Wagner
2012-08-02 15:10       ` Bastien
2012-08-07 21:33         ` Ilya Shlyakhter
2012-08-02 13:01   ` babel awk with table input: Code block produced no output Greg Minshall
2012-08-02 13:21     ` Sebastien Vauban
2012-08-03  2:08     ` [BUG] Traceback on Org-Export Luis Anaya
2012-08-03  7:19       ` Bastien
2012-08-03 10:27         ` Luis Anaya
2012-08-04 13:06           ` Achim Gratz
2012-08-04 14:13             ` Achim Gratz
2012-08-04 17:58             ` Bastien
2012-08-04 21:07               ` Achim Gratz
2012-08-05  9:44                 ` Bastien
2012-08-05 15:44                   ` Achim Gratz
2012-08-03 10:43         ` Luis Anaya
2012-08-03 11:17           ` Giovanni Ridolfi
2012-08-03 11:32             ` Luis Anaya
2012-08-03 14:34               ` Nick Dokos
2012-08-03 20:09           ` Achim Gratz
2012-08-05 23:57     ` babel awk with table input: Code block produced no output Greg Minshall
2012-08-06  1:36       ` Thomas S. Dye
2012-08-06  4:59         ` Greg Minshall
2012-08-06 15:37       ` Eric Schulte [this message]
2012-08-08  5:00         ` Change: no longer automatically evaluate embedded elisp in code block output Was: " Greg Minshall
2012-08-07  3:12 ` are super-hidden technical blocks required? Torsten Wagner
2012-08-07 10:23   ` Bastien
2012-08-07 13:20     ` Torsten Wagner
2012-08-07 13:39       ` Christopher J. White
2012-08-07 14:11         ` Torsten Wagner
2012-08-07 14:30           ` Robert Horn
2012-08-14  9:58       ` Bastien

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873940xc99.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=minshall@umich.edu \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).