Hi Helmut,

On Mi, 20 Jun 2012, Helmut Grohne wrote:
> It serves a purpose. The intended purpose is that users can add their
> own .cat files and have them included via update-catalog --update-super,

So I thought, but in one way or the other one has to check for validity.

> > * the dh_installcatalogs generated code is not policy conform, well not
> >   even anything debian related. The configure (postinst) part simply
> >   does
> >     rm -f /etc/sgml/openjade.cat
> >   without any action in preinst or so.
> >   If you do this, it means that changes to config files under /etc/sgml/
> >   are *not* preserved
> 
> As is explained in precisely that preinst, this only happens if we are
> upgrading from a version where the package catalog was not a conffile.

Ahh, that was in stable where I checked, there these files are not conffiles
but just hanging around. I see that now they are all proper conffiles,
sorry for the noise.

> I have no clue how ucf works. This is reason enough for me to try hard

Not needed as they are now proper conffiles. ucf in principle 
can register a file as conffile even if not shipped as is in the
deb. That is, if a file under /etc is created by the postinst, it can
be made into a conffile.

But no need here, all are already proper conffiles.

> Both approaches remove the ability to add further catalogs. This is a
> regression I do not want to introduce.

Agreed.

> > - ship for each of the affected *old* packages the md5sum of the resepctive
> >   config file
> 
> I do not have the computational resources to do this. Technically I
> would need all {pre,post}{inst,rm} that contains "sgml" or
> "update-catalog" of every package ever created.

Indeed, because they were not shipped as conffiles, buaahhhhhhahaha.
One would need to install a stable system in a chroot, install all
sgml related packages (how many there are? well all depending on sgml-base?)
and see what files finally turn up in /etc/sgml.

I see, loads of paiin, probably not worth it.

> Let me explain another approach suggested by Joachim Breitner:
> 
> Basically having any reference to a non-existent catalog breaks the sgml
> related tools. However this situation may be caused, it causes further
> breakage. So maybe we can check the package (or user) catalogs in
> /etc/sgml at trigger time. If a catalog references a file that does not
> exist, a warning can be printed and the catalog be skipped.
> 
> This approach might need an explicit trigger activation in postrm
> remove, because at this point the conffile is not removed. This needs to
> be evaluated. (Thanks to Joachim Breitner for his attention to detail.)
> 
> This solution has a number of advantages:
> 1) Changes required only apply to sgml-base (and no other packages).
> 2) Works with both packages built with old and new debhelper.
> 3) If a user adds a broken catalog file, and issues update-catalog
>    --update-super, she will see a message and can correct her changes.

Good solution, agreed, and easy to implement.

> The obvious disadvantage is that I have to write a partial parser (at

#
# parses one .cat file and returns a list of CATALOG files
sub parse_one_file {
  my $fn = shift;
  open(IN, "<$fn") || die "Cannot open $fn: $!";
  my @l = <IN>;
  close(IN) || warn "Cannot close $fn: $!";
  my @ret;
  for (@l) {
    if (m/^CATALOG\s+([^\s]*)\s*$/) {
      if (-r $1) {
        push @ret, $1;
      } else {
        printf STDERR "Catalogue file $1 referenced in $fn does not exist, 
skipping it!\n";
      }
    }
  }
  return @ret;
}

I tested it with this perl code:
foreach my $f (@ARGV) {
  print "Catalogues in $f:\n";
  my @cs = parse_one_file($f);
  for my $c (@cs) {
    print "==>$c...\n";
  }
}

and run perl foo.pl /etc/sgml/*.cat, and it told me the right files.

You might have to fix add more cases to the parser, I don't know
what else is allowed in these files.

Best wishes

Norbert
------------------------------------------------------------------------
Norbert Preining            preining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan                                 TeX Live & Debian Developer
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
Arthur hoped and prayed that there wasn't an afterlife.
Then he realised there was a contradiction there and merely
hoped that there wasn't an afterlife.
                 --- Arthur realising that he's in a certain death situation
                 --- with a supernova bomb that is shaped like a cricket ball.
                 --- Douglas Adams, The Hitchhikers Guide to the Galaxy



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to