Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Mar 2024 08:39:15 +0000
From:      bugzilla-noreply@freebsd.org
To:        pkg@FreeBSD.org
Subject:   [Bug 277411] ports-mgmt/pkg: @postunexec command in pkg-plist isn't executed when package is upgraded with `pkg upgrade`
Message-ID:  <bug-277411-32340@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277411

            Bug ID: 277411
           Summary: ports-mgmt/pkg: @postunexec command in pkg-plist isn't
                    executed when package is upgraded with `pkg upgrade`
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: pkg@FreeBSD.org
          Reporter: yasu@freebsd.org
          Assignee: pkg@FreeBSD.org
             Flags: maintainer-feedback?(pkg@FreeBSD.org)

Created attachment 248845
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D248845&action=
=3Dedit
Patch to add misc/foo to ports tree

Attached patch add 'misc/foo', a sample port to reproduce the problem, to t=
he
ports tree.

misc/foo is very simple. It installs only one shell script 'foo' to
${PREFIX}/bin. But pkg-plist does something more.

----------------------------------------------------------------------
% pwd
/usr/ports/misc/foo
% cat pkg-plist
bin/foo
@preexec echo "Executing @preexec command of %%PKGNAME%%."
@postexec echo "Executing @postexec command of %%PKGNAME%%."
@preunexec echo "Executing @preunexec command of %%PKGNAME%%."
@postunexec echo "Executing @postunexec command of %%PKGNAME%%."
%
----------------------------------------------------------------------

It includes @preexec/@postexec/@preunexec/@postunexec commands showing mess=
age
that each command is executed.

I build the port with poudriere and install the package with `pkg install`.
Then I get following result.

----------------------------------------------------------------------
# pkg install -y foo
Updating Poudriere repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01=20=20=20=20
Fetching packagesite.pkg: 100%   29 KiB  30.1kB/s    00:01=20=20=20=20
Processing entries: 100%
Poudriere repository update completed. 103 packages processed.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        foo: 1.0

Number of packages to be installed: 1
[1/1] Installing foo-1.0...
Executing @preexec command of foo-1.0.
[1/1] Extracting foo-1.0: 100%
Executing @postexec command of foo-1.0.
#
----------------------------------------------------------------------

And if I uninstall the package with `pkg delete` then I get following resul=
t.

----------------------------------------------------------------------
# pkg delete -y foo
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packag=
es
in the universe):

Installed packages to be REMOVED:
        foo: 1.0

Number of packages to be removed: 1
[1/1] Deinstalling foo-1.0...
Executing @preunexec command of foo-1.0.
[1/1] Deleting files for foo-1.0: 100%
Executing @postunexec command of foo-1.0.
#
----------------------------------------------------------------------

All of @preexec/@postexec/@preunexec/@postunexec work as is expected

Next, I install foo-1.0 again, bump PORTREVISION of Makefile, rebuild the
package with poudriere, and upgrade from 1.0 to 1.0_1 with `pkg upgrade`. T=
hen
I get following result.

----------------------------------------------------------------------
# pkg info -aq | fgrep foo
foo-1.0
# pkg upgrade -y
Updating Poudriere repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01=20=20=20=20
Fetching packagesite.pkg: 100%   29 KiB  30.0kB/s    00:01=20=20=20=20
Processing entries: 100%
Poudriere repository update completed. 103 packages processed.
All repositories are up to date.
Checking for upgrades (2 candidates): 100%
Processing candidates (2 candidates): 100%
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        foo: 1.0 -> 1.0_1

Number of packages to be upgraded: 1
[1/1] Upgrading foo from 1.0 to 1.0_1...
Executing @preexec command of foo-1.0_1.
[1/1] Extracting foo-1.0_1: 100%
Executing @preunexec command of foo-1.0.
Executing @postexec command of foo-1.0_1.
root@rolling-vm-freebsd4[73]#
----------------------------------------------------------------------

While @preexec of foo-1.0_1, @preunexec of foo-1.0 and @posttexec of foo-1.=
0_1
are executed, @postunexec of foo-1.0 isn't executed.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-277411-32340>