Re: [BUG] ob-shell: :cmdline fails with single argument (was Re: [BUG] ob-shell: :shebang changes interpretation of :cmdline)
On Sun, 19 Nov 2023 07:57:26 +0100 Max Nikulin wrote --- > I would say that :cmdline is treated in a different way in comparison to > :var: It most definitely is. It's a completely separate process from :var.
Re: [BUG] ob-shell: :cmdline fails with single argument (was Re: [BUG] ob-shell: :shebang changes interpretation of :cmdline)
On 19/11/2023 01:20, Matt wrote: #+begin_src bash :cmdline 1 echo "$1" #+end_src Then it fails with list: Wrong type argument: sequencep, 1 I would say that :cmdline is treated in a different way in comparison to :var: #+header: :results verbatim #+begin_src bash :var arr='(1 2 3) :cmdline '(97 98 99) printf '$1:%s\n' "$1" declare -p arr #+end_src #+RESULTS: : $1:abc : declare -a arr=([0]="1" [1]="2" [2]="3") I would expect more consistent results since script arguments is an array (positional arguments). $1=97, $2=98, $3=99
[BUG] ob-shell: :cmdline fails with single argument (was Re: [BUG] ob-shell: :shebang changes interpretation of :cmdline)
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