Strange pkg_deinstall behaviour with pkgng

Gyrd Thane Lange gyrd-se at thanelange.no
Tue Jul 29 21:23:24 UTC 2014


On Tue, 29 Jul 2014 20:41:18 +0200
Baptiste Daroussin <bapt at FreeBSD.org> wrote:

> On Tue, Jul 29, 2014 at 05:46:40PM +0200, Andrea Venturoli wrote:
> > On 07/28/14 20:28, Andrea Venturoli wrote:
> > > Hello.
> > >
> > > I was forced to switch to pkgng on a 9.2 box and I'm now noticing
> > > a strange behaviour.
> > >
> > > Before, "pkg_deinstall -R foo" would deinstall foo and all ports
> > > on which foo depended, except those who were needed by other
> > > ports.
> > >
> > > Now, "pkg_deinstall -R foo" will deinstall foo, all ports on
> > > which foo depends and all ports depending on the ports on which
> > > foo depends.
> > >
> > > E.g.
> > > Port A depends on B
> > > Port B depends on C
> > > Port D depends on C
> > >
> > > With the old behaviour, "pkg_deinstall -R A" would deinstall A
> > > and B (but not C).
> > > Now it will deinstall A, B, C and D.
> > 
> > After some investigation, this broke after the upgrade to pkg 1.3,
> > in which *by default* "pkg delete" seems to be the same as "pkg
> > delete -R".
> > 
> >  From what I can tell, there is no flags to "pkg delete" which
> > makes it act as it used to and as portupgrade expects, so I cannot
> > easily fix it.
> > 
> pkg delete -f is not recursive

This is true, but is very hard to guess based on the pkg-delete(8) man
page. My first reading of the options led me to believe that -f was
an alias for -y and that it would forcefully and recursively delete
without asking. This could certainly be better worded in the man page.
-f should explicitly state that it is non-recursive (now that -R is
implicit and there is no other option to turn it off) and that a
confirmation is still required, either interactively or through the -y
option. It was with trepidation that I first used the -f option.

Also, since the -R option now does nothing, it should either be removed
or complemented with an -r option (for non-recursive)

BTW, pkg info use -d for showing dependencies instead of -R (used by
pkg_info), so the options are different from pkg_tools. Also the
options are not consistently named across the pkg commands. 

General gripe about pkg(8): The command structure and options are very
similar to the previous pkg_tools but with enough changes in options
and behaviour that it trips up an unwary user. I feel this is a POLA
violation. It is almost like it is baiting the user into making a
mistake. Is is similar enough to the old tools that the user think it is
sufficient to just replace the hyphen with a space (as in pkg-delete and
pkg delete) but sometimes with subtle changes in options or behaviour,
most of them with no clear rationale for the change.

I suppose that the superficial likeness was to make it more familiar
for existing users of pkg_tools, but since it is not 100% compatible
(would be better if it was) it would perhaps have been better to make a
clean break to remove preconceptions about operations.

Thanks for reading.

Best regards,
Gyrd ^_^

> 
> regards,
> Bapt


More information about the freebsd-ports mailing list