Bug 280092 - ports-mgmt/pkg: Y/n question is accepted on interrupt or EOF
Summary: ports-mgmt/pkg: Y/n question is accepted on interrupt or EOF
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-pkg (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-02 16:53 UTC by Leah Neukirchen
Modified: 2024-07-02 21:41 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (pkg)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leah Neukirchen 2024-07-02 16:53:21 UTC
When DEFAULT_ALWAYS_YES is set, pressing Ctrl-C or Ctrl-D at a pkg(8) 1.21.3  prompt results in accepting the question (at least for fetch and install; for remove, only Ctrl-D accepts...).  This is most definitely not what the user expects.

# env DEFAULT_ALWAYS_YES=true pkg install wget
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
...
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	wget: 1.24.5 [FreeBSD]

Number of packages to be installed: 1

The process will require 4 MiB more space.
774 KiB to be downloaded.

Proceed with this action? [Y/n]: ^C
[1/1] Fetching wget-1.24.5.pkg: 100%  774 KiB 793.1kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/1] Installing wget-1.24.5...
[1/1] Extracting wget-1.24.5: 100%


Instead, being interrupted (or getting EOF) should always result in a negative answer.  One can probably check that the function read at least one character (the newline).
Comment 1 Leah Neukirchen 2024-07-02 16:59:10 UTC
This is a duplicate of https://github.com/freebsd/pkg/issues/1956 I didn't know GitHub issues was used for pkg.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2024-07-02 21:41:12 UTC
^Triage: see instead https://github.com/freebsd/pkg/issues/1956 .