Debian Bug report logs - #628886
PTS: strip whitespace from pre-redirection URLs

Package: qa.debian.org; Maintainer for qa.debian.org is debian-qa@lists.debian.org;

Reported by: Paul Wise <pabs@debian.org>

Date: Thu, 2 Jun 2011 06:00:02 UTC

Severity: wishlist

Tags: patch

Done: Raphael Hertzog <hertzog@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

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


Report forwarded to debian-bugs-dist@lists.debian.org, debian-qa@lists.debian.org:
Bug#628886; Package qa.debian.org. (Thu, 02 Jun 2011 06:00:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Wise <pabs@debian.org>:
New Bug report received and forwarded. Copy sent to debian-qa@lists.debian.org. (Thu, 02 Jun 2011 06:00:05 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Paul Wise <pabs@debian.org>
To: bts <submit@bugs.debian.org>
Subject: PTS: strip whitespace from pre-redirection URLs
Date: Thu, 02 Jun 2011 13:56:25 +0800
[Message part 1 (text/plain, inline)]
Package: qa.debian.org
Severity: wishlist
User: debian-qa@lists.debian.org
Usertags: pts
Tags: patch

Please apply the below patch to the PTS apache configuration to strip
whitespace from input URLs before performing the redirects. This is
useful when copy and pasting package names and accidentally including
extra whitespace.

--- a/apache.conf
+++ b/apache.conf
@@ -15,11 +15,11 @@
 RewriteEngine on
 RewriteRule ^/$ /common/index.html [L,R]
 RewriteRule ^/favicon\.ico$ http://www.debian.org/favicon.ico [L,R]
-RewriteRule ^/lib([^/])([^/]+)$ /lib$1/lib$1$2.html [L,R]
-RewriteRule ^/([^/])([^/]+)$ /$1/$1$2.html [L,R]
-RewriteCond %{QUERY_STRING} ^src=lib(.)(.+)$
+RewriteRule ^/\s*lib([^/])([^/]+)\s*$ /lib$1/lib$1$2.html [L,R]
+RewriteRule ^/\s*([^/])([^/]+)\s*$ /$1/$1$2.html [L,R]
+RewriteCond %{QUERY_STRING} ^src=\s*lib(.)(.+)\s*$
 RewriteRule ^/common/index.html$ /lib%1/lib%1%2.html? [L,R,NE]
-RewriteCond %{QUERY_STRING} ^src=(.)(.+)$
+RewriteCond %{QUERY_STRING} ^src=\s*(.)(.+)\s*$
 RewriteRule ^/common/index.html$ /%1/%1%2.html? [L,R,NE]
 </VirtualHost>
 

-- 
bye,
pabs

http://wiki.debian.org/PaulWise
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, debian-qa@lists.debian.org:
Bug#628886; Package qa.debian.org. (Fri, 03 Jun 2011 13:33:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Raphael Hertzog <hertzog@debian.org>:
Extra info received and forwarded to list. Copy sent to debian-qa@lists.debian.org. (Fri, 03 Jun 2011 13:33:07 GMT) Full text and rfc822 format available.

Message #10 received at 628886@bugs.debian.org (full text, mbox):

From: Raphael Hertzog <hertzog@debian.org>
To: Paul Wise <pabs@debian.org>, 628886@bugs.debian.org
Subject: Re: Bug#628886: PTS: strip whitespace from pre-redirection URLs
Date: Fri, 3 Jun 2011 15:28:26 +0200
Hi,

On Thu, 02 Jun 2011, Paul Wise wrote:
> Please apply the below patch to the PTS apache configuration to strip
> whitespace from input URLs before performing the redirects. This is
> useful when copy and pasting package names and accidentally including
> extra whitespace.
> 
> --- a/apache.conf
> +++ b/apache.conf
> @@ -15,11 +15,11 @@
>  RewriteEngine on
>  RewriteRule ^/$ /common/index.html [L,R]
>  RewriteRule ^/favicon\.ico$ http://www.debian.org/favicon.ico [L,R]
> -RewriteRule ^/lib([^/])([^/]+)$ /lib$1/lib$1$2.html [L,R]
> -RewriteRule ^/([^/])([^/]+)$ /$1/$1$2.html [L,R]
> -RewriteCond %{QUERY_STRING} ^src=lib(.)(.+)$
> +RewriteRule ^/\s*lib([^/])([^/]+)\s*$ /lib$1/lib$1$2.html [L,R]
> +RewriteRule ^/\s*([^/])([^/]+)\s*$ /$1/$1$2.html [L,R]
> +RewriteCond %{QUERY_STRING} ^src=\s*lib(.)(.+)\s*$
>  RewriteRule ^/common/index.html$ /lib%1/lib%1%2.html? [L,R,NE]
> -RewriteCond %{QUERY_STRING} ^src=(.)(.+)$
> +RewriteCond %{QUERY_STRING} ^src=\s*(.)(.+)\s*$
>  RewriteRule ^/common/index.html$ /%1/%1%2.html? [L,R,NE]
>  </VirtualHost>

This patch does not strip trailing whitespaces. The [^/]+ or .+ are greedy
and will eat the whitespaces. Thus \s*$ will always match the empty
string.

Please update your patch.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
                      ▶ http://RaphaelHertzog.fr (Français)




Information forwarded to debian-bugs-dist@lists.debian.org, debian-qa@lists.debian.org:
Bug#628886; Package qa.debian.org. (Fri, 03 Jun 2011 13:57:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Wise <pabs@debian.org>:
Extra info received and forwarded to list. Copy sent to debian-qa@lists.debian.org. (Fri, 03 Jun 2011 13:57:05 GMT) Full text and rfc822 format available.

Message #15 received at 628886@bugs.debian.org (full text, mbox):

From: Paul Wise <pabs@debian.org>
To: 628886@bugs.debian.org
Subject: Re: Bug#628886: PTS: strip whitespace from pre-redirection URLs
Date: Fri, 03 Jun 2011 21:53:43 +0800
[Message part 1 (text/plain, inline)]
On Fri, 2011-06-03 at 15:28 +0200, Raphael Hertzog wrote:

> This patch does not strip trailing whitespaces. The [^/]+ or .+ are greedy
> and will eat the whitespaces. Thus \s*$ will always match the empty
> string. Please update your patch.

Ah, thanks, updated patch below:

--- a/apache.conf
+++ b/apache.conf
@@ -15,11 +15,11 @@
 RewriteEngine on
 RewriteRule ^/$ /common/index.html [L,R]
 RewriteRule ^/favicon\.ico$ http://www.debian.org/favicon.ico [L,R]
-RewriteRule ^/lib([^/])([^/]+)$ /lib$1/lib$1$2.html [L,R]
-RewriteRule ^/([^/])([^/]+)$ /$1/$1$2.html [L,R]
-RewriteCond %{QUERY_STRING} ^src=lib(.)(.+)$
+RewriteRule ^/\s*lib([^/\s])([^/\s]+)\s*$ /lib$1/lib$1$2.html [L,R]
+RewriteRule ^/\s*([^/\s])([^/\s]+)\s*$ /$1/$1$2.html [L,R]
+RewriteCond %{QUERY_STRING} ^src=\s*lib([^\s])([^\s]+)\s*$
 RewriteRule ^/common/index.html$ /lib%1/lib%1%2.html? [L,R,NE]
-RewriteCond %{QUERY_STRING} ^src=(.)(.+)$
+RewriteCond %{QUERY_STRING} ^src=\s*([\s])([\s]+)\s*$
 RewriteRule ^/common/index.html$ /%1/%1%2.html? [L,R,NE]
 </VirtualHost>

-- 
bye,
pabs

http://wiki.debian.org/PaulWise
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, debian-qa@lists.debian.org:
Bug#628886; Package qa.debian.org. (Fri, 03 Jun 2011 13:57:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Wise <pabs@debian.org>:
Extra info received and forwarded to list. Copy sent to debian-qa@lists.debian.org. (Fri, 03 Jun 2011 13:57:07 GMT) Full text and rfc822 format available.

Message #20 received at 628886@bugs.debian.org (full text, mbox):

From: Paul Wise <pabs@debian.org>
To: 628886@bugs.debian.org
Subject: Re: Bug#628886: PTS: strip whitespace from pre-redirection URLs
Date: Fri, 03 Jun 2011 21:55:53 +0800
[Message part 1 (text/plain, inline)]
On Fri, 2011-06-03 at 21:53 +0800, Paul Wise wrote:

> Ah, thanks, updated patch below:

Bah, had some typos, fixed:

--- a/apache.conf
+++ b/apache.conf
@@ -15,11 +15,11 @@
 RewriteEngine on
 RewriteRule ^/$ /common/index.html [L,R]
 RewriteRule ^/favicon\.ico$ http://www.debian.org/favicon.ico [L,R]
-RewriteRule ^/lib([^/])([^/]+)$ /lib$1/lib$1$2.html [L,R]
-RewriteRule ^/([^/])([^/]+)$ /$1/$1$2.html [L,R]
-RewriteCond %{QUERY_STRING} ^src=lib(.)(.+)$
+RewriteRule ^/\s*lib([^/\s])([^/\s]+)\s*$ /lib$1/lib$1$2.html [L,R]
+RewriteRule ^/\s*([^/\s])([^/\s]+)\s*$ /$1/$1$2.html [L,R]
+RewriteCond %{QUERY_STRING} ^src=\s*lib([^\s])([^\s]+)\s*$
 RewriteRule ^/common/index.html$ /lib%1/lib%1%2.html? [L,R,NE]
-RewriteCond %{QUERY_STRING} ^src=(.)(.+)$
+RewriteCond %{QUERY_STRING} ^src=\s*([^\s])([^\s]+)\s*$
 RewriteRule ^/common/index.html$ /%1/%1%2.html? [L,R,NE]
 </VirtualHost>
 

-- 
bye,
pabs

http://wiki.debian.org/PaulWise
[signature.asc (application/pgp-signature, inline)]

Reply sent to Raphael Hertzog <hertzog@debian.org>:
You have taken responsibility. (Fri, 03 Jun 2011 16:15:04 GMT) Full text and rfc822 format available.

Notification sent to Paul Wise <pabs@debian.org>:
Bug acknowledged by developer. (Fri, 03 Jun 2011 16:15:04 GMT) Full text and rfc822 format available.

Message #25 received at 628886-done@bugs.debian.org (full text, mbox):

From: Raphael Hertzog <hertzog@debian.org>
To: Paul Wise <pabs@debian.org>, 628886-done@bugs.debian.org
Subject: Re: Bug#628886: PTS: strip whitespace from pre-redirection URLs
Date: Fri, 3 Jun 2011 18:10:17 +0200
On Fri, 03 Jun 2011, Paul Wise wrote:
> Bah, had some typos, fixed:

Thanks, applied, will be live next time apache is reloaded.

That said usually "[^\s]" is written as "\S". I supposed it
would work here to but I kept the tested syntax you gave me.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
                      ▶ http://RaphaelHertzog.fr (Français)




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 02 Jul 2011 07:42:46 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 19:13:41 2014; Machine Name: beach.debian.org

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