emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Bastien Guerry <bzg@gnu.org>
Cc: Sacha Chua <sacha@sachachua.com>,
	emacs list <emacs-orgmode@gnu.org>,
	Timothy <orgmode@tec.tecosaur.net>
Subject: Re: [DISCUSSION] Add "Recent News" to orgmode.org
Date: Sun, 09 Jun 2024 11:36:25 +0000	[thread overview]
Message-ID: <87r0d62vra.fsf@localhost> (raw)
In-Reply-To: <87le3e4iyp.fsf@bzg.fr>

[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]

Bastien Guerry <bzg@gnu.org> writes:

>> However, the page did not get updated. May you please check the build
>> logs? Is there anything fishy going on there?
>
> https://builds.sr.ht/~bzg/job/1246209 still says:
>
>   "The remote resource "https://tracker.orgmode.org/news.org" is
>   considered unsafe, and will not be downloaded."
>
> I've committed this:
>
>   https://git.sr.ht/~bzg/orgweb/commit/f494af7c2f
>
> Perhaps there is a buggy combinaison of `org-resource-download-policy'
> and `org-safe-remote-resources' in general, in which case this needs
> to get fixed -- I didn't test further.  If this does not work, I will
> have another look this afternoon.

I think that the old regexp was simply not accurate. In particular, the
trailing \' prohibited all the Urls other than literally
https://tracker.orgmode.org.

That said, it is annoying that Org mode did not provide a clear
indication that something is fishy other than a simple message.

Attaching tentative patch that makes Org mode throw an error when a
prompt is requested for an external URI.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-confirm-resource-safe-Throw-an-error-when-non-in.patch --]
[-- Type: text/x-patch, Size: 2171 bytes --]

From 008c76edc6f79cac3c987ec9ba84674bc89a4f85 Mon Sep 17 00:00:00 2001
Message-ID: <008c76edc6f79cac3c987ec9ba84674bc89a4f85.1717932899.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Sun, 9 Jun 2024 13:27:46 +0200
Subject: [PATCH] org--confirm-resource-safe: Throw an error when
 non-interactive

* lisp/org.el (org--confirm-resource-safe): When asking about resource
safety in non-interactive mode throw an error rather than silently not
downloading the resource.  The previous behavior may remote
 #+include's seemingly being ignored.
* etc/ORG-NEWS (Org mode may throw an error when attempting to include
remote unsafe resource): Announce the change.
---
 etc/ORG-NEWS | 8 ++++++++
 lisp/org.el  | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 6265a17fb..5af437497 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -18,6 +18,14 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 # require user action for most Org mode users.
 # Sorted from most important to least important.
 
+*** Org mode may throw an error when attempting to include remote unsafe resource
+
+Previously, when ~org-resource-download-policy~ is ~ask~ (default),
+and Emacs is running in batch mode, Org mode simply skipped unsafe
+remote resources in the =#+include:='s.  Now, an error is thrown to
+avoid seemingly ignored =#+include= statements when publishing via
+batch scripts.
+
 ** New features
 
 # We list the most important features, and the features that may
diff --git a/lisp/org.el b/lisp/org.el
index cf4c9a99e..0f3818504 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4741,7 +4741,8 @@ (defun org--safe-remote-resource-p (uri)
 
 (defun org--confirm-resource-safe (uri)
   "Ask the user if URI should be considered safe, returning non-nil if so."
-  (unless noninteractive
+  (if noninteractive
+      (error "Cannot prompt about %S interactively in batch mode.  Aborting" uri)
     (let ((current-file (and (buffer-file-name (buffer-base-buffer))
                              (file-truename (buffer-file-name (buffer-base-buffer)))))
           (domain (and (string-match
-- 
2.45.1


[-- Attachment #3: Type: text/plain, Size: 225 bytes --]



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

  reply	other threads:[~2024-06-09 11:58 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04 19:41 [DISCUSSION] Add "Recent News" to orgmode.org Ihor Radchenko
2024-02-04 19:57 ` Thomas Dye
2024-02-04 20:24 ` Juan Manuel Macías
2024-02-04 20:49 ` Juergen Fenn
2024-02-04 21:02 ` Sacha Chua
2024-02-24 14:32   ` Bastien Guerry
2024-02-25 11:11     ` Ihor Radchenko
2024-02-26 10:01       ` Bastien Guerry
2024-02-26 10:59         ` Ihor Radchenko
2024-02-26 13:00           ` Bastien Guerry
2024-03-08  6:17           ` Bastien Guerry
2024-03-08  6:27             ` Ihor Radchenko
2024-03-08  6:34               ` Bastien Guerry
2024-03-08 10:30                 ` Ihor Radchenko
2024-03-08 10:31                   ` Ihor Radchenko
2024-03-08 15:41                   ` Bastien Guerry
2024-03-09  8:33     ` Ihor Radchenko
2024-03-09  8:35       ` Bastien Guerry
2024-03-23 14:25         ` Ihor Radchenko
2024-03-23 17:17           ` Bastien Guerry
2024-03-25  8:44             ` Ihor Radchenko
2024-04-28 13:28               ` Bastien Guerry
2024-06-08 19:07         ` Ihor Radchenko
2024-06-09  8:29           ` Bastien Guerry
2024-06-09 11:36             ` Ihor Radchenko [this message]
2024-06-10  8:56               ` Bastien Guerry
2024-06-11 10:10                 ` Ihor Radchenko
2024-02-05 21:52 ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0d62vra.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=orgmode@tec.tecosaur.net \
    --cc=sacha@sachachua.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).