Public bug reported:

Package: synaptic
Version: 0.75.13

(Filed only for documenting.  I suspect the developers are already aware
of this, and don't expect any reasonable solution.)

The synaptic selections interface in common/rpackagelister.cc
(writeSelections, readSelections) has this combination of features which
results in packages losing their auto-installed status:

1) there is no indication whether an action is “from the user,” all read 
selections are assumed to be (FromUser=true for pkgDepCache::MarkInstall and 
::MarkDelete);
2) there is no indication whether a package is auto- or manually-installed;
3) pkgDepCache::MarkInstall will mark any package manually-installed, if 
FromUser=true.

1) and 2) are obviously for compatibility with the dpkg --set-selections
interface.  Ok.

When reading selections, because this is restoring a previous state, you
must use FromUser=true.  Otherwise libapt-pkg may ignore some requests
[1] and the restored state will not be equal to the saved state.  So 1)
is ok.

It is the interplay between 2) and 3) that causes the problem.  In some
cases 3) is desirable, but when we are trying to restore a previous
state it complicates things.  As long as libapt-pkg has this behaviour
the synaptic selections interface is going to cause loss of auto-
installed status on some packages.

2) can be changed, but breaks compatibility with the well-established
dpkg interface.

Changing only 3) will not really solve the issue because the user may
have marked a package as auto-installed then saved the selections
*before* the change is effective.  This marking will not be stored in
the saved selections and therefore lost when those selections are read
back.  Moving 3) from pkgDepCache to each frontend or having an option
to temporarily disable it may be the only way to proceed.

It may be effective to only store the "from user" selections.  However
the restored state may not exactly match what the user saved, since the
package catalogue may have changed in the mean time and dependencies
resolved differently.

[1] See pkgDepCache::isModeChangeOk and others, which use FromUser to
decide whether to proceed with particular actions.

[Impact]

Loss of data about which packages are auto-installed.  Packages which
lose that information will not be cleaned up (e.g. with apt-get
autoremove) when no longer in use.

Update-manager uses the synaptic interface in one of it's backends.
When performing only a partial upgrade, all upgraded packages will be
marked as manually installed.  See bug #300718.

Interactive users of synaptic who use “Save Markings” and “Read
Markings” will find that any marked package which was auto-installed
before saving will no longer be marked as such after reading.

[Test Case 1: quick, simulates what update-manager does]

* Locate an upgradeable package marked auto, for example with aptitude:

# aptitude search "~U~M" | head -n1
i A dput                            - Debian package upload tool                
[…]
# PKG=dput
# grep-dctrl -P $PKG /var/lib/apt/extended_states
Package: dput
Architecture: i386
Auto-Installed: 1

* "Upgrade" this package using the only means provided by --set-
selections interface (this is what update-manager does):

# echo -e "$PKG\tinstall" >/tmp/selections
# synaptic --hide-main-window --non-interactive 
--set-selections-file=/tmp/selections

* Observe that the package is no longer marked auto-installed:

# grep-dctrl -P $PKG /var/lib/apt/extended_states
Package: dput
Architecture: i386
Auto-Installed: 0

[Test Case 2: write-read cycle via synaptic]

* Locate an upgradeable package which will cause another package marked
auto to also be upgraded:

??
# PKG1=libvorbis0a
# PKG2=libvorbisenc2
# grep-dctrl -P $PKG2 /var/lib/apt/extended_states
Package: libvorbisenc2
Architecture: i386
Auto-Installed: 1

* In the synaptic interactive interface, mark the first package for
upgrade and confirm that the second package is also marked for upgrade.

* "Save Markings" then quit synaptic, discarding marked changes.

* Confirm that the second package is still considered auto-installed:

# grep-dctrl -P $PKG2 /var/lib/apt/extended_states
Package: libvorbisenc2
Architecture: i386
Auto-Installed: 1

* Run synaptic again, "Read Markings", then apply changes.

* Observe that the second package is no longer auto-installed:

# grep-dctrl -P $PKG2 /var/lib/apt/extended_states
Package: libvorbisenc2
Architecture: i386
Auto-Installed: 0

** Affects: synaptic (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1075841

Title:
  read/write selections ("markings") causes loss of auto-installed
  status

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/synaptic/+bug/1075841/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to