Dear Michael,

> > Le Sat, Jan 25, 2020 at 09:06:43AM +0100, Michael Van Canneyt a écrit :
> > > 
> > > Please consider changing the registration of text/x-pascal to
> > > 
> > > text/x-pascal                                   p pas pp

> On Tue, 28 Jan 2020, Charles Plessy wrote:
> > 
> > I can do this, but would you consider registering an official media type to 
> > the IANA ?
> > 
> > https://www.iana.org/form/media-types

Le Tue, Jan 28, 2020 at 04:30:35PM +0100, Michael Van Canneyt a écrit :
> 
> But I found no way to get x-pascal modified: the only possibilities were
> registering vnd.freepascal or so or text/pascal.

Indeed, the "x-" prefix is in general deprecated
(https://tools.ietf.org/html/rfc6648).

Note that there is nothing wrong with the vendor tree in principle.  If
freepascal would produce or use files in a format that is not found in
other implementations, that would be a good way to go. And this does not
prevent its use by others.  But if most Pascal implementations use the
same file formats with the same suffixes, then text/pascal would make
sense.

> I would think that text/pascal is an option, although maybe
> application/pascal (seeing that application/json exists) will be accepted
> easier.

I think that application/pascal would only be more meaningful than
text/pascal if the contents were meant to be executed on the fly, like
application/javascript, or if they were formatted in a way where the
main goal is to help freepascal to process the file, while readability
by human being with other tools (text editors, etc.) would be secondary.
In conclusion, I think that text/pascal would be more suitable.

> Also I'm not sure how the existing x-pascal and a vnd.pascal will cooperate
> if they register the same extension. (.pas, .pp, .inc are all valid
> extensions for the freepascal compiler.)

In principle, if you register text/pascal for instance, you can declare
text/x-pascal as a deprecated alias, but in practice, this media type is
not going to dissapear anytime soon.

Nevertheless, it is not likely to cause problems, except perhaps if it
pascal source code has to send it over HTTP to a remote application or
in similar contexts where the contents are not going to be loaded from a
file that has a name with an  extension.  In that case, if the remote
application is old and the server is more recent, it may sent a
content-type text/pascal to an application that would only accept
text/x-pascal.  But from what I understand about Pascal, this is not
likely to happen.

Altogether, it seems to me that what you want is that users who have
files that contain Pascal source code can be hinted by their desktop
environment or their operating system  about 1) the nature of the files
and 2) which programs can open them.

For 1) there are the file suffixes, which are only good enough as long
as nobody else start to use them concurrently for different purposes,
and databases of file signatures (think !#/bin/sh).  If Pascal source
code files have such a signature, a properly declared media type may
help the world to be aware of it, but it is not strictly necessary.  In
any case, co-existence of text/pascal and text/x-pascal would not be
problematic.

For 2) the main issue is to decide which choices go on top of the list,
and in Linux this is mainly a question of integration, user
configuration, or last-installed-at-the-top in the worst case
scenario...  Typically, if Free Pascal would prefer text/pascal over
text/x-pascal, then at installation time it would declare to the OS that
text/pascal exists, that file extensions .p .pas and .pp pertain to it,
and which program is able to open them in a meaningful way.  (Note that
on modern destkotp systems, /etc/mime.types is not the main source of
information anyway...).

> I assume you have more knowledge about this than I do, so any advice
> you have on this is welcome !

I think that registering a proper media type can be an interesting
experience.  When I registered the application/vnd.debian.binary-package
type for Debian, I actually learned a lot when I collected insights
about security.

https://www.iana.org/assignments/media-types/application/vnd.debian.binary-package

In the case of Pascal as well, it can be useful to document security
considerations.  For instance, if freepascal is given source files that
the operating system has identified as text/x-pascal, to what extent
will it trust this information?  Will it take them blindly without
checking for non-text characters purposed for crashing the program ?

Another useful point to document in the declaration of the media type
is how character encoding is handled.  Does Freepascal accept Unicode,
or only ASCII, etc. ?

Well, this mail is getting long and I have to go.  I hope you found it
useful.  Sorry for not proofreading myself, but I just exhausted my
one-hour-of-free-time-on-Saturday.  Please feel free to collect other
point of views (I would be interested to hear about them), and let me
know what you think.

Have a nice week-end,

Charles

-- 
Charles Plessy
Akano, Uruma, Okinawa, Japan

Reply via email to