Re: Bug: Subtle bug with calling "noweb" blocks with already computed :results output code and :cache yes [9.3.4 (9.3.4-5-ga0f3bb-elpa @ /home/lockywolf/.emacs.d/elpa/org-20200210/)]

2020-05-28 Thread Nicolas Goaziou
Hello,

Vladimir Nikishkin  writes:

> This bug is a bit hard to formulate. Have a look at the following
> org-file. Even though it's big, it's almost an MWE:

Emacs Lisp source code blocks would be way better.

Also, have you read cache limitations exposed at (info "(org)Limit code
block evaluation")? Note the part related to noweb expansion. Does that
explain what you observe?

Regards,

-- 
Nicolas Goaziou



Bug: Subtle bug with calling "noweb" blocks with already computed :results output code and :cache yes [9.3.4 (9.3.4-5-ga0f3bb-elpa @ /home/lockywolf/.emacs.d/elpa/org-20200210/)]

2020-05-27 Thread Vladimir Nikishkin



Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


This bug is a bit hard to formulate. Have a look at the following
org-file. Even though it's big, it's almost an MWE:

```

# -*- mode: org;  -*-

* Test
:PROPERTIES:
:header-args::cache yes :noweb yes
:END:


#+name: empty
#+begin_quote

#+end_quote

#+name: runner
#+header: :stdin empty  :exports code
#+begin_src shell :results output code :exports both
printf "%s\n%s" "Test string" "Test string2"
#+end_src

#+RESULTS[16ba04c7554c3436156f295ef43c8a0d2f2d9270]: runner
#+begin_src shell
Test string
Test string2
#+end_src


#+name: c-test-preserving-standard
#+header: :stdin empty  :exports code
#+begin_src shell :results output code
<>
#+end_src

#+RESULTS[16ba04c7554c3436156f295ef43c8a0d2f2d9270]: c-test-preserving-standard
#+begin_src shell
Test string
Test string2
#+end_src

#+name: c-test-preserving-unoptimized
#+header: :stdin empty  :exports code
#+begin_src shell :results output
<>
#+end_src

#+RESULTS[f9468f703a0c54b8601296d5332d51743d70fd05]: 
c-test-preserving-unoptimized
: Test string
: Test string2


#+header: :stdin empty
#+begin_src shell :results output code :wrap src patch :exports both
  output1=$(
  cat <<'EOF'
  <>
  EOF
  )


  output2=$(
  cat <<'EOF'
  <>
  EOF
  )

  diff -w -s -y <(echo "$output1") <(echo "$output2") | nl -w2 - 
#+end_src

#+RESULTS[2b14ae1ffc337f1857d2a3a75e890c3c3cb03d87]:
#+begin_src patch
 1  nil   | Test 
string
 2> Test 
string2
#+end_src

```

You can see that the patch gives two different results for an identical body.

The difference really is in: ":results output code"

This is a bit hard to reproduce, because it also seems to depend on
whether the block was cached, but I find it hard to formulate how
exactly.

In any case, the desired behaviour for me seems to be: take both results from
cache, if they are available, and run the comparison block. If the
cache is outdated, run each outdated block, update the cache, and feed
the cache results into the comparison block.

At the moment org doesn't seem to be updating the cache.

I can imagine thought that if the block output is considered "code",
someone may feel inclined to run the code instead of feeding it verbatim.


Emacs  : GNU Emacs 26.3 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 
3.24.12)
 of 2019-11-26
Package: Org mode version 9.3.4 (9.3.4-5-ga0f3bb-elpa @ 
/home/lockywolf/.emacs.d/elpa/org-20200210/)

current state:
==
(setq
 org-src-mode-hook '((lambda nil (modify-syntax-entry 60 ".") 
(modify-syntax-entry 62 ".")
  (setq geiser-autodoc--inhibit t))
 org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-latex-listings t
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-after-execute-hook '((lambda nil
 (if org-inline-image-overlays
  (progn (org-redisplay-inline-images)))
 )
)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-export-with-sub-superscripts '{}
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-html-format-inlinetask-function 
'org-html-format-inlinetask-default-function
 org-pretty-entities t
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-link-descriptive nil
 org-latex-pdf-process '("latexmk  -lualatex -outdir=%o -f %f")
 org-agenda-files '("~/Personal_Planner/Planner.org" 
"~/Personal_Planner/lockywolf_net.org"
"~/Personal_Planner/cyberpunk_smarthome.org"
"~/Personal_Planner/notes.org"
"~/Personal_Planner/2020-04-28-hotkeys-to-remember.txt.org"
"~/DevLinux/chibi-sicp/index.org")
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-modules '(org-habit ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info 
ol-irc ol-mhe
   ol-rmail ol-eww)
 org-plantuml-jar-path "/usr/local/bin/plantuml.jar"
 org-mode-hook '(#[0 "\301\211\207" [imenu-create-index-function 
org-imenu-get-tree] 2]
 turn-on-org-cdlatex org-tempo-setup
 (lambda nil
  (add-to-list (quote org-structure-template-alist)
   (quote ("p" . "src plantuml :noweb no :exports both :file 
")))
  (add-to-list (quote org-structure-template-alist)
   (quote ("SO" . "src scheme :exports both :results output")))
  (add-to-list (quote org-structure-template-alist)