Package: debhelper
Version: 5.0.40a
Severity: important
Tags: patch

As detailed in Bug 337215, the patch to dh_installinfo
(autoscript/postinst-info, actually) has introduced an even worse situation:
new packages being built with dh_installinfo are corrupting the dir file by
introducing a new section each time a package is installed.  For instance, I
have 25 packages installed on my system which use the \Q....\E markers in their
--section strings.  Manual intervention is required to rearrange the dir files.

Attached is a patch to revert the previous patch and escape the '+' characters
in the section regex.  I believe this is the only special character in extended
regex which isn't disallowed in filenames.

While I was in there, I fixed another problem: the regex IMO should match only
the beginning of an existing section name string.  Right now, it matches 
anywhere, so an entry intended for the section "Programming" gets added to
"GNU programming tools".  I prepended a '^' to fix that.

-- System Information:
Debian Release: testing/unstable
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.4.21-kbk
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages debhelper depends on:
ii  binutils                      2.17-3     The GNU assembler, linker and bina
ii  coreutils                     5.97-5.1   The GNU core utilities
ii  dpkg-dev                      1.13.24    package building tools for Debian
ii  file                          4.17-4     Determines file type using "magic"
ii  html2text                     1.3.2a-3   An advanced HTML to text converter
ii  perl                          5.8.8-6.1  Larry Wall's Practical Extraction 
ii  po-debconf                    1.0.7      manage translated Debconf template

debhelper recommends no packages.

-- no debconf information
--- dh_installinfo.original     2006-06-02 14:04:02.000000000 -0400
+++ dh_installinfo      2006-10-26 15:00:24.000000000 -0400
@@ -92,6 +92,7 @@
                if ($file !~ /-\d+$/ && ! $dh{NOSCRIPTS}) {
                        # Figure out what section this file goes in.
                        my $section='';
+                       my $section_rx='';
                        open (IN, "<$file") || die "$file: $!";
                        while (<IN>) {
                                if (/INFO-DIR-SECTION\s+(.*)/) {
@@ -107,8 +108,10 @@
                                $section=~s:/:\\/:g; # allow / in section.
                                $section=~s/\&/\\&/g; # escape sed specials
                                $section=~s/(\\[0-9])/\\\\$1/g; # more sed 
specials
+                               $section_rx = "^" . $section; # align to start
+                               $section_rx=~s/\+/\\\\+/g; # allow + in regex
                                autoscript($package,"postinst","postinst-info",
-                                       "s/#SECTION#/$section/g;s:#FILE#:$fn:");
+                                       
"s/#SECTION_RX#/$section_rx/g;s/#SECTION#/$section/g;s:#FILE#:$fn:");
                        }
                        else {
                                
autoscript($package,"postinst","postinst-info-nosection",
--- autoscripts/postinst-info.original  2006-03-12 23:36:53.000000000 -0500
+++ autoscripts/postinst-info   2006-10-26 13:42:23.000000000 -0400
@@ -1,3 +1,3 @@
 if [ "$1" = "configure" ]; then
-       install-info --quiet --section "\Q#SECTION#\E" "#SECTION#" #FILE#
+       install-info --quiet --section "#SECTION_RX#" "#SECTION#" #FILE#
 fi

Reply via email to