From nobody Tue Jul 11 20:49:49 2023 X-Original-To: dev-commits-src-main@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 4R0tKV0zw2z4dQ7k; Tue, 11 Jul 2023 20:49:50 +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 4R0tKV0XMrz3tPw; Tue, 11 Jul 2023 20:49:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689108590; 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=J2dQBfFAwOahxekbTgxy+ovbz8U4/Hl5MSoinv51Zqk=; b=xyXuZ/8W1a8LQPfvNAEj9HgxUuPIyHsWs9hPePv6rBWuu7WfRWF/YVr9wmit4u9Spzs/9a u7qA06yRyTVNIYtZ/g8ePBjrjFS8OAl9cQbXBevIojQZpn3I5E4IbLMzpaWKz8EJ43iKzH 8roqXYMGiADjtTQDkdj2HJKjDlKMxMiOWgjNrlf2lgNtp6+ECBBni5Qjcb2ZeJZPLEAqpD UI+uBrZNU9FcBJml+YYPQmqvGiI12ABcnsHoH0E7pXfWYmkD4FZbH5jUuha9cL+vdVxemy xdIsvw9OaMIWxKA+PwJUhaIYBxhWai/HEWD6T+j7aJ3KIsET7vOt9jdhku+Vog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689108590; 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=J2dQBfFAwOahxekbTgxy+ovbz8U4/Hl5MSoinv51Zqk=; b=rb1+5/atHPKX9h78Gz8YFRwJOlhF17aWxdaWEBkrNIDhsrEWrsdbd2ocPePwLNrnIWp+U2 EgFyx0oNcWmuiEAaYV20Yh6GMWyjMOn+eqiP2+fJIgqLzXEh74v3Ao+PtcrVIiHNQmGqYQ 7df2CItuv4DTwJvg3gJNzZ4U7AFyYXWVE3HD8HIe6ftG3TDKARotkACswoxIkgBl8V2/sm R9lWzzXl4ru7NxOARFhmYHLq9PVo7BBkNNPh/DHwNCa/CdBAR3/F4epUkJGANoP/HpPAsA FvXzu+3LNLRIC/FEaxST8NKb+ZmOs2tHSCVcotzPUhemdGfKMBwqbbX7YcO3lw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689108590; a=rsa-sha256; cv=none; b=M1QeOTrl82oBg5opPUIDMN3NQJQpUFiujFD1HinqRtkHGRfHqFbv/uv7FXTbXSf3VdjBXC BsnL7WShkThknGNH+CPxpaG4zUJUylnAhunmAFae9uSf085tKmDCh9JTLGA+d4vnB8ENS6 yKLjd3Nba/HcCORKfcBGzkdzbzMfapQGJnwxHa81fw/T/eCxCxsADt8sHMYo0VmCNXimbj /oCA7bQWF8Nu2x0xJOFG0Ns4Xm7GOxUj/6KF1XD76lrdpiLmMhZLkRJPCnSBhrFWcJOgOv uuRmi7ks99ModMRXzRmVo3A4thCeB4rFHcnIClBclADY1WYJrGLlCmgxfCdb+Q== 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 4R0tKT6PG8zh4N; Tue, 11 Jul 2023 20:49:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36BKnnZI071315; Tue, 11 Jul 2023 20:49:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36BKnn3s071314; Tue, 11 Jul 2023 20:49:49 GMT (envelope-from git) Date: Tue, 11 Jul 2023 20:49:49 GMT Message-Id: <202307112049.36BKnn3s071314@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 3a46fe226193 - main - getlocalbase: Make default path actually configurable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3a46fe226193dde1270ebb08d2066a77ae12d7e9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=3a46fe226193dde1270ebb08d2066a77ae12d7e9 commit 3a46fe226193dde1270ebb08d2066a77ae12d7e9 Author: Jessica Clarke AuthorDate: 2023-07-11 20:49:22 +0000 Commit: Jessica Clarke CommitDate: 2023-07-11 20:49:22 +0000 getlocalbase: Make default path actually configurable We include paths.h in getlocalbase.c, which defines _PATH_LOCALBASE. This will override a definition on the command line, meaning it is impossible to override like how the manpage says you can, and it means the code to provide a fallback default is dead as the macro is always defined. Instead, introduce a new LOCALBASE_PATH macro like LOCALBASE_CTL_LEN that can be set on the command line and will default to the system's existing _PATH_LOCALBASE to avoid duplicating the default here. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D40975 --- lib/libutil/getlocalbase.3 | 8 ++++---- lib/libutil/getlocalbase.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/libutil/getlocalbase.3 b/lib/libutil/getlocalbase.3 index e7be3f1809ef..06216b8b48a2 100644 --- a/lib/libutil/getlocalbase.3 +++ b/lib/libutil/getlocalbase.3 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 25, 2020 +.Dd July 11, 2023 .Dt GETLOCALBASE 3 .Os .Sh NAME @@ -53,10 +53,10 @@ If that does not exist then the .Va user.localbase sysctl is checked. If that also does not exist then the value of the -.Dv _PATH_LOCALBASE +.Dv LOCALBASE_PATH compile-time variable is used. -If that is undefined then the default of -.Pa /usr/local +If that is undefined then the system default, +.Pa _PATH_LOCALBASE is used. .Pp The contents of the string returned by the diff --git a/lib/libutil/getlocalbase.c b/lib/libutil/getlocalbase.c index a737d8c5c253..c19cb95212dd 100644 --- a/lib/libutil/getlocalbase.c +++ b/lib/libutil/getlocalbase.c @@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifndef _PATH_LOCALBASE -#define _PATH_LOCALBASE "/usr/local" +#ifndef LOCALBASE_PATH +#define LOCALBASE_PATH _PATH_LOCALBASE #endif #ifndef LOCALBASE_CTL_LEN @@ -73,17 +73,17 @@ getlocalbase(void) #if LOCALBASE_CTL_LEN > 0 if (sysctl(localbase_oid, 2, localpath, &localpathlen, NULL, 0) != 0) { if (errno != ENOMEM) - localbase = _PATH_LOCALBASE; + localbase = LOCALBASE_PATH; else localbase = ILLEGAL_PREFIX; } else { if (localpath[0] != '\0') localbase = localpath; else - localbase = _PATH_LOCALBASE; + localbase = LOCALBASE_PATH; } #else - localbase = _PATH_LOCALBASE; + localbase = LOCALBASE_PATH; #endif return (localbase);