Subject: bug#65286: 30.0.50; package-install-file for built-in package

From: Philip Kaludercic <[email-masked]>
Date: Mon, 14 Aug 2023 14:15:07 +0000

Ihor Radchenko <[email-masked]> writes:

> Philip Kaludercic <[email-masked]> writes:
>
>>> Also, keeping elpa directory around between the tests triggers various failures.
>>
>> Are you sure that this is not an issue related to org-mode?
>
> It might be. But the difference between package-install-file w/without
> built-in Org loaded is unlikely Org's fault in any case.

For the record, these are the changes between your checkout and what is
on master:

diff -u /tmp/org-mode/lisp/ob-gnuplot.el /home/philip/Source/emacs/lisp/org/ob-gnuplot.el
--- /tmp/org-mode/lisp/ob-gnuplot.el	2023-08-14 16:10:37.615919936 +0200
+++ /home/philip/Source/emacs/lisp/org/ob-gnuplot.el	2023-04-05 22:53:26.932222097 +0200
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2009-2023 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
-;; Maintainer: Ihor Radchenko <yantar92 at posteo dot net>
+;; Maintainer: Ihor Radchenko <[email-masked]>
 ;; Keywords: literate programming, reproducible research
 ;; URL: https://orgmode.org
 
@@ -40,9 +40,11 @@
 
 ;;; Code:
 
-(require 'ob-9.7 "ob")
-(require 'org-macs-9.7 "org-macs")
-(require 'ox-ascii-9.7 "ox-ascii")
+(require 'org-macs)
+(org-assert-version)
+
+(require 'ob)
+(require 'org-macs)
 
 (declare-function org-time-string-to-time "org" (s))
 (declare-function orgtbl-to-generic "org-table" (table params))
@@ -196,7 +198,7 @@
 (defun org-babel-execute:gnuplot (body params)
   "Execute a block of Gnuplot code.
 This function is called by `org-babel-execute-src-block'."
-  (org-require-package 'gnuplot)
+  (require 'gnuplot)
   (let ((session (cdr (assq :session params)))
         (result-type (cdr (assq :results params)))
         (body (org-babel-expand-body:gnuplot body params))
@@ -260,7 +262,7 @@
 If there is not a current inferior-process-buffer in SESSION
 then create one.  Return the initialized session.  The current
 `gnuplot-mode' doesn't provide support for multiple sessions."
-  (org-require-package 'gnuplot)
+  (require 'gnuplot)
   (unless (string= session "none")
     (save-window-excursion
       (gnuplot-send-string-to-gnuplot "" "line")
@@ -293,33 +295,17 @@
   (require 'ox-org)
   (with-temp-file data-file
     (insert (let ((org-babel-gnuplot-timestamp-fmt
-		   (or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S"))
-                  ;; Create custom limited backend that will disable
-                  ;; advanced ASCII export features that may alter the
-                  ;; original data.
-                  (ob-gnuplot-data
-                   (org-export-create-backend
-                    :parent 'ascii
-                    :transcoders
-                    `(;; Do not try to resolve links.  Export them verbatim.
-                      (link . (lambda (link _ _) (org-element-interpret-data link)))
-                      ;; Drop emphasis markers from verbatim and code.
-                      ;; This way, data can use verbatim when escaping
-                      ;; is necessary and yet be readable by Gnuplot,
-                      ;; which is not aware about Org's markup.
-                      (verbatim . (lambda (verbatim _ _) (org-element-property :value verbatim)))
-                      (code . (lambda (code _ _) (org-element-property :value code)))))))
+		   (or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S")))
 	      (orgtbl-to-generic
 	       table
 	       (org-combine-plists
-		`( :sep "\t" :fmt org-babel-gnuplot-quote-tsv-field
+		'( :sep "\t" :fmt org-babel-gnuplot-quote-tsv-field
                    ;; Two setting below are needed to make :fmt work.
                    :raw t
-                   :backend ,ob-gnuplot-data)
+                   :backend ascii)
 		params)))))
   data-file)
 
 (provide 'ob-gnuplot)
-(provide 'ob-gnuplot-9.7)
 
 ;;; ob-gnuplot.el ends here

Diff finished.  Mon Aug 14 16:12:51 2023

The (org-assert-version) seems new, with this check

  `(unless (or org--inhibit-version-check (equal (org-release) ,(org-release)))
     ...

could evaluating (org-release) during macro-expansion cause this
recursive load issue?

>> Could you create a minimal working example to reproduce this issue, by
>> removing as much as possible from the repository while retaining the
>> issue, and then send us a tarball with the remaining files?
>
> Sorry, but the issue is triggered by interaction between built-in and
> non-built-in Org. I have no idea if it is possible at all to create more
> minimal reproducer.

> To be clear, I have no clue at all what is going on. I made some
> relatively innocent changes in Org that added a couple of provide
> statements. I could see things breaking completely, but not __only__
> when built-in Org is loaded. So, any attempt to reduce the reproducer
> steps will be me trying random things - not very productive unless you
> absolutely cannot use the reproducer I provided.

No, sorry I couldn't reproduce it on my system :/

M-x emacs-version
GNU Emacs 30.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0) of 2023-08-14