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
--- xdg-email   2011-01-01 11:03:14.000000000 +0100
+++ xdg-email.new       2014-08-20 15:11:22.000000000 +0200
@@ -360,7 +360,7 @@
     elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
     elif `dbus-send --print-reply --dest=org.freedesktop.DBus 
/org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner 
string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
     elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' 
>/dev/null 2>&1; then DE=xfce;
-    elif [ x"$DESKTOP_SESSION" == x"LXDE" ]; then DE=lxde;
+    elif [ x"$DESKTOP_SESSION" = x"LXDE" ]; then DE=lxde;
     else DE=""
     fi
 }
@@ -533,7 +533,7 @@
 
 url_encode()
 {
-result=$(echo "$1" | $utf8 | awk '
+result=$(echo "$1" | $utf8 | LC_ALL=POSIX awk '
     BEGIN {
         for ( i=1; i<=255; ++i ) ord [ sprintf ("%c", i) "" ] = i + 0
         e = ""
@@ -547,7 +547,7 @@
             c = substr ($0, i, 1)
             if ( ord [c] > 127 ) {
                 e = e "%" sprintf("%02X", ord [c])
-            } else if ( c ~ /[@a-zA-Z0-9.-\\\/]/ ) {
+            } else if ( c ~ /[@a-zA-Z0-9.\-\\\/]/ ) {
                 e = e c
             } else {
                 e = e "%" sprintf("%02X", ord [c])
_______________________________________________
xdg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to