From nobody Thu Feb 09 10:38:25 2023 X-Original-To: pkg@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PCCyB0Y9xz3nYcT for ; Thu, 9 Feb 2023 10:38:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PCCy95Fmqz3GfS for ; Thu, 9 Feb 2023 10:38:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675939105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X4YP6dZtKeWdbY8NxRWqOi3E7n0UVwG4yneBZOORc5U=; b=cjf2py98R2uYpwuO+A8SN/hFJBLOLRNLw/W2rHzYExfnexa7E0umTU+ykPak6LQPsc2v3s i/hZaHdzWZMwAe9O0KmDWW2cNIUP3+omxYQB9bIDTBHpThIEgyUfL0PZQaeB53AxQuHM76 L4xhQ1iwXes8jMUw/j3CCYIAAwIBqt4QOC27rLc1sYt0PTF/UBMngq3XR+mCuG2TedI7H2 EphmeTw4x/qcNsPCUxca9cnK54Eae5PZN1vWv+GP6IQRI7lA8VgEyNfsO3gyDDQ8SK9SmC RjCRa1RGeiKjclfHLRTeHzGA0vbkqHSBctMysY4CD97jyF8Wrsmf2O6pQVTzYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675939105; a=rsa-sha256; cv=none; b=YjJVXWPcuyZAk91bcJ7WpS7p+IhEf+o8VjlO9dpJxZwHvMxM8oZUFrhsD+MwRVHxISxjOl W/Y6u1uYIizMlOIBvyt0CyPmPexO1o00bLypzgdBoXk2dL5PdJEwzMD/A3yCkb2ZrJccZa g5LOycpqPHgpbEU7hcOR8G1uZz+ztYlyRGdzcSDi4k/u7ef+p5Z3WlunHONvce3gW8Kjlm 5OwmzymPhXgq6ckeXl3Ww4F9s28LbZiuO5AVpVq0jKNy8JX65WbYyKodsug2z9wMw1wdpI xR0FiX4wlKnnsZYw75aUYw8B9zDLnepPtVPu7XBElpdc4Ts3JrZkrfyPKSGMdQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PCCy94DB7zZFq for ; Thu, 9 Feb 2023 10:38:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 319AcPfv006055 for ; Thu, 9 Feb 2023 10:38:25 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 319AcP7x006054 for pkg@FreeBSD.org; Thu, 9 Feb 2023 10:38:25 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" From: bugzilla-noreply@freebsd.org To: pkg@FreeBSD.org Subject: maintainer-feedback requested: [Bug 269433] ports-mgmt/pkg Segfault on malformed pkg.conf content (pkg_env) Date: Thu, 09 Feb 2023 10:38:25 +0000 X-Bugzilla-Type: request X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: pkg@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? Message-ID: In-Reply-To: References: X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Binary package management and package tools discussion List-Archive: https://lists.freebsd.org/archives/freebsd-pkg List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-pkg@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N Bugzilla Automation has asked freebsd-pkg (Nobody) for maintainer-feedback: Bug 269433: ports-mgmt/pkg Segfault on malformed pkg.conf content (pkg_env) https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D269433 --- Description --- 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/quarterly", 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 point libraries pkg-1.19.0 Package manager python39-3.9.16 Interpreted object-oriented programming language 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.