[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#683847: unblock: sgml-base/1.26+nmu4



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
Control: block -1 by 683844

Dear release team,

Please

unblock sgml-base/1.26+nmu4

The version intends to fix all remaining RC bugs of sgml-base:

 #678902: sgml-base needs to Pre-Depend on dpkg 1.16.4
 #676717: sgml-base produces broken super catalog when packages are in
          "rc" state

The patch is the same as attached to the respective bug logs. The
pre-dependency has been discussed with -devel and deemed appropriate,
because the dpkg maintainers will not be able to provide the necessary
dpkg feature (since they failed to reply in a timely manner). The
intrusive part of parsing catalogs has been contributed and reviewed by
Jakub Wilk. The patch also removes some useless and annoying messages as
requested by Julien Cristau. 

The attached .debdiff is between wheezy and the not yet sponsored sid
version. The sponsorship bug #683844 blocks this bug.

Helmut
diff -Nru sgml-base-1.26+nmu3/debian/changelog sgml-base-1.26+nmu4/debian/changelog
--- sgml-base-1.26+nmu3/debian/changelog	2012-05-28 21:11:52.000000000 +0200
+++ sgml-base-1.26+nmu4/debian/changelog	2012-06-27 21:04:29.000000000 +0200
@@ -1,3 +1,16 @@
+sgml-base (1.26+nmu4) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * update-catalog --update-super ignores catalogs referencing non-existent
+    files. (Closes: #676717) Thanks to Jakub Wilk for contributing the parser.
+  * Remove warning about rebuilding packages as it may confuse users.
+  * Quieten update-catalog during trigger and postinst, to avoid warnings for
+    packages in "rc" state.
+  * Pre-Depend on dpkg >= 1.16.4 (Closes: #678902). Removed dependency on
+    dpkg >= 1.14.18. sgml-base highlights a bug in dpkg's trigger processing. 
+
+ -- Helmut Grohne <helmut@subdivi.de>  Thu, 21 Jun 2012 16:09:07 +0200
+
 sgml-base (1.26+nmu3) unstable; urgency=low
 
   * Non-maintainer upload.
diff -Nru sgml-base-1.26+nmu3/debian/control sgml-base-1.26+nmu4/debian/control
--- sgml-base-1.26+nmu3/debian/control	2012-05-28 13:58:23.000000000 +0200
+++ sgml-base-1.26+nmu4/debian/control	2012-06-27 20:38:49.000000000 +0200
@@ -11,7 +11,8 @@
 Priority: optional
 Architecture: all
 Conflicts: sgml-data (<= 0.02), sgmltools-2 (<= 2.0.2-4)
-Depends: ${perl:Depends}, dpkg (>= 1.14.18)
+Depends: ${perl:Depends}
+Pre-Depends: dpkg (>= 1.16.4)
 Suggests: sgml-base-doc
 Description: SGML infrastructure and SGML catalog file support
  This package creates the SGML infrastructure directories and provides
diff -Nru sgml-base-1.26+nmu3/debian/sgml-base.postinst sgml-base-1.26+nmu4/debian/sgml-base.postinst
--- sgml-base-1.26+nmu3/debian/sgml-base.postinst	2012-05-28 13:58:23.000000000 +0200
+++ sgml-base-1.26+nmu4/debian/sgml-base.postinst	2012-06-22 17:22:31.000000000 +0200
@@ -61,12 +61,12 @@
     fi
 
     ## ------------------------------------------------------------------
-    update-catalog --update-super
+    update-catalog --quiet --update-super
     ln -sf /var/lib/sgml-base/supercatalog /etc/sgml/catalog
 fi
 if [ "$1" = "triggered" ]
 then
-    update-catalog --update-super
+    update-catalog --quiet --update-super
 fi
 
 ## ---------------------------------------------------------------------- 
diff -Nru sgml-base-1.26+nmu3/tools/update-catalog sgml-base-1.26+nmu4/tools/update-catalog
--- sgml-base-1.26+nmu3/tools/update-catalog	2012-05-28 21:11:52.000000000 +0200
+++ sgml-base-1.26+nmu4/tools/update-catalog	2012-06-27 21:04:45.000000000 +0200
@@ -4,6 +4,7 @@
 ## ----------------------------------------------------------------------
 ## Copyright (c) 2001-2004 Ardo van Rangelrooij
 ## Copyright (c) 2012 Helmut Grohne
+## Copyright (c) 2012 Jakub Wilk
 ##
 ## This is free software; see the GNU General Public Licence version 2
 ## or later for copying conditions.  There is NO warranty.
@@ -138,8 +139,6 @@
         print "Invocation of dpkg-trigger failed with status $?.\n";
         print "Forcing update of the super catalog...\n";
         &update_super;
-    } else {
-        print "update-catalog: Please rebuild the package being set up with a version of debhelper fixing #477751.\n";
     }
 }
 elsif ( $add )
@@ -240,17 +239,71 @@
 }
 
 ## ----------------------------------------------------------------------
+# Reference: https://www.oasis-open.org/specs/a401.htm
+sub check_catalog($)
+{
+    my($catalog)=shift;
+    my $base = $catalog;
+    $base =~ s,/[^/]+$,,;
+    my $catalog_tokens = qr{
+        ( (?: \s+ | -- .*? --)+ # whitespace and comments
+        | ' .*? ' | " .*? " # literal
+        | \S+ # other tokens
+        )
+        }sx;
+    unless(open(PKGCAT, "<", $catalog)) {
+        print "Warning: Ignoring unreadable catalog file `$catalog'.\n"
+            unless $quiet;
+        return 0;
+    };
+    local $/;
+    my $contents = <PKGCAT>;
+    close PKGCAT;
+    my $prevtoken = 0;
+    while ($contents =~ m/$catalog_tokens/g) {
+        my $token = $1;
+        if ($prevtoken) {
+            next if $token =~ m/^\s|^--/;
+            $token =~ s/^(['"])(.*)\1$/$2/;
+            if($prevtoken eq 'base') {
+                $base = $token;
+            } elsif($prevtoken eq 'catalog') {
+                my $path;
+                if($token =~ m,^/,) {
+                    $path = $token;
+                } else {
+                    $path = "$base/$token";
+                }
+                if(not -f $path) {
+                    print "Warning ignoring catalog `$catalog' which references non-existent catalogs. See man update-catalog for details.\n"
+                        unless $quiet;
+                    return 0;
+                }
+            }
+            $prevtoken = 0;
+        } elsif ("\L$token" eq 'catalog') {
+            $prevtoken = 'catalog';
+        } elsif ("\L$token" eq 'base') {
+            $prevtoken = 'base';
+        }
+    }
+    return 1;
+}
+## ----------------------------------------------------------------------
 sub update_super
 {
     my(@cats);
     my($catdir)="/etc/sgml";
     my($supercat)="/var/lib/sgml-base/supercatalog";
+    my $catfile;
     opendir(CATDIR, $catdir)
         or die "cannot open catalog directory $catdir: $!";
     while( readdir CATDIR )
     {
         m/^[^.].*\.cat$/ or next;
-        push(@cats, $catdir . "/" . $_);
+        $catfile = $catdir . "/" . $_;
+        check_catalog($catfile) or next;
+        push(@cats, $catfile);
     }
     closedir(CATDIR)
         or die "cannot close catalog directory $catdir: $!";
diff -Nru sgml-base-1.26+nmu3/tools/update-catalog.8 sgml-base-1.26+nmu4/tools/update-catalog.8
--- sgml-base-1.26+nmu3/tools/update-catalog.8	2012-05-28 13:58:23.000000000 +0200
+++ sgml-base-1.26+nmu4/tools/update-catalog.8	2012-06-27 21:07:21.000000000 +0200
@@ -45,6 +45,9 @@
 extension or remove (or move) existing centralized catalogs and regenerate the super catalog using the
 .B --update-super
 option.
+See section
+.B SUPER CATALOG
+for details on the generation process.
 .\"
 .\" ----------------------------------------------------------------------
 .SH OPTIONS
@@ -64,10 +67,10 @@
 .B --update-super
 Regenerates the SGML super catalog from the contents of the
 .IR /etc/sgml
-directory including all files having a
-.B .cat
-extension.
-Files ending in .disabled or .old for instance are not considered.
+directory.
+See section
+.B SUPER CATALOG
+for details on the super catalog generation.
 .TP
 .B --quiet
 Prevents the usual diagnostic output.
@@ -83,6 +86,26 @@
 Display the usage information and exits.
 .\"
 .\" ----------------------------------------------------------------------
+.SH SUPER CATALOG
+The super-catalog located in
+.IR /etc/sgml/catalog
+cannot be directly modified.
+It is generated by the
+.IR update-catalog
+.IR --update-super
+command.
+The generation considers files in the
+.IR /etc/sgml
+directory that have a
+.B .cat
+extension.
+For instance files ending in .old or .disabled are not considered.
+Before adding a catalog to the super catalog it is parsed and verified in order to not corrupt the super catalog.
+All referenced catalogs are verified to actually exist.
+If the check fails, a message is printed and the complete catalog is ignored.
+This check ensures that a catalog from a package, which is removed but not purged, is removed from the super catalog.
+.\"
+.\" ----------------------------------------------------------------------
 .SH AUTHOR
 Ardo van Rangelrooij <ardo@debian.org>
 .\"

Reply to: