[xdg-email] Percent encoding problems

Michael Bäuerle michael.baeuerle at stz-e.de
Wed Aug 20 06:46:03 PDT 2014


The reported version number is 1.0.2, the source package is named
1.1.0-rc1 for its toplevel directory.

The first thing is only a side note:
The 'xdg-email' script request '/bin/sh' as interpreter,
according to [1] it should do the comparison with "=" instead
of "==" to be portable.

The real problem is the handling of e-mail addresses:
If the address contains a '-', it is percent encoded (even if this is
not required). But if it contains a '?' this stay a literal '?' (what
is not allowed inside a "mailto:" URI according to [2]). 

The problem is that the '-' character is used literally inside a regex
bracket expression (where it has the meaning of a range, like in "a-z"),
look at [3] (Paragraph 7) for the syntax definition.
The resulting range spans over the '?' character and prevents its
percent encoding.

The suggested patches are attached. The '-' is escaped with a backslash.
Maybe the solution from [3] to put it at the beginning or the end is
cleaner but less obvious.
In [3] there is also a note that ranges are only guaranteed to work as
expected in the POSIX locale. Therefore the patch sets the locale to
POSIX before starting awk.


[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
[2] https://tools.ietf.org/html/rfc2368#section-2
[3]
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xdg-email.patch
URL: <http://lists.freedesktop.org/archives/xdg/attachments/20140820/5a0f2699/attachment.ksh>


More information about the xdg mailing list