Here is the complete minimal example, as the HTML exported version of the email did not include org markup:
Tangling a source block that contains a variable from another source block results in an additional incorrect new line at the end of the variable value in the tangled output file, /only/ when source block output type is set to 'drawer'. Here is a minimal example comparing regular source block output (correct) versus drawer output (error), tested with emacs -Q, GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2025-05-27 and Org 9.7.11: * Allow org blocks to evaluate shell code #+begin_src elisp :tangle no :results output none (org-babel-do-load-languages 'org-babel-load-languages '((shell . t))) #+end_src * Tangle code block with variable input from other source block ** Using regular source block output *** Source block that generates the variable #+name: my_temp_dir1 #+begin_src bash :tangle no echo "/example/path" #+end_src #+RESULTS: my_temp_dir1 : /example/path *** Source block that takes in the variable and which gets tangled #+begin_src sh :var idir=my_temp_dir1 :tangle test_default.sh echo "${idir}" #+end_src *** Display the tangled block #+begin_src sh :tangle no :results output drawer cat test_default.sh #+end_src #+RESULTS: :results: idir='/example/path' echo "${idir}" :end: Looks okay! ** Using drawer source block output *** Source block that generates the variable #+name: my_temp_dir2 #+begin_src bash :tangle no :results output drawer echo "/example/path" #+end_src #+RESULTS: my_temp_dir2 :results: /example/path :end: *** Source block that takes in the variable and which gets tangled #+begin_src sh :var idir=my_temp_dir2 :tangle test_drawer.sh echo "${idir}" #+end_src *** Display the tangled block #+begin_src sh :tangle no :results output drawer cat test_drawer.sh #+end_src #+RESULTS: :results: idir='/example/path ' echo "${idir}" :end: We have a problem: the closing quote starts on a new line. Best, Vincent On 2025-08-08 at 15:20 -06, Vincent Koppelmans <vincentkoppelm...@gmail.com> wrote... > Hello org mode developers and experts, > > I encountered the following issue which I believe may be an org mode bug: > > Tangling a source block that contains a variable from another source block > results in an additional incorrect new line at the end of the variable value > in the tangled output file, /only/ when source block output type is set to > 'drawer'. > > Here is a minimal example comparing regular source block output (correct) > versus drawer output (error), tested with emacs -Q, GNU Emacs 31.0.50 (build > 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of > 2025-05-27 and Org 9.7.11: > > > Allow org blocks to evaluate shell code > ======================================= > > ,---- > | (org-babel-do-load-languages > | 'org-babel-load-languages > | '((shell . t))) > `---- > > > Tangle code block with variable input from other source block > ============================================================= > > Using regular source block output > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Source block that generates the variable > ---------------------------------------- > > ,---- > | echo "/example/path" > `---- > > > Source block that takes in the variable and which gets tangled > -------------------------------------------------------------- > > ,---- > | echo "${idir}" > `---- > > > Display the tangled block > ------------------------- > > ,---- > | cat test_default.sh > `---- > > Looks okay! > > > Using drawer source block output > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Source block that generates the variable > ---------------------------------------- > > ,---- > | echo "/example/path" > `---- > > > Source block that takes in the variable and which gets tangled > -------------------------------------------------------------- > > ,---- > | echo "${idir}" > `---- > > > Display the tangled block > ------------------------- > > ,---- > | cat test_drawer.sh > `---- > > We have a problem: the closing quote starts on a new line. > > Best, > > Vincent