emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation!
@ 2018-12-04 16:45 Tobias Zawada
  2018-12-04 17:33 ` Berry, Charles
  0 siblings, 1 reply; 7+ messages in thread
From: Tobias Zawada @ 2018-12-04 16:45 UTC (permalink / raw)
  To: emacs-orgmode

I mostly cite here from https://emacs.stackexchange.com/q/41208/2370:

The following example causes an infinite recursion in ~org-babel-get-src-block-info~.

#+BEGIN_SRC org
,#+BEGIN_SRC org
,#+NAME: add3
,#+BEGIN_SRC elisp :var num=0
(+ 3 num)
,#+END_SRC


,* Use function drawer header arg
:PROPERTIES:
:header-args: :var n=add3(5)
:END:


,#+NAME: whatIsN
,#+BEGIN_SRC sh
echo $n
,#+END_SRC


,#+RESULTS: whatIsN
: 8


,#+BEGIN_SRC sh :var a=whatIsN
echo $a
,#+END_SRC
#+END_SRC

The problem is located in org-babel-get-src-block-info.


The function org-babel-params-from-properties is used there. Its doc-string is:


Retrieve parameters specified as properties. Return a list of association lists of source block params specified in the properties of the current outline entry.


But they do not say what the current outline entry is. In org-babel-get-src-block-info they assumed that the current outline entry would be that one at point but org-babel-params-from-properties uses also org-babel-current-src-block-location to retrieve parameters from there.


Even if (point) is 1 for the first source block add3 the variable org-babel-current-src-block-location in org-babel-params-from-properties points to the source block whatIsN.


So not the header-args for add3 are collected by org-babel-params-from-properties but those of whatIsN.


The consequence is that add3 gets the header arg n=add3(5) from the drawer. Naturally, that leads to infinite recursion.


The funny thing is that they already tried to make sure that org-babel-params-from-properties gets the right header args from the location of datum. I cite a small section of org-babel-get-src-block-info:


;; If DATUM is provided, make sure we get node
 ;; properties applicable to its location within
 ;; the document.
 (org-with-point-at (org-element-property :begin datum)
 (org-babel-params-from-properties lang))


You can avoid the error if you additionally let-bind org-babel-current-src-block-location to the location of datum:


;; If DATUM is provided, make sure we get node
 ;; properties applicable to its location within
 ;; the document.
 (let ((org-babel-current-src-block-location (org-element-property :begin datum)))
 (org-with-point-at org-babel-current-src-block-location
 (org-babel-params-from-properties lang)))


I am not sure about the full consequences of that change through.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation!
  2018-12-04 16:45 Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation! Tobias Zawada
@ 2018-12-04 17:33 ` Berry, Charles
  2018-12-05  0:01   ` Tobias Zawada
  0 siblings, 1 reply; 7+ messages in thread
From: Berry, Charles @ 2018-12-04 17:33 UTC (permalink / raw)
  To: Tobias Zawada; +Cc: org-mode-email

I cannot reproduce this in 9.1.14

C-c C-v C-i on each src block works as expected.

org-babel-execute-buffer runs to successful completion.

HTH,

Chuck


> On Dec 4, 2018, at 8:45 AM, Tobias Zawada <i_inbox@tn-home.de> wrote:
> 
> I mostly cite here from https://emacs.stackexchange.com/q/41208/2370:
> 
> The following example causes an infinite recursion in ~org-babel-get-src-block-info~.
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation!
  2018-12-04 17:33 ` Berry, Charles
@ 2018-12-05  0:01   ` Tobias Zawada
  2018-12-05 15:59     ` Tobias Zawada
  0 siblings, 1 reply; 7+ messages in thread
From: Tobias Zawada @ 2018-12-05  0:01 UTC (permalink / raw)
  To: Berry, Charles; +Cc: org-mode-email

Dear Charles,
thanks for the quick test.
You wrote:

 > I cannot reproduce this in 9.1.14
 > C-c C-v C-i on each src block works as expected.
 > org-babel-execute-buffer runs to successful completion.

I had a look at the orgmode master.
The problem has already been fixed in the master by substituting the 
reference to |org-babel-current-src-block-location with (point).|
See: 
https://code.orgmode.org/bzg/org-mode/src/04641c4bbefc5f90e05fe4e846f4aeab15f1c262/lisp/ob-core.el#L1446

NOTE however that the problem is still present in the maint branch:
See: 
https://code.orgmode.org/bzg/org-mode/src/1315315465d49ebe32e533515ec81fd1ba165a55/lisp/ob-core.el#L1444

Best regards,
Tobias Zawada

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation!
  2018-12-05  0:01   ` Tobias Zawada
@ 2018-12-05 15:59     ` Tobias Zawada
  2018-12-05 17:44       ` Berry, Charles
  0 siblings, 1 reply; 7+ messages in thread
From: Tobias Zawada @ 2018-12-05 15:59 UTC (permalink / raw)
  To: Berry, Charles; +Cc: org-mode-email

Dear Charles,
I installed orgmode 9.14 from org via ~package-install~.

The problem is still present there.
The messages from the evaluation of the last code block and the output of ~org-version~:

#+BEGIN_QUOTE
Wrote /temp/test1.org
executing Elisp code block (add3)...

(num (quote 5))

"8"
outline-on-heading-p: Variable binding depth exceeds max-specpdl-size
Org mode version 9.1.14 (9.1.14-1-g4931fc-elpa @ /cygdrive/c/Users/.../.emacs.d/elpa/org-9.1.14/)
#+END_QUOTE

> Tobias Zawada <i_inbox@tn-home.de> hat am 5. Dezember 2018 um 01:01 geschrieben:
> 
> 
> Dear Charles,
> thanks for the quick test.
> You wrote:
> > I cannot reproduce this in 9.1.14 > C-c C-v C-i on each src block works as expected. > org-babel-execute-buffer runs to successful completion.
> 
> I had a look at the orgmode master.
> The problem has already been fixed in the master by substituting the 
> reference to |org-babel-current-src-block-location with (point).|
> See: 
> https://code.orgmode.org/bzg/org-mode/src/04641c4bbefc5f90e05fe4e846f4aeab15f1c262/lisp/ob-core.el#L1446
> 
> NOTE however that the problem is still present in the maint branch:
> See: 
> https://code.orgmode.org/bzg/org-mode/src/1315315465d49ebe32e533515ec81fd1ba165a55/lisp/ob-core.el#L1444
> 
> Best regards,
> Tobias Zawada

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation!
  2018-12-05 15:59     ` Tobias Zawada
@ 2018-12-05 17:44       ` Berry, Charles
  2018-12-05 23:07         ` Tobias Zawada
  0 siblings, 1 reply; 7+ messages in thread
From: Berry, Charles @ 2018-12-05 17:44 UTC (permalink / raw)
  To: Tobias Zawada; +Cc: org-mode-email

Hmmm.

I just updated from master using `make update2'.

I ran 

/Applications/Emacs.app/Contents/MacOS/Emacs -q

which is morally equivalent to `emacs -q' on a linux box.

I had to customize `org-babel-load-languages' to add `shell'.

I copied your text to an org buffer did C-c ' to extract the org src and saved it as a file.

I ran the last code block using C-c C-c.

It gave me the expected result. The message buffer had:

,----
| executing Elisp code block (add3)...
| 
| (num (quote 5))
| 
| "8"
| executing Elisp code block (add3)...
| 
| (num (quote 5))
| 
| "8"
| executing Sh code block (whatIsN)...
| Wrote /var/folders/kb/2hchpbyj7lb6z76l0q73w_fh0000gn/T/babel-994SoA/ob-input-994MXT
| "8"
| executing Sh code block...
| Wrote /var/folders/kb/2hchpbyj7lb6z76l0q73w_fh0000gn/T/babel-994SoA/ob-input-994AAs
| Code block evaluation complete.
| Auto-saving...
`----

I suggest you try `emacs -q' to be sure it isn't something in your init file.

If that doesn't work, my best guess is you have a mixed installation that you will need to repair.

HTH,

Chuck

> On Dec 5, 2018, at 7:59 AM, Tobias Zawada <i_inbox@tn-home.de> wrote:
> 
> Dear Charles,
> I installed orgmode 9.14 from org via ~package-install~.
> 
> The problem is still present there.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation!
  2018-12-05 17:44       ` Berry, Charles
@ 2018-12-05 23:07         ` Tobias Zawada
  2018-12-05 23:35           ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Tobias Zawada @ 2018-12-05 23:07 UTC (permalink / raw)
  To: Berry, Charles; +Cc: org-mode-email

Dear Charles,
The problem is the update from master.
From my understanding Master is more or less the development branch.
It is not what can be installed from org via package-install.
I believe that is the maint branch. But I can be mistaken.
Nevertheless, I had a look at the 9.14-Tag on https://code.orgmode.org/bzg/org-mode.
And the problem is there.

AFAIK from general understanding of software development bugfixes should also be applied to the maintenance version of a program.

You find a more exact description inclusive the relevant links at 
https://emacs.stackexchange.com/a/46424/2370

Best regards,
Tobias Zawada

> "Berry, Charles" <ccberry@ucsd.edu> hat am 5. Dezember 2018 um 18:44 geschrieben:
> 
> 
> Hmmm.
> 
> I just updated from master using `make update2'.
> 
> I ran 
> 
> /Applications/Emacs.app/Contents/MacOS/Emacs -q
> 
> which is morally equivalent to `emacs -q' on a linux box.
> 
> I had to customize `org-babel-load-languages' to add `shell'.
> 
> I copied your text to an org buffer did C-c ' to extract the org src and saved it as a file.
> 
> I ran the last code block using C-c C-c.
> 
> It gave me the expected result. The message buffer had:
> 
> ,----
> | executing Elisp code block (add3)...
> | 
> | (num (quote 5))
> | 
> | "8"
> | executing Elisp code block (add3)...
> | 
> | (num (quote 5))
> | 
> | "8"
> | executing Sh code block (whatIsN)...
> | Wrote /var/folders/kb/2hchpbyj7lb6z76l0q73w_fh0000gn/T/babel-994SoA/ob-input-994MXT
> | "8"
> | executing Sh code block...
> | Wrote /var/folders/kb/2hchpbyj7lb6z76l0q73w_fh0000gn/T/babel-994SoA/ob-input-994AAs
> | Code block evaluation complete.
> | Auto-saving...
> `----
> 
> I suggest you try `emacs -q' to be sure it isn't something in your init file.
> 
> If that doesn't work, my best guess is you have a mixed installation that you will need to repair.
> 
> HTH,
> 
> Chuck
> > On Dec 5, 2018, at 7:59 AM, Tobias Zawada <i_inbox@tn-home.de> wrote:
> > 
> > Dear Charles,
> > I installed orgmode 9.14 from org via ~package-install~.
> > 
> > The problem is still present there.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation!
  2018-12-05 23:07         ` Tobias Zawada
@ 2018-12-05 23:35           ` Nicolas Goaziou
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2018-12-05 23:35 UTC (permalink / raw)
  To: Tobias Zawada; +Cc: org-mode-email, Berry, Charles

Hello,

Tobias Zawada <i_inbox@tn-home.de> writes:

> AFAIK from general understanding of software development bugfixes
> should also be applied to the maintenance version of a program.

Org maint is totally frozen and bugfixes are applied to master instead.
It is inconvenient. Hopefully, it will change once Org 9.2 is released.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-12-05 23:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-04 16:45 Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation! Tobias Zawada
2018-12-04 17:33 ` Berry, Charles
2018-12-05  0:01   ` Tobias Zawada
2018-12-05 15:59     ` Tobias Zawada
2018-12-05 17:44       ` Berry, Charles
2018-12-05 23:07         ` Tobias Zawada
2018-12-05 23:35           ` Nicolas Goaziou

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).