[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[BUG] ob-shell: :cmdline fails with single argument (was Re: [BUG] ob-sh
From: |
Matt |
Subject: |
[BUG] ob-shell: :cmdline fails with single argument (was Re: [BUG] ob-shell: :shebang changes interpretation of :cmdline) |
Date: |
Sat, 18 Nov 2023 19:20:47 +0100 |
User-agent: |
Zoho Mail |
---- On Sat, 18 Nov 2023 16:54:39 +0100 Max Nikulin wrote ---
> I have faced an inconsistency with :cmdline treatment in ob-shell.el.
These are sadly easy to find.
If you run:
#+begin_src bash :cmdline 1
echo "$1"
#+end_src
Then it fails with
list: Wrong type argument: sequencep, 1
However, running this works:
#+begin_src bash :cmdline "1"
echo "$1"
#+end_src
I didn't dig too much into it, but it looks like :cmdline expects a sequence.
When multiple arguments are passed, such as :cmdline 1 2 3, then "1 2 3" is
passed into process-file. (sequencep "1 2 3") is t. (sequencep 1) is nil.
So, to work around this a single :cmdline argument must be surrounded by quotes
to make it a sequence. (sequencep "1") is t. Obviously, this should be fixed.
Attached is a patch to test for this whenever we're ready to tackle making
execution mutually consistent. I'm still reviewing the library and am not
quite ready for that yet.
test-cmdline-with-single-argument-shouldnt-require-quotes.patch
Description: Binary data