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

Bug#121132: Regex vs glob for pinning (was Re: Bug#121132: [patch] Proposed regex pinning feature)



Josef Kufner wrote:

DG> So you can write, for example:
DG>   Package: /.*openoffice\.org.*/

JAK> I would like to have something like this instead:
JAK>   Package: openoffice.org-*

JAK> This is also similar to what seems to be available
JAK> for versions already (according to apt_preferences(5)):
JAK>   Pin: version 5.8*

JK> It would be nice to have both syntaxes. Perl regexp is
JK> powerful; shell-like wildcards are short and mostly sufficient.

I agree, but I wrote the patch the way I did for two reasons:

 - I wanted it working that afternoon
 - Apt already uses this regex engine for searching

It would be possible to write a globbing engine, or a glob-to-regex
translator, but that would be a more intrusive patch.  The places where
"*" already has meaning in Apt preferences are in fact neither - they're
just a way to say "all" or "prefix match" (so "Pin: version 5.8*" does
what you expect, but "Pin: version *sirius*" does nothing).

JK> When we have perl regexp support, it should be easy to add
JK> shell-like wildcards. Maybe just escape dots and other characters
JK> and replace "?" -> "." and "*" -> ".*".

I think if we're going to have globs, we should have fully-functioning
globbing such that the syntax means the same everywhere.  Perhaps
someone from the Apt team could comment on what feature set is actually
desirable.


Cheers


Duncan

-- 
Duncan Gibb - Technical Director
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk/ || t: +44 870 608 0063



Reply to: