Hi Tobias,

> Thanks for adding Breaks:, but Breaks alone isn't enoug - it needs to
> be paired with Replaces:.

PackageTransition talks about moving files which are formally owned by
packages. However, `dpkg -S /var/lib/location/database.db` shows no
owner, as neither package has ever installed it directly as a file.
Therefore I believe Replaces would be a no-op in our scenario.

> To handle partial upgrades and error unwinds cleanly, both packages
> need cross-declarations:

In practice, when a new libloc1t64 is freshly installed with an old
libloc-database, the symlink does not get created. On upgrade, the
existing link stays. The fresh install is sub-optimal, but an update of
libloc-database would then add the link.

If libloc1t64 also Breaks the old libloc-database, then whenever only
the old one is available, fresh installs skip the Recommends, and apt
never adds it back later. I think it's cleaner to let the old one be
installed and get upgraded.

However, we need the Breaks in libloc-database to protect against old
libloc1t64 prerm logic, which deletes the link on remove.

Error unwinds are not affected either way: the Breaks only adds no-op
deconfigure calls on the old libloc1t64, and I added abort-remove
handling in the new libloc-database postinst.

> Also, please check the postinst check in libloc-database:
> [...]
> Would a dangling symlink be a problem?

No, a dangling symlink is not a concern in libloc-database.

At postinst configure time, the intended link target is already unpacked
so any dangling symlink shows that a user has made some custom changes.
I updated the maintainer scripts to leave local modifications be,
testing -L and no longer suppressing errors with || true.

I also added a postinst in libloc1t64: Some dangling links may have been
created in previous versions, so we should clean them up as a one-time
operation.

Thank you for surfacing this.

> (Also, out of curiosity: I assume the symlink is there so a local admin
> can swap in their own database without touching what's shipped under
> /usr/share/.... If that's not actually a use case you need to support,
> or if libloc could just point straight to /usr/share/..., or ship
> directly under /var/lib/... - dropping the symlink might save you a
> bunch of maintainer-script headaches.)

The primary scenario is that `location update` (run daily by
location-update.timer, enabled by default) pulls in the latest database
over internet and renames its download over that /var/lib path. This is
the default location for bindings and the CLI tooling. If we set the
default to /usr/share, then the updater would also write to /usr/share.

Shipping the database under /var/lib instead would make dpkg overwrite a
newer local download on every libloc-database upgrade, and delete it on
removal.

To drop the symlink, we would need upstream to support reading from
multiple locations: If the /var/lib file exists, read there, otherwise
read from /usr/share. This is currently not supported.

Effectively, what the symlink is for is:
1. The time until the download is done. It's a daily task, and the
   bindings/CLI would not trigger a download if the file is missing.
2. Installations where the timer never runs, such as when lua-location
   is installed on its own.
3. Hosts where the internet download cannot be done. They never get an
   updated download, so the Debian archive provides all files needed for
   a usable installation.

I have uploaded new versions to mentors to inform dpkg that
/var/lib/location is also used by libloc-database, and to clean up the
maintainer script logic.

If after my explanations, you still think that libloc-database should
have a Replaces and libloc1t64 should have a Breaks, let me know and I
will add them in the next upload.

--
  Valters Jansons

Reply via email to