Bug#919543: apt: when installing with deb file, prerm maintainer script doesn't pass new-package-name before it's replaced due to conflict

2019-01-17 Thread Julian Andres Klode
On Thu, Jan 17, 2019 at 11:03:01AM +0800, Allen wrote:
> Package: apt
> Version: 1.2.19
> Severity: normal
> 
> Dear Maintainer,
> 
> 
> I am creating a deb packages which will replace another package. And before 
> the
> old package are removed, I want to check whether the package is remove due to
> **replace** operation or a simple **uninstall** operation.
> 
> In man page of `deb-prerm`, I found that when a package is replaced due to
> conflict, the prerm script of old package can be called in the following way:
> `prerm remove in-favour new-package new-version`.
> 
> Therefore, I add some script in prerm of old package and opreate with the 
> shell
> script variables. If I use `dpkg` to install these .deb packages, it will work
> perfectly. However, it does not pass any new package information if I use 
> `apt`
> to install these packages.
> 
> Is it an existing bug? I have searched for a while and have not found any
> relevant content.

So, I don't think this ever worked. It's best to ignore this exists. While it
is documented, it cannot really happen in practice, as apt first does the remove
and then the install; in two separate invocations of dpkg.

It's unlikely that this will change in the near future, either.

It's also completely unreliable in case you have multiple conflicts across
packages, so I think we should just get rid of it completely.

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer  i speak de, en



Bug#919543: apt: when installing with deb file, prerm maintainer script doesn't pass new-package-name before it's replaced due to conflict

2019-01-16 Thread Allen
Package: apt
Version: 1.2.19
Severity: normal

Dear Maintainer,


I am creating a deb packages which will replace another package. And before the
old package are removed, I want to check whether the package is remove due to
**replace** operation or a simple **uninstall** operation.

In man page of `deb-prerm`, I found that when a package is replaced due to
conflict, the prerm script of old package can be called in the following way:
`prerm remove in-favour new-package new-version`.

Therefore, I add some script in prerm of old package and opreate with the shell
script variables. If I use `dpkg` to install these .deb packages, it will work
perfectly. However, it does not pass any new package information if I use `apt`
to install these packages.

Is it an existing bug? I have searched for a while and have not found any
relevant content.


Many thanks,
Allen Yang



-- Package-specific info:

-- apt-config dump --

APT "";
APT::Architecture "amd64";
APT::Build-Essential "";
APT::Build-Essential:: "build-essential";
APT::Install-Recommends "1";
APT::Install-Suggests "0";
APT::Sandbox "";
APT::Sandbox::User "_apt";
APT::Authentication "";
APT::Authentication::TrustCDROM "true";
APT::NeverAutoRemove "";
APT::NeverAutoRemove:: "^firmware-linux.*";
APT::NeverAutoRemove:: "^linux-firmware$";
APT::NeverAutoRemove:: "^linux-image-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^linux-image-4\.15\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-headers-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^linux-headers-4\.15\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-image-extra-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^linux-image-extra-4\.15\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-signed-image-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^linux-signed-image-4\.15\.0-43-generic$";
APT::NeverAutoRemove:: "^kfreebsd-image-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^kfreebsd-image-4\.15\.0-43-generic$";
APT::NeverAutoRemove:: "^kfreebsd-headers-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^kfreebsd-headers-4\.15\.0-43-generic$";
APT::NeverAutoRemove:: "^gnumach-image-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^gnumach-image-4\.15\.0-43-generic$";
APT::NeverAutoRemove:: "^.*-modules-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^.*-modules-4\.15\.0-43-generic$";
APT::NeverAutoRemove:: "^.*-kernel-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^.*-kernel-4\.15\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-backports-modules-.*-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^linux-backports-modules-.*-4\.15\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-tools-4\.15\.0-42-generic$";
APT::NeverAutoRemove:: "^linux-tools-4\.15\.0-43-generic$";
APT::VersionedKernelPackages "";
APT::VersionedKernelPackages:: "linux-image";
APT::VersionedKernelPackages:: "linux-headers";
APT::VersionedKernelPackages:: "linux-image-extra";
APT::VersionedKernelPackages:: "linux-signed-image";
APT::VersionedKernelPackages:: "kfreebsd-image";
APT::VersionedKernelPackages:: "kfreebsd-headers";
APT::VersionedKernelPackages:: "gnumach-image";
APT::VersionedKernelPackages:: ".*-modules";
APT::VersionedKernelPackages:: ".*-kernel";
APT::VersionedKernelPackages:: "linux-backports-modules-.*";
APT::VersionedKernelPackages:: "linux-tools";
APT::Never-MarkAuto-Sections "";
APT::Never-MarkAuto-Sections:: "metapackages";
APT::Never-MarkAuto-Sections:: "contrib/metapackages";
APT::Never-MarkAuto-Sections:: "non-free/metapackages";
APT::Never-MarkAuto-Sections:: "restricted/metapackages";
APT::Never-MarkAuto-Sections:: "universe/metapackages";
APT::Never-MarkAuto-Sections:: "multiverse/metapackages";
APT::Move-Autobit-Sections "";
APT::Move-Autobit-Sections:: "oldlibs";
APT::Move-Autobit-Sections:: "contrib/oldlibs";
APT::Move-Autobit-Sections:: "non-free/oldlibs";
APT::Move-Autobit-Sections:: "restricted/oldlibs";
APT::Move-Autobit-Sections:: "universe/oldlibs";
APT::Move-Autobit-Sections:: "multiverse/oldlibs";
APT::Periodic "";
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";
APT::Periodic::Unattended-Upgrade "1";
APT::Update "";
APT::Update::Post-Invoke-Success "";
APT::Update::Post-Invoke-Success:: "touch 
/var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";
APT::Update::Post-Invoke-Success:: "[ ! -f /var/run/dbus/system_bus_socket ] || 
/usr/bin/dbus-send --system --dest=org.debian.apt --type=signal /org/debian/apt 
org.debian.apt.CacheChanged || true";
APT::Update::Post-Invoke-Success:: "if /usr/bin/test -w /var/cache/app-info -a 
-e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi";
APT::Update::Post-Invoke-Success:: 
"/usr/lib/update-notifier/update-motd-updates-available 2>/dev/null || true";
APT::Archives "";
APT::Archives::MaxAge "30";
APT::Archives::MinAge "2";
APT::Archives::MaxSize "500";
APT::Architectures "";
APT::Architectures:: "amd64";
APT::Architectures:: "i386";
APT::Compressor "";
APT::Compressor::. "";