Re: [Guillem Jover] Parsing of dpkg status file considered harmful
- To: debian-tex-maint@lists.debian.org
- Subject: Re: [Guillem Jover] Parsing of dpkg status file considered harmful
- From: Julian Gilbey <jdg@polya.uklinux.net>
- Date: Fri, 1 Jun 2007 11:59:40 +0100
- Message-id: <[🔎] 20070601105940.GA11578@burnside>
- In-reply-to: <20070531211139.GB6600@burnside>
- References: <87sl9e26ai.fsf@riesling.zuerich.kuesterei.ch> <87r6oyb7k6.fsf@florent.maison> <87wsyputc5.fsf@riesling.zuerich.kuesterei.ch> <87zm3klpqj.fsf@florent.maison> <20070531211139.GB6600@burnside>
On Thu, May 31, 2007 at 10:11:39PM +0100, Julian Gilbey wrote:
> On Thu, May 31, 2007 at 10:09:24PM +0200, Florent Rougon wrote:
> > Hi,
> >
> > Frank Küster <frank@debian.org> wrote:
> >
> > > Is there any particular reason why did you use the while loop?
> >
> > Yes.
> >
> > > Looking at the old code, I would have intuitively used
> > >
> > > md5sum=$(dpkg-query -W -f='${Conffiles}' $package | grep "$file[[:space:]]" | cut -f 3 -d ' ')
> >
> > This has the problem that $file is interpreted as a regexp; it isn't an
> > exact match (for example, the . preceding file extensions would match
> > any character). I replaced that with a [ $foo = $bla ] test precisely to
> > avoid this problem.
>
> OK, then, replace grep with perl -ne "/\\Q$file\\E\\s/ && print" or
> something like that.
>
> Julian
Or simpler still, something like: fgrep $(echo -e "$file \n$file\t")
(I haven't checked the quoting, sorry.)
Julian
Reply to: