Bug 219036 - ports-mgmt/pkg: pkg confused, installs older version over newer
Summary: ports-mgmt/pkg: pkg confused, installs older version over newer
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-pkg mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-03 11:22 UTC by MMacD
Modified: 2017-05-06 17:54 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (pkg)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description MMacD 2017-05-03 11:22:56 UTC
(10.3 2017Q2) 

When I did a pan-upgrade, pkg deleted xfce desktop but did not replace it (it really should *not* delete anything til after it has done the replacement).  So I had this big gray background and had to figure out what happened and then re-install by hand.

For some reason not obvious to me, the xfce desktop package includes samba44. 
I already had 46 installed, but pkg 

- didn't check for a later version
- downloaded 44
- THEN discovered 46 and complained
- downloaded ANOTHER copy of 46 
- installed 44 anyway
- THEN tried to re-install 46 and failed, complaining.

That's a lot of confusion, and ended with the wrong version installed.  

Packages should not be made of unrelated parts, for a start. At least 2 of the 4 pieces in the package are unrelated to the desktop.  pkg should preferably allow parts to be knocked out of the install, rather than make it a yes-no all-or-nothing choice.  And it should definitely check, *before* downloading, whether the install would replace a later version with an earlier and avoid doing that.

=============
6:42:15 Wed, 03 May                                                                                 [momcat:root]~> pkg install xfce4-desktop-4.12.3_2
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 4 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	xfce4-desktop: 4.12.3_2
	Thunar: 1.6.11
	gvfs: 1.26.3_4
	samba44: 4.4.13

Number of packages to be installed: 4

The process will require 127 MiB more space.
23 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/4] Fetching xfce4-desktop-4.12.3_2.txz: 100%  729 KiB 124.4kB/s    00:06    
[2/4] Fetching Thunar-1.6.11.txz: 100%  904 KiB 115.8kB/s    00:08    
[3/4] Fetching gvfs-1.26.3_4.txz: 100%    1 MiB 115.7kB/s    00:09    
[4/4] Fetching samba44-4.4.13.txz: 100%   20 MiB 117.5kB/s    02:58    
Checking integrity... done (1 conflicting)
  - samba44-4.4.13 conflicts with samba46-4.6.2 on /usr/local/bin/cifsdd
Checking integrity... done (0 conflicting)
Conflicts with the existing packages have been found.
One more solver iteration is needed to resolve them.
The following 6 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	samba44: 4.4.13
	gvfs: 1.26.3_4
	Thunar: 1.6.11
	xfce4-desktop: 4.12.3_2

Number of packages to be installed: 4

The process will require 127 MiB more space.

Proceed with this action? [y/N]: y
Fetching samba46-4.6.2.txz: 100%   22 MiB 117.3kB/s    03:15    
[1/6] Deinstalling samba46-4.6.2...
[1/6] Deleting files for samba46-4.6.2: 100%
[2/6] Installing samba44-4.4.13...
[2/6] Extracting samba44-4.4.13: 100%
[3/6] Installing gvfs-1.26.3_4...
[3/6] Extracting gvfs-1.26.3_4: 100%
[4/6] Installing Thunar-1.6.11...
[4/6] Extracting Thunar-1.6.11: 100%
[5/6] Installing xfce4-desktop-4.12.3_2...
[5/6] Extracting xfce4-desktop-4.12.3_2: 100%
[5/6] Installing samba46-4.6.2...
pkg: samba46-4.6.2 conflicts with samba44-4.4.13 (installs files into the same place).  Problematic file: /usr/local/lib/shared-modules/idmap/autorid.so

                                                                                                    6:50:32 Wed, 03 May                                                                                 [momcat:root]~> pkg info | grep samba
samba44-4.4.13                 Free SMB/CIFS and AD/DC server and client for Unix
                                                                                                    6:55:02 Wed, 03 May                                                                                 [momcat:root]~>
Comment 1 MMacD 2017-05-03 11:41:36 UTC
Here's an example of why it's a Bad Idea to package unrelated software.  Now I can't restore samba46 without having the newly-reinstalled desktop removed too! 

7:29:16 Wed, 03 May                                                                                 [momcat:root]~> pkg install samba46
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (2 conflicting)
  - samba46-4.6.2 conflicts with samba44-4.4.13 on /usr/local/lib/shared-modules/idmap/autorid.so
  - samba46-4.6.2 conflicts with samba44-4.4.13 on /usr/local/lib/shared-modules/idmap/autorid.so
Checking integrity... done (0 conflicting)
The following 5 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:
	samba44-4.4.13
	xfce4-desktop-4.12.3_2
	Thunar-1.6.11
	gvfs-1.26.3_4

New packages to be INSTALLED:
	samba46: 4.6.2

Number of packages to be removed: 4
Number of packages to be installed: 1

Proceed with this action? [y/N]: 
                                                                                                    7:35:17 Wed, 03 May                                                                                 [momcat:root]~>
Comment 2 Baptiste Daroussin freebsd_committer 2017-05-03 13:03:26 UTC
this is not a pkg bug, but an infrastructure bug. samba44 is not an older version of samba46 from pkg point of view this is 2 different software: 2 different names.

the library provided by samba44 and samba46 cannot be replaced on binaries as they are do not have the same ABI (iirc).

The right solution to avoid such situation is to have a package (only one providing) the default client part: only libraries might be ok. and the other samba ports to be installed elsewhere: /usr/local/samba<version> or with a symlink in /usr/local/bin for all the binaries (suffixed by the version) so they don't conflict with each others and their binaries using a proper RPATH so they find their libs in /usr/local/samba<version>/lib before anything else.

That way the user could decide which version of samba they want to install/use and whatever is the version of the libsmb used by default by other packages.
Comment 3 MMacD 2017-05-03 13:41:55 UTC
From pkg's current viewpoint 44 might be different to 46 rather than older, but that just means the naming conventions need to be fixed!  

The fact that 44 and 46 may be on different development paths is somewhat unimportant in the context of what the sysmgr chose to install.  The sysmgr probably didn't just flip a coin, so  casually overriding their choice is insensitive at best.

Some apps/utils might have a number as part of their name root, but probably there are none with (e.g.) :::, so pkg could certainly determine that samba:::44-i.j.k whatever is the "same" product as samba:::46-i.j.k, and an older version that should not replace the newer one without special permission.

And of course this is a general problem; samba just happened to be the one that got mugged this time.