emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Testing: Ensure 'org-id-locations-file' is set before updating
@ 2023-07-18 16:40 Morgan Smith
  2023-07-19  8:04 ` Ihor Radchenko
  2023-08-12  9:29 ` Ihor Radchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Morgan Smith @ 2023-07-18 16:40 UTC (permalink / raw)
  To: emacs-orgmode

Previously, when trying to run the tests in a container limited to the
org repository, it fails because it can't create the directory
"~/.emacs.d/.org-id-locations".

* testing/org-test.el (org-test-load): Move setting
'org-id-locations-file' from here ...
org-test-update-id-locations: ... to here
---

Hello!  This fix allows me to run the tests without giving it access to the
filesystem outside of the repository.  I have no clue what org-id-locations are
and I'm hoping someone else does so I don't have to learn.  I'm not sure if
this is the best fix, but it works.

 testing/org-test.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testing/org-test.el b/testing/org-test.el
index 47687b9f7..3f086f30c 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -387,8 +387,6 @@ Tramp related features.  We mostly follow
 (defun org-test-load ()
   "Load up the Org test suite."
   (interactive)
-  (setq org-id-locations-file
-        (expand-file-name ".test-org-id-locations" org-test-dir))
   (cl-flet ((rld (base)
 	         ;; Recursively load all files, if files throw errors
 	         ;; then silently ignore the error and continue to the
@@ -447,6 +445,8 @@ Tramp related features.  We mostly follow
       (when (buffer-live-p b) (kill-buffer b)))))
 
 (defun org-test-update-id-locations ()
+  (setq org-id-locations-file
+        (expand-file-name ".test-org-id-locations" org-test-dir))
   (org-id-update-id-locations
    (directory-files
     org-test-example-dir 'full
-- 
2.41.0



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

* Re: [PATCH] Testing: Ensure 'org-id-locations-file' is set before updating
  2023-07-18 16:40 [PATCH] Testing: Ensure 'org-id-locations-file' is set before updating Morgan Smith
@ 2023-07-19  8:04 ` Ihor Radchenko
  2023-08-12  9:29 ` Ihor Radchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Ihor Radchenko @ 2023-07-19  8:04 UTC (permalink / raw)
  To: Morgan Smith; +Cc: emacs-orgmode

Morgan Smith <Morgan.J.Smith@outlook.com> writes:

> Previously, when trying to run the tests in a container limited to the
> org repository, it fails because it can't create the directory
> "~/.emacs.d/.org-id-locations".
>
> * testing/org-test.el (org-test-load): Move setting
> 'org-id-locations-file' from here ...
> org-test-update-id-locations: ... to here
> ---
>
> Hello!  This fix allows me to run the tests without giving it access to the
> filesystem outside of the repository.  I have no clue what org-id-locations are
> and I'm hoping someone else does so I don't have to learn.  I'm not sure if
> this is the best fix, but it works.

The whole

(defconst org-test-dir
  (expand-file-name (file-name-directory (or load-file-name buffer-file-name))))

is fishy when users attempt to run tests from normal Emacs session.

If you had issues with this variable from batch invocation, something
should be fixed in the defconst, I think.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [PATCH] Testing: Ensure 'org-id-locations-file' is set before updating
  2023-07-18 16:40 [PATCH] Testing: Ensure 'org-id-locations-file' is set before updating Morgan Smith
  2023-07-19  8:04 ` Ihor Radchenko
@ 2023-08-12  9:29 ` Ihor Radchenko
  2023-08-12 14:26   ` Max Nikulin
  1 sibling, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-08-12  9:29 UTC (permalink / raw)
  To: Morgan Smith; +Cc: emacs-orgmode

Morgan Smith <Morgan.J.Smith@outlook.com> writes:

> Hello!  This fix allows me to run the tests without giving it access to the
> filesystem outside of the repository.  I have no clue what org-id-locations are
> and I'm hoping someone else does so I don't have to learn.  I'm not sure if
> this is the best fix, but it works.

In the absence of clear understanding what went wrong, I cannot accept
this patch, unfortunately.
Canceled.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [PATCH] Testing: Ensure 'org-id-locations-file' is set before updating
  2023-08-12  9:29 ` Ihor Radchenko
@ 2023-08-12 14:26   ` Max Nikulin
  2023-08-13  8:30     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Max Nikulin @ 2023-08-12 14:26 UTC (permalink / raw)
  To: emacs-orgmode

On 12/08/2023 16:29, Ihor Radchenko wrote:
> Morgan Smith writes:
> 
>> Hello!  This fix allows me to run the tests without giving it access to the
>> filesystem outside of the repository.  I have no clue what org-id-locations are
>> and I'm hoping someone else does so I don't have to learn.  I'm not sure if
>> this is the best fix, but it works.
> 
> In the absence of clear understanding what went wrong, I cannot accept
> this patch, unfortunately.

mkdir ~/hide
mv -i ~/.emacs* ~/hide
make test-dirty BTEST_RE=test-org-link

Finding ID locations (26/26 files): 
/home/ubuntu/src/org-mode/testing/examples/agenda-file.org
Opening output file: No such file or directory, 
/home/ubuntu/.emacs.d/.org-id-locations
make: *** [mk/targets.mk:100: test-dirty] Error 255

I have not looked closely into the proposed patch, but I find it 
reasonable expectation that tests should not write to ~/.emacs.d/




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

* Re: [PATCH] Testing: Ensure 'org-id-locations-file' is set before updating
  2023-08-12 14:26   ` Max Nikulin
@ 2023-08-13  8:30     ` Ihor Radchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Ihor Radchenko @ 2023-08-13  8:30 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

>> In the absence of clear understanding what went wrong, I cannot accept
>> this patch, unfortunately.
>
> mkdir ~/hide
> mv -i ~/.emacs* ~/hide
> make test-dirty BTEST_RE=test-org-link
>
> Finding ID locations (26/26 files): 
> /home/ubuntu/src/org-mode/testing/examples/agenda-file.org
> Opening output file: No such file or directory, 
> /home/ubuntu/.emacs.d/.org-id-locations
> make: *** [mk/targets.mk:100: test-dirty] Error 255
>
> I have not looked closely into the proposed patch, but I find it 
> reasonable expectation that tests should not write to ~/.emacs.d/

Thanks for the reproducer!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a0830f94e

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2023-08-13  8:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18 16:40 [PATCH] Testing: Ensure 'org-id-locations-file' is set before updating Morgan Smith
2023-07-19  8:04 ` Ihor Radchenko
2023-08-12  9:29 ` Ihor Radchenko
2023-08-12 14:26   ` Max Nikulin
2023-08-13  8:30     ` Ihor Radchenko

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