Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Feb 2023 10:38:25 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 269433] ports-mgmt/pkg Segfault on malformed pkg.conf content (pkg_env)
Message-ID:  <bug-269433-7788@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 269433
           Summary: ports-mgmt/pkg Segfault on malformed pkg.conf content
                    (pkg_env)
           Product: Ports & Packages
           Version: Latest
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: pkg@FreeBSD.org
          Reporter: theo.bertin@advens.fr
          Assignee: pkg@FreeBSD.org
             Flags: maintainer-feedback?(pkg@FreeBSD.org)

There seems to be a bug in the way pkg handles options in pkg.conf
(/usr/local/etc/pkg.conf).

Problem was initially detected on an HardenedBSD 13.1-STABLE, but was
reproduced on a fresh FreeBSD 13.1-RELEASE downloaded today:

- FreeBSD 13.1-RELEASE: uname -aKU =3D FreeBSD freebsd 13.1-RELEASE FreeBSD
13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64 1301000 1301000

- pkg -vv:
Version                 : 1.19.0
PKG_DBDIR =3D "/var/db/pkg";
PKG_CACHEDIR =3D "/var/cache/pkg";
PORTSDIR =3D "/usr/ports";
INDEXDIR =3D "";
INDEXFILE =3D "INDEX-13";
HANDLE_RC_SCRIPTS =3D false;
DEFAULT_ALWAYS_YES =3D false;
ASSUME_ALWAYS_YES =3D false;
REPOS_DIR [
    "/etc/pkg/",
    "/usr/local/etc/pkg/repos/",
]
PLIST_KEYWORDS_DIR =3D "";
SYSLOG =3D true;
ABI =3D "FreeBSD:13:amd64";
ALTABI =3D "freebsd:13:x86:64";
DEVELOPER_MODE =3D false;
VULNXML_SITE =3D "http://vuxml.freebsd.org/freebsd/vuln.xml.xz";
FETCH_RETRY =3D 3;
PKG_PLUGINS_DIR =3D "/usr/local/lib/pkg/";
PKG_ENABLE_PLUGINS =3D true;
PLUGINS [
]
DEBUG_SCRIPTS =3D false;
PLUGINS_CONF_DIR =3D "/usr/local/etc/pkg/";
PERMISSIVE =3D false;
REPO_AUTOUPDATE =3D true;
NAMESERVER =3D "";
HTTP_USER_AGENT =3D "pkg/1.19.0";
EVENT_PIPE =3D "";
FETCH_TIMEOUT =3D 30;
UNSET_TIMESTAMP =3D false;
SSH_RESTRICT_DIR =3D "";
PKG_ENV {
}
ABI

Repositories:
  FreeBSD: {=20
    url             : "pkg+http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterl=
y",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }


How to reproduce:
- install pkg
- install some package (step likely not necessary)
- edit /usr/local/etc/pkg.conf and add the following lines (without the "-"=
's):

---------------------------------------
pkg_env {}
PKG_ENV : {
 http_proxy: "http://10.0.0.1:3128"
 https_proxy: "http://10.0.0.1:3128"
 ftp_proxy: "http://10.0.0.1:3128"
}
---------------------------------------

- try doing a `pkg info`:
root@freebsd:~ # pkg info=20
gettext-runtime-0.21.1         GNU gettext runtime libraries and programs
indexinfo-0.3.1                Utility to regenerate the GNU info page index
libffi-3.4.4                   Foreign Function Interface
mpdecimal-2.5.1                C/C++ arbitrary precision decimal floating p=
oint
libraries
pkg-1.19.0                     Package manager
python39-3.9.16                Interpreted object-oriented programming lang=
uage
readline-8.2.0                 Library for editing command lines as they are
typed
vim-9.0.0981                   Improved version of the vi editor (console
flavor)
Child process pid=3D1149 terminated abnormally: Segmentation fault
root@freebsd:~ #=20



The configuration is obviously wrong, but pkg shouldn't segfault on this.
After some testing, it seems that:
- pkg doesn't fail if multiple lines with same case are in the file ('pkg_e=
nv
{}' plus 'pkg_env : {...}')
- pkg fails when multiple lines are present, with a different casing ('pkg_=
env
{}' plus 'PKG_ENV : {...}')

I don't know if this bug occurs only for the pkg_env option, or other
parameters as well.

--=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-269433-7788>