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

Bug#881047: libapt-pkg5.0: for apt_preferences, glob and regexp are buggy on the colon character ":"



Control: severity -1 minor

On Tue, Nov 07, 2017 at 01:09:54PM +0100, Vincent Lefevre wrote:
> Package: libapt-pkg5.0
> Version: 1.6~alpha4
> Severity: normal
> 
> I have both libfreetype6:amd64 and libfreetype6:i386 installed from
> stretch, and I want to keep the stretch version. For apt_preferences,
> if I use:
> 
> Package: libfreetype6*
> Pin: release n=stretch
> Pin-Priority: 900
> 
> "apt-show-versions -a libfreetype6" gives in particular:
> 
> libfreetype6:amd64/stable 2.6.3-3.2 uptodate
> libfreetype6:i386/stable 2.6.3-3.2 upgradeable to 2.8.1-0.1
> 
> (aptitude has the same issue, so that I suppose the bug comes from
> libapt-pkg5.0). However, the following is fine:
> 
> Package: libfreetype6:*
> Pin: release n=stretch
> Pin-Priority: 900
> 
> "apt-show-versions -a libfreetype6" gives in particular:
> 
> libfreetype6:amd64/stable 2.6.3-3.2 uptodate
> libfreetype6:i386/stable 2.6.3-3.2 uptodate
> 
> i.e. it won't try to upgrade the i386 version.
> 
> So it appears that * doesn't match the ":" character here, contrary to
> what the glob(7) man page says:
> 
>   A '*' (not between brackets) matches any string, including the empty
>   string.
> 
> (referenced in the apt_preferences(5) man page).
> 
> If I try regular expressions, for:
> 
> Package: /libfreetype6/
> Pin: release n=stretch
> Pin-Priority: 900
> 
> "apt-show-versions -a libfreetype6" gives in particular:
> 
> libfreetype6:amd64/stable 2.6.3-3.2 uptodate
> libfreetype6:i386/stable 2.6.3-3.2 upgradeable to 2.8.1-0.1
> 
> i.e. same issue. But for:
> 
> Package: /libfreetype6:/
> Pin: release n=stretch
> Pin-Priority: 900
> 
> "apt-show-versions -a libfreetype6" gives in particular:
> 
> libfreetype6:amd64/stable 2.6.3-3.2 upgradeable to 2.8.1-0.1
> libfreetype6:i386/stable 2.6.3-3.2 upgradeable to 2.8.1-0.1
> 
> This is buggy and inconsistent with globbing.

It's not. Patterns match package names. The colon is not
part of the package name, and the architecture is not either
- and the architecture is matched by architecture wildcards (as
in build-depends arch lists), not glob or regex.

So for example,

	/libfreetype6/:linux-any

is a valid Package line. As a special exception to the architecture
wildcard rules, apt also accepts * in place of any, so you can
write:

	/libfreetype6/:linux-*
	/libfreetype6/:*


And this matches the documented behavior: The regex or glob pattern
is expanded into a list of names, for example libfreetype6:

	Package: libfreetype6

this does not match libfreetype6:i386 either, you'd have to specify

	Package: libfreetype6:any

This is a documentation issue.
-- 
Debian Developer - deb.li/jak | jak-linux.org - free software dev
Ubuntu Core Developer                              de, en speaker


Reply to: