[pkgng] case-sensitive search?

Matthew Seaman matthew at FreeBSD.org
Sat Jan 12 20:14:04 UTC 2013


On 12/01/2013 17:20, Chris Rees wrote:
> I've made a patch against pkgng HEAD, to add a -l option (just for pkg
> search currently) to use the SQL LIKE operator.  This allows for case
> insensitivity.  Perhaps it could just be default?
> 
> http://www.bayofrum.net/~crees/patches/pkgng-like.diff

I like the idea of being able to do case insensitive searches, and I'm
open to the suggestion that it should be the default for 'pkg search' or
'pkg info'[*] but...

'pkg info' needs to remain some sort of compatibility with pkg_info for
now, and as it is used in several places (bsd.ports.mk, portmaster,
portupgrade) any change to the default behaviour would have to be well
tested against those applications.

'pkg search' lets you match packages by rather more than just name or
origin, and I think the same sort of case sensitive / insensitive choice
should be supported there.

In which case, I'd be tempted to use 'LIKE' for all those matching
tasks, replacing the plain MATCH using '=' entirely.  Use the
case_sensitive_like pragma to toggle case sensitivity on or off as
required (https://www.sqlite.com/pragma.html#pragma_case_sensitive_like)
according to what options are supplied.  Would be good to have a
consistent option or options across all four of the querying commands,
which unfortunately rules out -l.  Perhaps -u for 'case sensitve' / -U
for 'case insensitive'?

This means users could use the '%' and '_' wildcards if they wished --
although having that, *and* globbing expressions *and* regexps is
perhaps going slightly OTT.

	Cheers,

	Matthew

[*] Case sensitive should remain the default for 'pkg query' or 'pkg
rquery' give those are intended more for scripting than interactive use.

-- 
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 268 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20130112/c220d0b6/attachment.sig>


More information about the freebsd-ports mailing list