From nobody Wed Nov 24 23:56:24 2021 X-Original-To: dev-commits-src-all@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 B78FB18ADC08; Wed, 24 Nov 2021 23:56:25 +0000 (UTC) (envelope-from git@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 4HzyZx23XZz4R8r; Wed, 24 Nov 2021 23:56:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 549EE13784; Wed, 24 Nov 2021 23:56:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AONuOKk022661; Wed, 24 Nov 2021 23:56:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AONuOBN022660; Wed, 24 Nov 2021 23:56:24 GMT (envelope-from git) Date: Wed, 24 Nov 2021 23:56:24 GMT Message-Id: <202111242356.1AONuOBN022660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3ede04c78c7c - main - ldconfig(8): check for no-args command line after options are parsed List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ede04c78c7c726ed79a39d22c65a58d0ecc5d00 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637798185; 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; bh=bKO+hOG30WgS4IUBneag0Bs2eWjRaExcDEFzm0ubapk=; b=p9lmEkUQmVXoM2HvarqgHU8Gg47zD1ac9UVpFU5GqC/1DGsNr5PPX43fwP8Cbd24NXahTq ovhY78vVpJ/en6H/QCG5qrVHehVuEjQxvTFSQ3mIfs2pFDLTDpE7vTrbJw3gYafUN01k0H ih4UCJw3JPNdXgDIEwMxmIfhV86FONHNWuI0P8Jl2xMGgDwf4mH8Vq+wysuMoG4hT1JTx/ qjtDFOyYb7YuPA3CBrdgv+2HnG1tIp44x73evUNdHbWKvj5ddkEsNKvXjIUy2eo0zcJJTV tO6rwv1zEXetYHzQ8O2wvo+M2/rkauJBDy6jvus/bmwTFSMf8TOOQp4JFF+1bQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637798185; a=rsa-sha256; cv=none; b=qrxDNUdRB3nwgb4llr5D5p0jPZOxLgplfIQADpBvWY4G9++XNJPb+pIahZEGsizb8IU4/X 1fn0cEnO2KS1LH3W5qT6jyNe3DIqLpmjpJKYvzYESpC9UukvZNJGjizsgny7TYOkUeYhl8 bPIYwYS3uy6Bati+TzFhdoUcTTL06Hs4TMMlLkB5kRaxlhIEj6Ceew/WRfR4CJ+lVRYnUW CKxDJaHOHW8G38jRsMnAV2lAm7nJ9Y7PJzyyBJZIgHyrQzHOIVs51sndBhcXc8VXV/0blh ZfbvKW0WOjA031wjqA5qwU39hWfgv3fbiLgFZnsDXlQsrUR0QDnQubcE/oAy2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3ede04c78c7c726ed79a39d22c65a58d0ecc5d00 commit 3ede04c78c7c726ed79a39d22c65a58d0ecc5d00 Author: Konstantin Belousov AuthorDate: 2021-11-19 04:07:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-24 23:55:04 +0000 ldconfig(8): check for no-args command line after options are parsed Default action for ldconfig is specified as -R AKA 'append', and for no-args (without options changing default actions), ldconfig should append empty list of directories to current list. But because the check was done before options were parsed out, presence of any option turned off default rescan. As result, innocently-looked commands like `ldconfig -v' were interpreted as setting directory hints list to one specified on the command line, i.e. empty. Reported by: https://github.com/mesonbuild/meson/issues/9592 Reviewed by: emaste Tested by: jbeich Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33058 --- sbin/ldconfig/ldconfig.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sbin/ldconfig/ldconfig.c b/sbin/ldconfig/ldconfig.c index 288c22813121..b039412a648b 100644 --- a/sbin/ldconfig/ldconfig.c +++ b/sbin/ldconfig/ldconfig.c @@ -90,9 +90,7 @@ main(int argc, char **argv) hints_file = _PATH_ELF32_HINTS; else hints_file = _PATH_ELF_HINTS; - if (argc == 1) - rescan = true; - else while((c = getopt(argc, argv, "Rf:imrsv")) != -1) { + while((c = getopt(argc, argv, "Rf:imrsv")) != -1) { switch (c) { case 'R': rescan = true; @@ -121,11 +119,14 @@ main(int argc, char **argv) } } - if (justread) + if (justread) { list_elf_hints(hints_file); - else + } else { + if (argc == optind) + rescan = true; update_elf_hints(hints_file, argc - optind, argv + optind, merge || rescan); + } exit(0); }