GNU bug report logs - #68687
[PATCH] Use text/org media type

Previous Next

Package: emacs;

Reported by: Max Nikulin <manikulin <at> gmail.com>

Date: Wed, 24 Jan 2024 14:45:01 UTC

Severity: wishlist

Tags: patch

To reply to this bug, email your comments to 68687 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to emacs-orgmode <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Wed, 24 Jan 2024 14:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Max Nikulin <manikulin <at> gmail.com>:
New bug report received and forwarded. Copy sent to emacs-orgmode <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Wed, 24 Jan 2024 14:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Max Nikulin <manikulin <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Use text/org media type
Date: Wed, 24 Jan 2024 21:43:55 +0700
[Message part 1 (text/plain, inline)]
Hi,

I suggest to make the media type used for Org mode files consistent with 
the one used by XDG https://gitlab.freedesktop.org/xdg/shared-mime-info
Currently Emacs has text/x-org, however "x-" prefix is not recommended 
by IANA any more, see https://www.rfc-editor.org/rfc/rfc6648 
"Deprecating the "X-" Prefix and Similar Constructs in Application 
Protocols"

Ideally somebody should file a request to IANA to register the text/org 
media type.
https://www.iana.org/assignments/media-types/media-types.xhtml
However I have no idea concerning a conflict due to the .org file name 
suffix. It was used in the past by early versions of Lotus Organizer. 
https://www.iana.org/assignments/media-types/application/vnd.lotus-organizer

I am unsure if gnus-related code should be committed to some other 
repository at first. I am not a gnus user, so I do not mind if an 
alternative change will be committed.

See also
emacs-orgmode: Org mode MIME type. Sun, 21 Jan 2024 20:56:15 +0700.
https://list.orgmode.org/6d94fff4-4d30-4121-bfd1-f267cb5b637c <at> gmail.com
[0001-Use-text-org-media-type.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Thu, 25 Jan 2024 23:11:01 GMT) Full text and rfc822 format available.

Message #8 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Max Nikulin <manikulin <at> gmail.com>, 68687 <at> debbugs.gnu.org
Cc: emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Thu, 25 Jan 2024 15:10:27 -0800
Max Nikulin <manikulin <at> gmail.com> writes:

> Hi,
>
> I suggest to make the media type used for Org mode files consistent with
> the one used by XDG https://gitlab.freedesktop.org/xdg/shared-mime-info
> Currently Emacs has text/x-org, however "x-" prefix is not recommended
> by IANA any more, see https://www.rfc-editor.org/rfc/rfc6648
> "Deprecating the "X-" Prefix and Similar Constructs in Application
> Protocols"
>
> Ideally somebody should file a request to IANA to register the text/org
> media type.
> https://www.iana.org/assignments/media-types/media-types.xhtml

Eli, Ihor, what do you think?

> However I have no idea concerning a conflict due to the .org file name
> suffix. It was used in the past by early versions of Lotus Organizer.
> https://www.iana.org/assignments/media-types/application/vnd.lotus-organizer
>
> I am unsure if gnus-related code should be committed to some other
> repository at first. I am not a gnus user, so I do not mind if an
> alternative change will be committed.
>
> See also
> emacs-orgmode: Org mode MIME type. Sun, 21 Jan 2024 20:56:15 +0700.
> https://list.orgmode.org/6d94fff4-4d30-4121-bfd1-f267cb5b637c <at> gmail.com
> From 8b71393625f11590e99896808bbd04ed83f7917e Mon Sep 17 00:00:00 2001
> From: Max Nikulin <manikulin <at> gmail.com>
> Date: Wed, 24 Jan 2024 21:16:28 +0700
> Subject: [PATCH] Use text/org media type
>
> Avoid "x-" prefix deprecated by rfc6648 for Org mode media type.
> * lisp/net/mailcap.el (mailcap-mime-extensions):
> * lisp/gnus/mm-uu.el (mm-uu-org-src-code-block-extract): Replace
> text/x-org by text/org.
> * lisp/gnus/mm-decode.el (mm-inline-media-tests): Allow text/org in
> addition to text/x-org.
>
> Make media type defined for Org mode consistent with
> <https://gitlab.freedesktop.org/xdg/shared-mime-info>
>
> See emacs-orgmode: Org mode MIME type. Sun, 21 Jan 2024 20:56:15 +0700.
> https://list.orgmode.org/6d94fff4-4d30-4121-bfd1-f267cb5b637c <at> gmail.com
> ---
>  lisp/gnus/mm-decode.el | 1 +
>  lisp/gnus/mm-uu.el     | 2 +-
>  lisp/net/mailcap.el    | 3 ++-
>  3 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
> index f91755e967b..cae737e5a3e 100644
> --- a/lisp/gnus/mm-decode.el
> +++ b/lisp/gnus/mm-decode.el
> @@ -246,6 +246,7 @@ (defcustom mm-inline-media-tests
>      ("text/x-sh" mm-display-shell-script-inline identity)
>      ("application/javascript" mm-display-javascript-inline identity)
>      ("text/dns" mm-display-dns-inline identity)
> +    ("text/org" mm-display-org-inline identity)
>      ("text/x-org" mm-display-org-inline identity)
>      ("text/html"
>       mm-inline-text-html
> diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
> index 3c7e3cbdf1a..b10da0c143a 100644
> --- a/lisp/gnus/mm-uu.el
> +++ b/lisp/gnus/mm-uu.el
> @@ -394,7 +394,7 @@ (defun mm-uu-emacs-sources-extract ()
>
>  (defun mm-uu-org-src-code-block-extract ()
>    (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
> -		  '("text/x-org" (charset . gnus-decoded))))
> +		  '("text/org" (charset . gnus-decoded))))
>
>  (defvar gnus-newsgroup-name)
>
> diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
> index 5ff75deb4e6..900099433c4 100644
> --- a/lisp/net/mailcap.el
> +++ b/lisp/net/mailcap.el
> @@ -989,7 +989,8 @@ (defvar mailcap-mime-extensions
>      (".jpe"   . "image/jpeg")
>      (".jpeg"  . "image/jpeg")
>      (".webp"  . "image/webp")
> -    (".org"   . "text/x-org"))
> +    ;; May be overridden by application/vnd.lotus-organizer in /etc/mime.types.
> +    (".org"   . "text/org"))
>    "An alist of file extensions and corresponding MIME content-types.
>  This exists for you to customize the information in Lisp.  It is
>  merged with values from mailcap files by `mailcap-parse-mimetypes'.")
> --
> 2.39.2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Thu, 25 Jan 2024 23:41:02 GMT) Full text and rfc822 format available.

Message #11 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org, Max Nikulin <manikulin <at> gmail.com>,
 emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Thu, 25 Jan 2024 23:43:14 +0000
Stefan Kangas <stefankangas <at> gmail.com> writes:

>> I suggest to make the media type used for Org mode files consistent with
>> the one used by XDG https://gitlab.freedesktop.org/xdg/shared-mime-info
>> Currently Emacs has text/x-org, however "x-" prefix is not recommended
>> by IANA any more, see https://www.rfc-editor.org/rfc/rfc6648
>> "Deprecating the "X-" Prefix and Similar Constructs in Application
>> Protocols"
>> Ideally somebody should file a request to IANA to register the text/org
>> media type.
>> https://www.iana.org/assignments/media-types/media-types.xhtml
>
> Eli, Ihor, what do you think?

I see using text/org as an improvement. text/x-org is likely useless.
At least,
https://github.com/jeremy-compostella/org-msg/blob/master/org-msg.el
uses text/org, which may appear in email parts.

However, AFAIU, text/org will fall into "standards tree" in IANA media
type specification, which means that it MUST be registered, as described
in https://www.rfc-editor.org/rfc/rfc6838.html#section-3.1

Registering text/org media type requires syntax spec. We are
still working on format Org mode syntax specifications. See
https://list.orgmode.org/orgmode/871rjhha8t.fsf <at> gmail.com/ and
https://orgmode.org/worg/org-syntax.html

The spec is still not fully finalized, so we are not yet initiating the
registration, as we will need to repeat it again if we decide to make
further changes (https://www.rfc-editor.org/rfc/rfc6838.html#section-5.5)

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 26 Jan 2024 07:24:02 GMT) Full text and rfc822 format available.

Message #14 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org, manikulin <at> gmail.com, emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Fri, 26 Jan 2024 09:23:44 +0200
> Cc: emacs-orgmode <at> gnu.org
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Thu, 25 Jan 2024 15:10:27 -0800
> 
> Max Nikulin <manikulin <at> gmail.com> writes:
> 
> > Hi,
> >
> > I suggest to make the media type used for Org mode files consistent with
> > the one used by XDG https://gitlab.freedesktop.org/xdg/shared-mime-info
> > Currently Emacs has text/x-org, however "x-" prefix is not recommended
> > by IANA any more, see https://www.rfc-editor.org/rfc/rfc6648
> > "Deprecating the "X-" Prefix and Similar Constructs in Application
> > Protocols"
> >
> > Ideally somebody should file a request to IANA to register the text/org
> > media type.
> > https://www.iana.org/assignments/media-types/media-types.xhtml
> 
> Eli, Ihor, what do you think?

I agree, but since Ihor indicates that is impossible for now, we will
have to live with the current situation for at least the near future.

So I think we should install these changes, but please audit them
carefully to make sure we don't create any backward-compatibility
problems unnecessarily.  For example:

> > diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
> > index 3c7e3cbdf1a..b10da0c143a 100644
> > --- a/lisp/gnus/mm-uu.el
> > +++ b/lisp/gnus/mm-uu.el
> > @@ -394,7 +394,7 @@ (defun mm-uu-emacs-sources-extract ()
> >
> >  (defun mm-uu-org-src-code-block-extract ()
> >    (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
> > -		  '("text/x-org" (charset . gnus-decoded))))
> > +		  '("text/org" (charset . gnus-decoded))))
> >
> >  (defvar gnus-newsgroup-name)
> >
> > diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
> > index 5ff75deb4e6..900099433c4 100644
> > --- a/lisp/net/mailcap.el
> > +++ b/lisp/net/mailcap.el
> > @@ -989,7 +989,8 @@ (defvar mailcap-mime-extensions
> >      (".jpe"   . "image/jpeg")
> >      (".jpeg"  . "image/jpeg")
> >      (".webp"  . "image/webp")
> > -    (".org"   . "text/x-org"))
> > +    ;; May be overridden by application/vnd.lotus-organizer in /etc/mime.types.
> > +    (".org"   . "text/org"))

I'm not sure the removal of text/x-org in these two hunks is a good
idea: could it perhaps cause trouble to someone, e.g. if an email
message is sent from Emacs with this change and read by Emacs without
it?  (I don't use these packages, so I wouldn't know the answer.)  In
general, I'd prefer changes that add text/org without removing support
for text/x-org.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 26 Jan 2024 07:41:02 GMT) Full text and rfc822 format available.

Message #17 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 68687 <at> debbugs.gnu.org, manikulin <at> gmail.com, emacs-orgmode <at> gnu.org,
 stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Fri, 26 Jan 2024 09:40:09 +0200
> Cc: 68687 <at> debbugs.gnu.org, Max Nikulin <manikulin <at> gmail.com>,
>  emacs-orgmode <at> gnu.org
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Date: Thu, 25 Jan 2024 23:43:14 +0000
> 
> However, AFAIU, text/org will fall into "standards tree" in IANA media
> type specification, which means that it MUST be registered, as described
> in https://www.rfc-editor.org/rfc/rfc6838.html#section-3.1
> 
> Registering text/org media type requires syntax spec. We are
> still working on format Org mode syntax specifications. See
> https://list.orgmode.org/orgmode/871rjhha8t.fsf <at> gmail.com/ and
> https://orgmode.org/worg/org-syntax.html
> 
> The spec is still not fully finalized, so we are not yet initiating the
> registration, as we will need to repeat it again if we decide to make
> further changes (https://www.rfc-editor.org/rfc/rfc6838.html#section-5.5)

I hope the process of finalizing the Org spec and moving to its
registration will not fall between the cracks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 26 Jan 2024 10:40:02 GMT) Full text and rfc822 format available.

Message #20 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Max Nikulin <manikulin <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Fri, 26 Jan 2024 17:39:11 +0700
On 26/01/2024 14:23, Eli Zaretskii wrote:
> I'm not sure the removal of text/x-org in these two hunks is a good
> idea: could it perhaps cause trouble to someone, e.g. if an email
> message is sent from Emacs with this change and read by Emacs without
> it?

I do not mind if you will decide to split the suggested patch into 2 
parts and to postpone for some years hunks that affect sending. Anyway 
it would be a step toward text/org media type.

Messages sent to the emacs-orgmode mailing list last years contain mix of
- text/org
- text/x-org
- application/vnd.lotus-organizer (most popular variant)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 26 Jan 2024 10:53:02 GMT) Full text and rfc822 format available.

Message #23 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Max Nikulin <manikulin <at> gmail.com>
To: Ihor Radchenko <yantar92 <at> posteo.net>,
 Stefan Kangas <stefankangas <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Fri, 26 Jan 2024 17:52:40 +0700
On 26/01/2024 06:43, Ihor Radchenko wrote:
> However, AFAIU, text/org will fall into "standards tree" in IANA media
> type specification, which means that it MUST be registered,
> 
> Registering text/org media type requires syntax spec. We are
> still working on format Org mode syntax specifications.

You a right. I was confused reading rfc6648 that registration procedure 
had been simplified to deprecate x- prefixes. In addition, I did not 
realize that application/vnd.lotus-organizer was registered without 
format specification because this type belongs to the vendor tree, not 
standards one.
https://www.iana.org/assignments/media-types/application/vnd.lotus-organizer

I do not think it is reasonable to use a type like text/vnd.gnu.emacs.org.

Even with format specification, I am afraid, .org file name suffix may 
be an obstacle. Likely it is necessary to contact IBM and to ask them 
concerning registration of Lotus. In the optimistic scenario they may 
declare Lotus-related media types as obsolete since the product is 
discontinued.

Changing of file name suffix for Org would be more painful than updating 
emacs to use text/org instead of text/x-org.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 26 Jan 2024 12:24:02 GMT) Full text and rfc822 format available.

Message #26 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Max Nikulin <manikulin <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org, stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Fri, 26 Jan 2024 14:22:59 +0200
> Date: Fri, 26 Jan 2024 17:39:11 +0700
> Cc: 68687 <at> debbugs.gnu.org
> From: Max Nikulin <manikulin <at> gmail.com>
> 
> On 26/01/2024 14:23, Eli Zaretskii wrote:
> > I'm not sure the removal of text/x-org in these two hunks is a good
> > idea: could it perhaps cause trouble to someone, e.g. if an email
> > message is sent from Emacs with this change and read by Emacs without
> > it?
> 
> I do not mind if you will decide to split the suggested patch into 2 
> parts and to postpone for some years hunks that affect sending. Anyway 
> it would be a step toward text/org media type.
> 
> Messages sent to the emacs-orgmode mailing list last years contain mix of
> - text/org
> - text/x-org
> - application/vnd.lotus-organizer (most popular variant)

So can you please point out which part(s) of your patch should be
installed right away?  Or post a new patch that includes only those
parts?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 26 Jan 2024 13:58:01 GMT) Full text and rfc822 format available.

Message #29 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 68687 <at> debbugs.gnu.org, manikulin <at> gmail.com, emacs-orgmode <at> gnu.org,
 stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Fri, 26 Jan 2024 14:00:37 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> The spec is still not fully finalized, so we are not yet initiating the
>> registration, as we will need to repeat it again if we decide to make
>> further changes (https://www.rfc-editor.org/rfc/rfc6838.html#section-5.5)
>
> I hope the process of finalizing the Org spec and moving to its
> registration will not fall between the cracks.

No worries. We are slowly working on the spec. See
https://git.sr.ht/~bzg/worg/log/master/item/org-syntax.org

But finalizing the whole thing will not be fast, given our plans to
extend Org mode syntax to better suit software manuals as requested by
RMS, and to address several long-standing issues with escaping edge
cases.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Sat, 27 Jan 2024 03:39:01 GMT) Full text and rfc822 format available.

Message #32 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org, manikulin <at> gmail.com, emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Fri, 26 Jan 2024 22:38:31 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

What is the purpose for which text/org would be used?
In what situations would we want to send files in Org format
and why would it be useful to formally label them?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Sun, 28 Jan 2024 16:36:02 GMT) Full text and rfc822 format available.

Message #35 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Max Nikulin <manikulin <at> gmail.com>
To: rms <at> gnu.org, Stefan Kangas <stefankangas <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Sun, 28 Jan 2024 23:35:09 +0700
On 27/01/2024 10:38, Richard Stallman wrote:
> 
> What is the purpose for which text/org would be used?
> In what situations would we want to send files in Org format
> and why would it be useful to formally label them?

I am rather confused by these questions. Media types appears in the 
Content-Type header. Applications decide how to treat content basing on 
media type description. E.g. Thunderbird may be configured to display 
text attachments inline, but if the same attachment uses 
application/vnd.lotus-organizer then an external application must be 
invoked to see its text.

De-facto Org files are used in various projects. Received or fetched Org 
files must be treated with some precautions, but it is another story.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Sun, 28 Jan 2024 16:49:02 GMT) Full text and rfc822 format available.

Message #38 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Max Nikulin <manikulin <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org, rms <at> gnu.org,
 stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Sun, 28 Jan 2024 18:47:37 +0200
> Cc: 68687 <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org
> Date: Sun, 28 Jan 2024 23:35:09 +0700
> From: Max Nikulin <manikulin <at> gmail.com>
> 
> On 27/01/2024 10:38, Richard Stallman wrote:
> > 
> > What is the purpose for which text/org would be used?
> > In what situations would we want to send files in Org format
> > and why would it be useful to formally label them?
> 
> I am rather confused by these questions. Media types appears in the 
> Content-Type header. Applications decide how to treat content basing on 
> media type description. E.g. Thunderbird may be configured to display 
> text attachments inline, but if the same attachment uses 
> application/vnd.lotus-organizer then an external application must be 
> invoked to see its text.
> 
> De-facto Org files are used in various projects. Received or fetched Org 
> files must be treated with some precautions, but it is another story.

I think Richard lacks the broader context: that text/org is supposed
to appear in the Content-Type header in email messages, and the MUA is
supposed to display this content in received email messages according
to user expectations, which generally follow how Org buffers display
text.




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 30 Jan 2024 00:44:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Tue, 30 Jan 2024 03:58:02 GMT) Full text and rfc822 format available.

Message #43 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 68687 <at> debbugs.gnu.org, manikulin <at> gmail.com, emacs-orgmode <at> gnu.org,
 stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Mon, 29 Jan 2024 22:56:58 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > I think Richard lacks the broader context: that text/org is supposed
  > to appear in the Content-Type header in email messages, and the MUA is
  > supposed to display this content in received email messages according
  > to user expectations, which generally follow how Org buffers display
  > text.

Thanks/ I had a feeling that it was something along roughtly those
lines, but I was not sure.  Now I know.

I am concerned that the actions described above would tend to embed
Org format and Org mode more deeply into Emacs usage.

Suppose A and B are Org users.  If A knows this, and mails B a message
which contains text labaled as text/org, that won't make anyone
unhappy.  No one would have a reason to complain.

But what if C mails a message to D with text labeled as text/org and D
is not an Org user?  Will that cause Emacs to load Org?  It should
not.

What will Gnus do when the user readss a message with text labaled as
text/org?  What will Rmail do?  What will MH-E do?

These are crucial questions because the answers would determine
whether this feature pressures people to use Org mode or not.  We need
concrete answers because only that would enable us to see cleary now
whether the feature would do that if in use.

Max Nikulin <manikulin <at> gmail.com> wrote:

    Received or fetched Org 
  > files must be treated with some precautions, but it is another story.

I was not aware of this issue.  Let's look at it concretely now so we
can determine what its implications are.  Have people already written
a list of these precautions?  If so, I'd like to see it.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Tue, 30 Jan 2024 12:11:02 GMT) Full text and rfc822 format available.

Message #46 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: rms <at> gnu.org
Cc: 68687 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, emacs-orgmode <at> gnu.org,
 manikulin <at> gmail.com, stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Tue, 30 Jan 2024 12:13:47 +0000
Richard Stallman <rms <at> gnu.org> writes:

> I am concerned that the actions described above would tend to embed
> Org format and Org mode more deeply into Emacs usage.
>
> Suppose A and B are Org users.  If A knows this, and mails B a message
> which contains text labaled as text/org, that won't make anyone
> unhappy.  No one would have a reason to complain.
>
> But what if C mails a message to D with text labeled as text/org and D
> is not an Org user?  Will that cause Emacs to load Org?  It should
> not.

> What will Gnus do when the user readss a message with text labaled as
> text/org?  What will Rmail do?  What will MH-E do?

It may or may not depending on user customization `mm-inline-media-tests'.
Just like with text/html, application/javascript, text/x-sh, images,
etc.

By default, for example, text/html gets rendered via shr.el (AFAIK). Do
you think that shr.el should not be loaded (in (require 'shr) sense)?

> These are crucial questions because the answers would determine
> whether this feature pressures people to use Org mode or not.  We need
> concrete answers because only that would enable us to see cleary now
> whether the feature would do that if in use.

Even when text/org is rendered using Org mode, there is nothing
pressuring people to use Org mode there. It is just visuals. Org major
mode is not activated.

Also, it is already what Emacs does for text/x-org. This patch is merely
asking to treat text/org as text/x-org is already treated.

> Max Nikulin <manikulin <at> gmail.com> wrote:
>
>     Received or fetched Org 
>   > files must be treated with some precautions, but it is another story.
>
> I was not aware of this issue.  Let's look at it concretely now so we
> can determine what its implications are.  Have people already written
> a list of these precautions?  If so, I'd like to see it.

Max is referring to various security issues with evaluating code inside
Org mode buffers. They are known, but not relevant to Org text being
displayed in email MUA - Org never evaluates any code automatically
without user explicitly asking for it. And in MUA, Org mode is simply
used to apply faces. No other interaction with the displayed text/org
mime part is allowed.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Tue, 30 Jan 2024 12:53:02 GMT) Full text and rfc822 format available.

Message #49 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rms <at> gnu.org
Cc: 68687 <at> debbugs.gnu.org, manikulin <at> gmail.com, emacs-orgmode <at> gnu.org,
 stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Tue, 30 Jan 2024 14:52:16 +0200
> From: Richard Stallman <rms <at> gnu.org>
> Cc: manikulin <at> gmail.com, 68687 <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org,
> 	stefankangas <at> gmail.com
> Date: Mon, 29 Jan 2024 22:56:58 -0500
> 
> I am concerned that the actions described above would tend to embed
> Org format and Org mode more deeply into Emacs usage.
> 
> Suppose A and B are Org users.  If A knows this, and mails B a message
> which contains text labaled as text/org, that won't make anyone
> unhappy.  No one would have a reason to complain.
> 
> But what if C mails a message to D with text labeled as text/org and D
> is not an Org user?  Will that cause Emacs to load Org?  It should
> not.
> 
> What will Gnus do when the user readss a message with text labaled as
> text/org?  What will Rmail do?  What will MH-E do?

This happens to me all the time (because our mailing lists are full of
such C's, and I'm one example of D), so I know what happens, at least
in Rmail: you see the text with Org markup uninterpreted, as plain
text.  Here's a random example:

  #+begin_src emacs-lisp
  (add-hook 'before-save-hook 'time-stamp)
  (require 'org-refile)
  (setq org-refile-use-cache t)
  (setq org-refile-use-outline-path t)
  (setq org-refile-targets '((nil :maxlevel . 5)))
  (setq org-goto-interface 'outline-path-completion)
  (setq large-file-warning-threshold 15000000)
  (find-file "foo.org")
  (org-refile-get-targets)
  #+end_src

With Org, the header and footer should be removed from display, and
the Lisp code should be displayed with lisp-mode fontifications.  What
I see is just plain text, including the pesky header and footer.

It isn't a catastrophe, IMO.

> These are crucial questions because the answers would determine
> whether this feature pressures people to use Org mode or not.  We need
> concrete answers because only that would enable us to see cleary now
> whether the feature would do that if in use.

In any case, we already have this in the wild, it just uses
Content-type that current standards frown on.  This proposal is just
to use a different, more standard-compliant Content-type.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Tue, 30 Jan 2024 17:14:02 GMT) Full text and rfc822 format available.

Message #52 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Mike Kupfer <kupfer <at> rawbw.com>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: rms <at> gnu.org, 68687 <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org,
 stefankangas <at> gmail.com, Eli Zaretskii <eliz <at> gnu.org>, manikulin <at> gmail.com
Subject: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media
 type)
Date: Tue, 30 Jan 2024 09:12:49 -0800
Ihor Radchenko wrote:

> Max is referring to various security issues with evaluating code inside
> Org mode buffers. They are known, but not relevant to Org text being
> displayed in email MUA - Org never evaluates any code automatically
> without user explicitly asking for it. And in MUA, Org mode is simply
> used to apply faces. No other interaction with the displayed text/org
> mime part is allowed.

I can believe that Org text snippets are safe in an email MUA.  

But in the general case, I don't think Org mode is quite as safe as you
implied.  The last I heard, conversion from Org mode to another format
(e.g., plain text or HTML) can result in code evaluation, without the
user authorizing it (see
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48676).  I would not
expect random users to understand that format conversion is a
potentially risky operation.

mike




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Tue, 30 Jan 2024 17:49:02 GMT) Full text and rfc822 format available.

Message #55 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Mike Kupfer <kupfer <at> rawbw.com>
Cc: rms <at> gnu.org, 68687 <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org,
 stefankangas <at> gmail.com, Eli Zaretskii <eliz <at> gnu.org>, manikulin <at> gmail.com
Subject: Re: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org
 media type)
Date: Tue, 30 Jan 2024 17:51:55 +0000
Mike Kupfer <kupfer <at> rawbw.com> writes:

> I can believe that Org text snippets are safe in an email MUA.  

That's exactly what I wanted to emphasize.

> But in the general case, I don't think Org mode is quite as safe as you
> implied.

I did not imply that Org mode is safe. I directly said that there are
security issues and that they are known.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Tue, 30 Jan 2024 19:40:03 GMT) Full text and rfc822 format available.

Message #58 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 68687 <at> debbugs.gnu.org, Max Nikulin <manikulin <at> gmail.com>,
 emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Tue, 30 Jan 2024 14:39:34 -0500
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> I see using text/org as an improvement. text/x-org is likely useless.
> At least,
> https://github.com/jeremy-compostella/org-msg/blob/master/org-msg.el
> uses text/org, which may appear in email parts.
>
> However, AFAIU, text/org will fall into "standards tree" in IANA media
> type specification, which means that it MUST be registered, as described
> in https://www.rfc-editor.org/rfc/rfc6838.html#section-3.1
>
> Registering text/org media type requires syntax spec. We are
> still working on format Org mode syntax specifications. See
> https://list.orgmode.org/orgmode/871rjhha8t.fsf <at> gmail.com/ and
> https://orgmode.org/worg/org-syntax.html
>
> The spec is still not fully finalized, so we are not yet initiating the
> registration, as we will need to repeat it again if we decide to make
> further changes (https://www.rfc-editor.org/rfc/rfc6838.html#section-5.5)

What does this mean with regards to the patch?  Should we wait with
installing it until that process is done?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Tue, 30 Jan 2024 20:32:01 GMT) Full text and rfc822 format available.

Message #61 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org, Max Nikulin <manikulin <at> gmail.com>,
 emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Tue, 30 Jan 2024 20:34:54 +0000
Stefan Kangas <stefankangas <at> gmail.com> writes:

> Ihor Radchenko <yantar92 <at> posteo.net> writes:
>
>> I see using text/org as an improvement. text/x-org is likely useless.
>> At least,
>> https://github.com/jeremy-compostella/org-msg/blob/master/org-msg.el
>> uses text/org, which may appear in email parts.
> ...
> What does this mean with regards to the patch?  Should we wait with
> installing it until that process is done?

I see no reason to wait.
We already have people sending text/org in emails. Recognizing mime
parts marked as text/org as we already do for text/x-org will be a
clear improvement.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Wed, 31 Jan 2024 16:19:02 GMT) Full text and rfc822 format available.

Message #64 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Max Nikulin <manikulin <at> gmail.com>
To: Ihor Radchenko <yantar92 <at> posteo.net>, rms <at> gnu.org
Cc: 68687 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, emacs-orgmode <at> gnu.org,
 stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Wed, 31 Jan 2024 23:18:10 +0700
On 30/01/2024 19:13, Ihor Radchenko wrote:
> Even when text/org is rendered using Org mode, there is nothing
> pressuring people to use Org mode there. It is just visuals. Org major
> mode is not activated.

I am not familiar with gnus & Co code, so I am confused by (funcall 
mode) in `mm-display-inline-fontify'. Doesn't it activate the major mode 
through `mm-display-org-inline'?

On the other hand, I am afraid, changing `mm-inline-media-tests' to use

("text/org" mm-inline-text identity)
("text/x-org" mm-inline-text identity)

by default instead of `mm-display-org-inline' for safety and to avoid 
loading of Org mode will cause a lot of complains from Org users.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Wed, 31 Jan 2024 16:30:02 GMT) Full text and rfc822 format available.

Message #67 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Max Nikulin <manikulin <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, emacs-orgmode <at> gnu.org,
 rms <at> gnu.org, stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Wed, 31 Jan 2024 16:32:22 +0000
Max Nikulin <manikulin <at> gmail.com> writes:

> On 30/01/2024 19:13, Ihor Radchenko wrote:
>> Even when text/org is rendered using Org mode, there is nothing
>> pressuring people to use Org mode there. It is just visuals. Org major
>> mode is not activated.
>
> I am not familiar with gnus & Co code, so I am confused by (funcall 
> mode) in `mm-display-inline-fontify'. Doesn't it activate the major mode 
> through `mm-display-org-inline'?

It creates temporary buffer, activates Org mode there, and copies back
the fontified text for display inside message.
I do not know about any security issues when one merely opens Org file
without actually executing Org mode commands.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Wed, 31 Jan 2024 16:32:01 GMT) Full text and rfc822 format available.

Message #70 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Max Nikulin <manikulin <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>
Cc: 68687 <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Wed, 31 Jan 2024 23:30:44 +0700
On 26/01/2024 14:23, Eli Zaretskii wrote:
>> Max Nikulin writes:
> 
>>> diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
>>> index 3c7e3cbdf1a..b10da0c143a 100644
>>> --- a/lisp/gnus/mm-uu.el
>>> +++ b/lisp/gnus/mm-uu.el
>>> @@ -394,7 +394,7 @@ (defun mm-uu-emacs-sources-extract ()
>>>
>>>   (defun mm-uu-org-src-code-block-extract ()
>>>     (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
>>> -		  '("text/x-org" (charset . gnus-decoded))))
>>> +		  '("text/org" (charset . gnus-decoded))))
>>>
>>>   (defvar gnus-newsgroup-name)
>>>
>>> diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
>>> index 5ff75deb4e6..900099433c4 100644
>>> --- a/lisp/net/mailcap.el
>>> +++ b/lisp/net/mailcap.el
>>> @@ -989,7 +989,8 @@ (defvar mailcap-mime-extensions
>>>       (".jpe"   . "image/jpeg")
>>>       (".jpeg"  . "image/jpeg")
>>>       (".webp"  . "image/webp")
>>> -    (".org"   . "text/x-org"))
>>> +    ;; May be overridden by application/vnd.lotus-organizer in /etc/mime.types.
>>> +    (".org"   . "text/org"))
> 
> I'm not sure the removal of text/x-org in these two hunks is a good
> idea: could it perhaps cause trouble to someone, e.g. if an email
> message is sent from Emacs with this change and read by Emacs without
> it?

Changing of `mm-display-org-inline' may be postponed. I am curious 
however if there are a lot of users overriding their /etc/mime.types to 
avoid application/vnd.lotus-organizer.

However I am unsure whether `mm-uu-org-src-code-block-extract' is used 
to send messages. If it purpose to decode received messages then the 
change should be safe. I had a hope to receive some comments from 
developers familiar with Emacs mail clients.

I have realized that I missed `mm-automatic-display' there "text/org" 
should be added similar to `mm-inline-media-tests'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Wed, 31 Jan 2024 20:01:01 GMT) Full text and rfc822 format available.

Message #73 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Max Nikulin <manikulin <at> gmail.com>, 68687 <at> debbugs.gnu.org
Cc: emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Wed, 31 Jan 2024 15:00:10 -0500
Max Nikulin <manikulin <at> gmail.com> writes:

> From 8b71393625f11590e99896808bbd04ed83f7917e Mon Sep 17 00:00:00 2001
> From: Max Nikulin <manikulin <at> gmail.com>
> Date: Wed, 24 Jan 2024 21:16:28 +0700
> Subject: [PATCH] Use text/org media type
>
> Avoid "x-" prefix deprecated by rfc6648 for Org mode media type.
> * lisp/net/mailcap.el (mailcap-mime-extensions):
> * lisp/gnus/mm-uu.el (mm-uu-org-src-code-block-extract): Replace
> text/x-org by text/org.
> * lisp/gnus/mm-decode.el (mm-inline-media-tests): Allow text/org in
> addition to text/x-org.
>
> Make media type defined for Org mode consistent with
> <https://gitlab.freedesktop.org/xdg/shared-mime-info>
>
> See emacs-orgmode: Org mode MIME type. Sun, 21 Jan 2024 20:56:15 +0700.
> https://list.orgmode.org/6d94fff4-4d30-4121-bfd1-f267cb5b637c <at> gmail.com
> ---
>  lisp/gnus/mm-decode.el | 1 +
>  lisp/gnus/mm-uu.el     | 2 +-
>  lisp/net/mailcap.el    | 3 ++-
>  3 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
> index f91755e967b..cae737e5a3e 100644
> --- a/lisp/gnus/mm-decode.el
> +++ b/lisp/gnus/mm-decode.el
> @@ -246,6 +246,7 @@ (defcustom mm-inline-media-tests
>      ("text/x-sh" mm-display-shell-script-inline identity)
>      ("application/javascript" mm-display-javascript-inline identity)
>      ("text/dns" mm-display-dns-inline identity)
> +    ("text/org" mm-display-org-inline identity)
>      ("text/x-org" mm-display-org-inline identity)
>      ("text/html"
>       mm-inline-text-html
> diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
> index 3c7e3cbdf1a..b10da0c143a 100644
> --- a/lisp/gnus/mm-uu.el
> +++ b/lisp/gnus/mm-uu.el
> @@ -394,7 +394,7 @@ (defun mm-uu-emacs-sources-extract ()
>
>  (defun mm-uu-org-src-code-block-extract ()
>    (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
> -		  '("text/x-org" (charset . gnus-decoded))))
> +		  '("text/org" (charset . gnus-decoded))))
>
>  (defvar gnus-newsgroup-name)
>
> diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
> index 5ff75deb4e6..900099433c4 100644
> --- a/lisp/net/mailcap.el
> +++ b/lisp/net/mailcap.el
> @@ -989,7 +989,8 @@ (defvar mailcap-mime-extensions
>      (".jpe"   . "image/jpeg")
>      (".jpeg"  . "image/jpeg")
>      (".webp"  . "image/webp")
> -    (".org"   . "text/x-org"))
> +    ;; May be overridden by application/vnd.lotus-organizer in /etc/mime.types.
> +    (".org"   . "text/org"))

It's been many moons since I last looked at email attachements in any
detail, so I have some questions.

With this patch, what happens if someone is emailing using an old
version of Emacs?  Does that matter, or is this stuff based only on the
file ending?  IOW, I'm asking if it is backwards-compatible to remove
"text/org", in either direction.  Will .org files be displayed in the
same way as before or not on both new and old versions?

I've noticed on my machine that .org files have been interpreted as
application/vnd.lotus-organizer.  Presumably that's due to some local
configuration in /etc/mime.types on my distro.  Is that correct?  Is it
documented somewhere how to override that system configuration in Emacs?

But thinking about this more, why not do that unconditionally for users?
Lotus Organizer is dead, long gone, and not really relevant to anyone,
certainly not to the overwhelming majority of Emacs users.  On the off
chance that someone is opening such files from Emacs, they could just
revert that locally.  WDYT?

>    "An alist of file extensions and corresponding MIME content-types.
>  This exists for you to customize the information in Lisp.  It is
>  merged with values from mailcap files by `mailcap-parse-mimetypes'.")
> --
> 2.39.2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Thu, 01 Feb 2024 10:41:02 GMT) Full text and rfc822 format available.

Message #76 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Max Nikulin <manikulin <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>, 68687 <at> debbugs.gnu.org
Cc: emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Thu, 1 Feb 2024 17:40:21 +0700
On 01/02/2024 03:00, Stefan Kangas wrote:
> Max Nikulin writes:
>> +++ b/lisp/net/mailcap.el
>> @@ -989,7 +989,8 @@ (defvar mailcap-mime-extensions
>>       (".jpe"   . "image/jpeg")
>>       (".jpeg"  . "image/jpeg")
>>       (".webp"  . "image/webp")
>> -    (".org"   . "text/x-org"))
>> +    ;; May be overridden by application/vnd.lotus-organizer in /etc/mime.types.
>> +    (".org"   . "text/org"))
> 
> With this patch, what happens if someone is emailing using an old
> version of Emacs?  Does that matter, or is this stuff based only on the
> file ending?

Org files are plain text files and have no specific signature that would 
allow tools like libmagic to unambiguously distinguish them from other 
text files. Rare files have explicit "# -*- mode: org-mode -*-" header. 
So there is no other way besides file name extensions when a message is 
composed or a file is served by a HTTP server. Clients should rely on 
the Content-Type header.

Old mailers will continue sending messages with 
application/vnd.lotus-organizer, text/x-org, or text/org media type.

> IOW, I'm asking if it is backwards-compatible to remove
> "text/org", in either direction.

I suggest to use text/org instead of text/x-org.

> Will .org files be displayed in the
> same way as before or not on both new and old versions?

I do not see a better way toward consistency in respect to the media type.

> I've noticed on my machine that .org files have been interpreted as
> application/vnd.lotus-organizer.

From my point of view, it is a reason to not bother concerning removing 
of "text/x-org" from `mailcap-mime-extensions'

> Presumably that's due to some local
> configuration in /etc/mime.types on my distro.  Is that correct?

There are 2 projects maintaining /etc/mime.types, they follows IANA 
registry, so have application/vnd.lotus-organizer. XDG shared-mime-info 
project (another media types DB, not /etc/mime.types) has text/org.

> Is it
> documented somewhere how to override that system configuration in Emacs?

Create ~/.mime.types. Debian's variant suggests it in the 
/etc/mime.types header.

> But thinking about this more, why not do that unconditionally for users?
> Lotus Organizer is dead, long gone, and not really relevant to anyone,
> certainly not to the overwhelming majority of Emacs users.

Ideally text/org should be registered in IANA, so all applications could 
use consistent mapping. Prerequisites have been discussed already.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 02 Feb 2024 03:39:02 GMT) Full text and rfc822 format available.

Message #79 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 68687 <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org, stefankangas <at> gmail.com,
 eliz <at> gnu.org, manikulin <at> gmail.com, kupfer <at> rawbw.com
Subject: Re: bug#68687: Org mode code evaluation (was: bug#68687: [PATCH] Use
 text/org media type)
Date: Thu, 01 Feb 2024 22:38:16 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > I did not imply that Org mode is safe. I directly said that there are
  > security issues and that they are known.

Could you plesae post a pointer to a desciption of them?
-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 02 Feb 2024 03:41:02 GMT) Full text and rfc822 format available.

Message #82 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 68687 <at> debbugs.gnu.org, eliz <at> gnu.org, emacs-orgmode <at> gnu.org,
 manikulin <at> gmail.com, stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Thu, 01 Feb 2024 22:40:06 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > It may or may not depending on user customization `mm-inline-media-tests'.
  > Just like with text/html, application/javascript, text/x-sh, images,
  > etc.

I looked at the definition of that option, and at the function
`mm-display-inline-fontify' that it calls.  That function is
nontrivial, so I can't tell, in a short time, what it does and doesn't
do.

  > Even when text/org is rendered using Org mode, there is nothing
  > pressuring people to use Org mode there. It is just visuals. Org major
  > mode is not activated.

That is one good thing.  Maybe that means it's fine.

But you've told me little about what things `mm-display-inline-fontify' does,
only that they do not include selecting Org mode.

Could you please tell me the main things it _does_ do?

  > Max is referring to various security issues with evaluating code inside
  > Org mode buffers. They are known, but not relevant to Org text being
  > displayed in email MUA - Org never evaluates any code automatically
  > without user explicitly asking for it.

I understand now.  I agree, that is not an issue for this specific point.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 02 Feb 2024 05:00:01 GMT) Full text and rfc822 format available.

Message #85 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Max Nikulin <manikulin <at> gmail.com>
To: rms <at> gnu.org, Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 68687 <at> debbugs.gnu.org, eliz <at> gnu.org, emacs-orgmode <at> gnu.org,
 kupfer <at> rawbw.com, stefankangas <at> gmail.com
Subject: Re: bug#68687: Org mode code evaluation
Date: Fri, 2 Feb 2024 11:58:44 +0700
On 02/02/2024 10:38, Richard Stallman wrote:
> 
>    > I did not imply that Org mode is safe. I directly said that there are
>    > security issues and that they are known.
> 
> Could you plesae post a pointer to a desciption of them?

I would strongly prefer to move discussion of Org security to a 
dedicated thread on emacs-orgmode or emacs-devel and leave this bug to 
media types used for Org.

Whenever the suggested patch committed (as a whole or in parts) or not, 
admit that Org mode is already used as media type handler for mail 
messages and downloaded files.

I have tried a couple more ideas, but have not managed to achieve code 
execution when files are loaded (assuming default or plausible user 
settings). If Org keystrokes are not active when mail messages are 
opened then it should be safe enough. (However I suspect an issue 
unrelated to code execution.) If Emacs or Org mode has severe issues 
then it is possible to exploit them even without the patch. Just send a 
message having 3 attachments covering all variants of Content-Type.

The point is to minimize discrepancy related to Org mode stuff within 
Emacs and outside of it. E.g. in default configuration Thunderbird on 
Debian 12 bookworm sends attachments as text/org. Emacs core uses 
text/x-org or application/vnd.lotus-organizer. With no action taken it 
will last further.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 02 Feb 2024 07:11:01 GMT) Full text and rfc822 format available.

Message #88 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Max Nikulin <manikulin <at> gmail.com>, 68687 <at> debbugs.gnu.org
Cc: emacs-orgmode <at> gnu.org
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Thu, 1 Feb 2024 23:09:42 -0800
Max Nikulin <manikulin <at> gmail.com> writes:

> On 01/02/2024 03:00, Stefan Kangas wrote:
>> Max Nikulin writes:
>>> +++ b/lisp/net/mailcap.el
>>> @@ -989,7 +989,8 @@ (defvar mailcap-mime-extensions
>>>       (".jpe"   . "image/jpeg")
>>>       (".jpeg"  . "image/jpeg")
>>>       (".webp"  . "image/webp")
>>> -    (".org"   . "text/x-org"))
>>> +    ;; May be overridden by application/vnd.lotus-organizer in /etc/mime.types.
>>> +    (".org"   . "text/org"))
>
> Org files are plain text files and have no specific signature that would
> allow tools like libmagic to unambiguously distinguish them from other
> text files. Rare files have explicit "# -*- mode: org-mode -*-" header.
> So there is no other way besides file name extensions when a message is
> composed or a file is served by a HTTP server. Clients should rely on
> the Content-Type header.

So old mailers will still use "Content-Type: text/x-org", and it is
therefore premature to remove that entry.

I'm not sure about the urgency in starting to send out "text/org" at
this stage.  It will just lead to old versions of Emacs displaying org
attachments incorrectly in more cases, I think?

So why not:

 1. Add support for _receiving_ "text/org" in Emacs 30
 2. Wait with _sending_ "text/org" until it is formally accepted by IANA

?

In Emacs <29, perhaps Org mode could update the relevant variables to
include "text/org", too?

>> Is it
>> documented somewhere how to override that system configuration in Emacs?
>
> Create ~/.mime.types. Debian's variant suggests it in the
> /etc/mime.types header.

Is that documented somewhere in our documentation?

>> But thinking about this more, why not do that unconditionally for users?
>> Lotus Organizer is dead, long gone, and not really relevant to anyone,
>> certainly not to the overwhelming majority of Emacs users.
>
> Ideally text/org should be registered in IANA, so all applications could
> use consistent mapping. Prerequisites have been discussed already.

Yes, that would be best.  While waiting for that to happen, why not do
what I proposed (override it unconditionally in Emacs)?  It should be
more useful for Emacs users, if nothing else.

Taking a step back, how sure are we that IANA will accept this?  Do they
typically accept taking over a previous designation?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 02 Feb 2024 07:16:02 GMT) Full text and rfc822 format available.

Message #91 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rms <at> gnu.org
Cc: 68687 <at> debbugs.gnu.org, yantar92 <at> posteo.net, emacs-orgmode <at> gnu.org,
 manikulin <at> gmail.com, stefankangas <at> gmail.com
Subject: Re: bug#68687: [PATCH] Use text/org media type
Date: Fri, 02 Feb 2024 09:15:18 +0200
> From: Richard Stallman <rms <at> gnu.org>
> Cc: eliz <at> gnu.org, manikulin <at> gmail.com, 68687 <at> debbugs.gnu.org,
> 	emacs-orgmode <at> gnu.org, stefankangas <at> gmail.com
> Date: Thu, 01 Feb 2024 22:40:06 -0500
> 
>   > It may or may not depending on user customization `mm-inline-media-tests'.
>   > Just like with text/html, application/javascript, text/x-sh, images,
>   > etc.
> 
> I looked at the definition of that option, and at the function
> `mm-display-inline-fontify' that it calls.  That function is
> nontrivial, so I can't tell, in a short time, what it does and doesn't
> do.

AFAIU, that function copies a portion of buffer text to a temporary
buffer, determines the correct major-mode for that text, then invokes
that major-mode and fontifies the text according to that mode, and
finally copies the fontified text back into the original buffer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68687; Package emacs. (Fri, 02 Feb 2024 16:29:02 GMT) Full text and rfc822 format available.

Message #94 received at 68687 <at> debbugs.gnu.org (full text, mbox):

From: Max Nikulin <manikulin <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>, 68687 <at> debbugs.gnu.org
Cc: emacs-orgmode <at> gnu.org
Subject: bug#68687: [PATCH v2] Use text/org media type
Date: Fri, 2 Feb 2024 23:28:17 +0700
[Message part 1 (text/plain, inline)]
I am sending an updated version of the patch, earlier I missed one 
occurrence of text/org.

I am leaving it up to you the decision concerning mailcap.el.

On 02/02/2024 14:09, Stefan Kangas wrote:
> So why not:
> 
>   1. Add support for _receiving_ "text/org" in Emacs 30
>   2. Wait with _sending_ "text/org" until it is formally accepted by IANA

I do not mind. I just do not see real reasons to do so taking into 
account applicaion/vnd.lotus-organizer in Emacs and text/org in XDG.

>> Create ~/.mime.types. Debian's variant suggests it in the
>> /etc/mime.types header.
> 
> Is that documented somewhere in our documentation?

Likely it is not. It is documented in man pages for various tools. In 
Emacs-27 mailcap.el was severely broken, so I do not expect detailed 
documentation.

> Yes, that would be best.  While waiting for that to happen, why not do
> what I proposed (override it unconditionally in Emacs)?  It should be
> more useful for Emacs users, if nothing else.

It has happened so that I has spent some time reading Python bug tracker 
concerning their mimetypes module. I suggest against doing it 
unconditionally. Give users controls what sources should be used and 
what priority each source should have (application internal mapping, 
system-wide configuration files, user configuration files, Windows 
registry, XDG files as possible future improvement). Inconsistencies are 
not uncommon, updates of the IANA registry are applied with different pace.

> Taking a step back, how sure are we that IANA will accept this?  Do they
> typically accept taking over a previous designation?

An alternative is to negotiate with maintainers of mime.types in RedHat 
and Debian. My first impression is that in the case of Debian it may 
take enough time before any reaction. I am unsure as well that IANA will 
agree to change media type for .org without approval from IBM.
[v2-0001-Use-text-org-media-type.patch (text/x-patch, attachment)]

This bug report was last modified 229 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.