freebsd / pkg

Package management tool for FreeBSD. Help at #pkg on Libera Chat or pkg@FreeBSD.org
Other
738 stars 277 forks source link

Incorrectly handles SIGINT #1956

Open AMDmi3 opened 3 years ago

AMDmi3 commented 3 years ago

So I run pkg upgrade (pkg 1.16.3), it shows what's it going to do and asks Proceed with this action? [Y/n]: I hit ^C to interrupt it, but instead it proceeds:

...
Number of packages to be upgraded: 10
Number of packages to be reinstalled: 5

The operation will free 8 MiB.

Proceed with this action? [Y/n]: ^C
/tmp% [1/15] Upgrading expat from 2.3.0 to 2.4.1...
[1/15] Extracting expat-2.4.1: 100%
[2/15] Reinstalling xmlcatmgr-2.2_2...
[2/15] Extracting xmlcatmgr-2.2_2: 100%
 + Removing /usr/local/share/sgml/catalog.  It is empty.
 + Removing /usr/local/share/xml/catalog.  It is empty.
 + Creating /usr/local/share/sgml/catalog
 + Registering CATALOG catalog.ports (SGML)
 + Creating /usr/local/share/xml/catalog
 + Registering nextCatalog catalog.ports (XML)
[3/15] Upgrading wayland from 1.19.0 to 1.19.0_1...
[3/15] Extracting wayland-1.19.0_1: 100%
[4/15] Upgrading libxshmfence from 1.3 to 1.3_1...
[4/15] Extracting libxshmfence-1.3_1: 100%
sudo pkg upgrade && DDNet[5/15] Upgrading libdrm from 2.4.105,1 to 2.4.106,1...
[5/15] Extracting libdrm-2.4.106,1: 100%
[6/15] Upgrading glib from 2.66.7_1,1 to 2.66.8,2...
[6/15] Extracting glib-2.66.8,2: 100%
[7/15] Upgrading xkeyboard-config from 2.31 to 2.32...
[7/15] Extracting xkeyboard-config-2.32: 100%
[8/15] Upgrading libva from 2.11.0 to 2.11.0_1...
[8/15] Extracting libva-2.11.0_1: 100%
[9/15] Reinstalling libtextstyle-0.21...
[9/15] Extracting libtextstyle-0.21: 100%
[10/15] Upgrading py39-chardet from 3.0.4_3,1 to 4.0.0,1...
[10/15] Extracting py39-chardet-4.0.0,1: 100%
[11/15] Reinstalling ninja-1.10.2,2...
[11/15] Extracting ninja-1.10.2,2: 100%
[12/15] Reinstalling gettext-tools-0.21...
[12/15] Extracting gettext-tools-0.21: 100%
[13/15] Reinstalling docbook-xsl-1.79.1_1,1...
[13/15] Extracting docbook-xsl-1.79.1_1,1: 100%
xmlcatmgr: entry already exists for `/usr/local/share/xsl/docbook/catalog.xml' of type `nextCatalog'
pkg: POST-INSTALL script failed
[14/15] Upgrading cairo from 1.16.0_1,3 to 1.17.4,3...
[14/15] Extracting cairo-1.17.4,3: 100%
[15/15] Upgrading DDNet from 15.4_1 to 15.4_2...
[15/15] Extracting DDNet-15.4_2: 100%
/tmp%

By /tmp after the prompt I suspect that multiple processes are involved here, one of which is terminated, but another erroneously continues.

grembo commented 2 years ago

I'm seeing the same issue here, being able to use CTRL-C to actually stop pkg would be good.

grahamperrin commented 7 months ago

Packaged ports from latest, following a major upgrade of base (without pkgbase) from 13.2-RELEASE-p7 to 14.0-RELEASE-p2.

In this case, I keyed Control-C (00:01:32 on the timeline of a screen recording) after it became clear that n would not have the required effect:

pkg upgrade, frame a

pkg upgrade, frame b

00:37:18 on the timeline, with an assumption that things would be endless following the attempted cancellation, I restarted the OS:

pkg upgrade, frame c

Please note, I don't need help with this particular package upgrade scenario; it was a test. No frustration for me.

The three frames from the recording are, partly, to demonstrate the potential for a user to be frustrated in an OS upgrade situation.

grahamperrin commented 4 days ago

Fixed?

From ports-mgmt/pkg: update to 1.21.0 · freebsd/freebsd-ports@c923e0d (2024-04-02):

  • support job cancellation (packagekit support)
leahneukirchen commented 3 days ago

I just reported this as https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280092

It's still an issue in 1.21.3.

(Note that a similar behavior happens on EOF = ^D, for different internal reasons maybe.)