summary refs log tree commit diff
path: root/pkgs/applications/misc/termite
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2017-12-19 14:19:46 -0600
committerJan Tojnar <jtojnar@gmail.com>2017-12-20 21:08:08 +0100
commitc433fef525225bb2d9080875413026ce8db6006c (patch)
tree2b7e020077f8222bf649749523c9a204c5346a7b /pkgs/applications/misc/termite
parent8e6d5639c3707b29b50e955061fdc36b7fe84916 (diff)
downloadnixpkgs-c433fef525225bb2d9080875413026ce8db6006c.tar
nixpkgs-c433fef525225bb2d9080875413026ce8db6006c.tar.gz
nixpkgs-c433fef525225bb2d9080875413026ce8db6006c.tar.bz2
nixpkgs-c433fef525225bb2d9080875413026ce8db6006c.tar.lz
nixpkgs-c433fef525225bb2d9080875413026ce8db6006c.tar.xz
nixpkgs-c433fef525225bb2d9080875413026ce8db6006c.tar.zst
nixpkgs-c433fef525225bb2d9080875413026ce8db6006c.zip
termite: Add patch to avoid matching trailing punctuation in URLs
Patch based on:
https://github.com/thestinger/termite/pull/516

While this might "break" some URL's in the wild,
in return this fixes matching of URL's in Nix code.
Without this patch the trailing semicolon is included as part of the
URL, which creates invalid URL's for nearly all meta.homepage values.
Diffstat (limited to 'pkgs/applications/misc/termite')
-rw-r--r--pkgs/applications/misc/termite/default.nix3
-rw-r--r--pkgs/applications/misc/termite/url_regexp_trailing.patch27
2 files changed, 30 insertions, 0 deletions
diff --git a/pkgs/applications/misc/termite/default.nix b/pkgs/applications/misc/termite/default.nix
index 474177d2ea4..46276bbb03f 100644
--- a/pkgs/applications/misc/termite/default.nix
+++ b/pkgs/applications/misc/termite/default.nix
@@ -13,6 +13,9 @@ let
       sha256 = "02cn70ygl93ghhkhs3xdxn5b1yadc255v3yp8cmhhyzsv5027hvj";
     };
 
+    # https://github.com/thestinger/termite/pull/516
+    patches = [ ./url_regexp_trailing.patch ];
+
     postPatch = "sed '1i#include <math.h>' -i termite.cc";
 
     makeFlags = [ "VERSION=v${version}" "PREFIX=" "DESTDIR=$(out)" ];
diff --git a/pkgs/applications/misc/termite/url_regexp_trailing.patch b/pkgs/applications/misc/termite/url_regexp_trailing.patch
new file mode 100644
index 00000000000..96deaa073d7
--- /dev/null
+++ b/pkgs/applications/misc/termite/url_regexp_trailing.patch
@@ -0,0 +1,27 @@
+Based on https://github.com/thestinger/termite/pull/516
+Modified to apply to v13
+
+From 65a454ffa8e681f3f14729cba7c42e1570a85e8a Mon Sep 17 00:00:00 2001
+From: Paul Baecher <pbaecher@gmail.com>
+Date: Thu, 7 Sep 2017 22:58:51 +0200
+Subject: [PATCH] Do not match punctuation at the end of URLs
+
+Punctuation at the end of URLs is most likely part of natural language
+or markup (for example in Markdown). Do not match it as part of the URL.
+---
+ url_regex.hh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/url_regex.hh b/url_regex.hh
+index 2ec6be8..3039b53 100644
+--- a/url_regex.hh
++++ b/url_regex.hh
+@@ -9,7 +9,7 @@
+ #define PORT            "(?:\\:[[:digit:]]{1,5})?"
+ #define SCHEME          "(?:[[:alpha:]][+-.[:alnum:]]*:)"
+ #define USERPASS        USERCHARS_CLASS "+(?:\\:" PASSCHARS_CLASS "+)?"
+-#define URLPATH         "(?:/[[:alnum:]\\Q-_.!~*'();/?:@&=+$,#%\\E]*)?"
++#define URLPATH         "(?:/[[:alnum:]\\Q-_.!~*'();/?:@&=+$,#%\\E]*(?<![\\Q.,:;()!?\\E]))?"
+ 
+ const char * const url_regex = SCHEME "//(?:" USERPASS "\\@)?" HOST PORT URLPATH;
+