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

Re: lib/fields.c:f_dependency() skips spaces in versions



Adam Heath writes ("lib/fields.c:f_dependency() skips spaces in versions"):
> I believe I have discovered a flaw in dpkg's version parsing functions.  If a
> space exists in the version, dpkg will skip over it.  Ie, it will convert
> '1.2 3.4' to '1.23.4', which I believe is wrong.  It should throw a parseerr.
> Please see the following code snippet:
> 
> void f_dependency(struct pkginfo *pigp, struct pkginfoperfile *pifp,
> ....
>         varbufreset(&version);
> ...
>         while (*p && *p != ')' && *p != '(') {
>           if (!isspace(*p)) varbufaddc(&version,*p);
>           p++;
>         }
> ...
> 
> It is my opinion(and Wichert's, we talked on irc), that it should give a
> parseerr, when a space is inside a version, instead of just silently eating
> it.
> 
> Ian, is this hypothesis correct?  If so, is this a valid bug, or was
> this done on purpose?  If on purpose, why?

I think you're right, it's a mistake.

Ian.



Reply to: