Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Dec 2004 09:35:30 +0100
From:      Jozef Matula <Jozef.Matula@iblsoft.com>
To:        FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>, James Bromberger <jeb@debian.org>
Subject:   BUGREPORT: Tab to space expanding bug
Message-ID:  <200412080935.30700.Jozef.Matula@iblsoft.com>

next in thread | raw e-mail | index | archive | help
Hello,

We use CVSweb version 3:3.0.2-2 under Debian Linux unstable distribution.

We found a bug in algorithm of expanding tabs into spaces in main CGI Perl 
script:
  - $1 was not in expansiong so, after multiple tab expansions text before 
tabs was discarded
  - expanding with less than $ts spaces was also incorrect, because $1 as (.*) 
was matching longest string, including any previous NOT EXPANDED tabs.

I think, this patch is fixing it.

--- cvsweb      2004-11-17 02:23:53.000000000 +0100
+++ /usr/lib/cgi-bin/cvsweb     2004-12-08 09:22:33.000000000 +0100
@@ -1579,7 +1579,7 @@
   if (defined($ts)) {

     # Expand tabs
-    1 while s/(.*)(\t+)/' ' x (length($2) * $ts - length($1) % $ts)/e;
+       1 while s/(.*?)(\t+)/$1 . ' ' x (length($2) * $ts - length($1) % 
$ts)/e;
   }

   # replace <tab> and <space> (\001 is to protect us from htmlify)

Best regards,

Jozef Matula

-- 
Jozef MATULA (Jozef.Matula@iblsoft.com)
IBL Software Engineering, http://www.iblsoft.com  
Mierova 103, 82105 Bratislava, Slovakia
Tel: +421-2-43427227, fax: +421-2-43427214



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412080935.30700.Jozef.Matula>