From nobody Fri Aug 28 00:59:56 2026 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 4hWKmd5YZ2z6pllZ for ; Fri, 28 Aug 2026 01:00:01 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hWKmd4D9tz479P for ; Fri, 28 Aug 2026 01:00:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787878801; 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=VwymCH3QULt2jft5IpvHP10m8D+qqInHv6s/NHM879c=; b=ScsIe9IY3+zu+sem+Z+utrX7x60acVNMaPhcLGZMjcKa9a3j88YhiENkZ9ak+R6i98j+1b EtQZO8hEinS+Z3VVc4YYNqeHYBk9MzM2z6DK3ubfowM1E2gl/2RCVzU1tgDWxmTTp6m7a2 QuEpYywHsR1qwAYctPdImxIdskps6m5E2KJBgr2n3Ep9f6h8MSaDIYbwgAa2Zvp+rl0o/u kLryJgCrBT8MdMHxCfrm52gKMx/CKyPqOGG5oix83DPoZ+znfswYW5tdUxGIQBvX8o2CUN 4Jge0Mle5X5d0YwI4NVzpIi3h2cB3QwCJQN1ejuXmwo1GHEVj9gDiXkCvGxfMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1787878801; a=rsa-sha256; cv=none; b=MLgTHEET+yMeS0MCzERDxhOEQy0OTAUwZfT1HzfOT7FS35dRKXwGhEp7CBS5c9/K5z8i0v jRwoUAlv2YoWCI0DOv1oR+eymvVccz//gaN2moMYtBgrqojeIDiiqx8AhK6k33tbZiCCQM z7UYJ255ZVKKExnaROP0wLJ3dIpih5Eegd42crgGY4Dw0VROC0ONSqqABUMg7OHR4NVSYr 21g9KRil/0vp7UHXDgLndQURd+AAL1fLdk3p0FkWUpmvkTtfIsWKT8OA2YhTJH+mrZLE56 wAxEDOXHewGbese/HDrhrbaR6shbtyLZoJj03Z1vqxojFHN0ADBRJ+PJdLjnWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787878801; 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=VwymCH3QULt2jft5IpvHP10m8D+qqInHv6s/NHM879c=; b=FQAO4Brk8cwB73/ykbQHrEuybzL3G38FjVpVn1zcgnlZuV5y0zsNpSRddulRuE3jEOlJPN 8K9Q26CKCTeVm8pXroMiAF52dasz2ln1PUmeqdh/tUjfXlbYz5g3LPkuFWldPE1GQuApjH YRL4ALqRzLOlbON72YPOpOSuWxFwBYXUFeYlpsTbsEC1E2KQcujJ6Xm6eJO+I9L/iyCqsl feKuLYAAuNX6ezD0Duw13veyYjGRfHpyYFAh51jJ14KevfZOn23nmQ+k4RR6J/w3cajP9H 29GvPQ0uIrpcCShmPvJcMO6m2a34B1kPLZeeNCk4+6qAe1gxCnxUk7fgtmf2Ww== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hWKmd2Mvpzp4W for ; Fri, 28 Aug 2026 01:00:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2473c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 28 Aug 2026 00:59:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Devin Teske Subject: git: 14df6e1e686e - main - fortune: fall back to all databases if fortunes is missing 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dteske X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 14df6e1e686ef1908c107932d9224d3f3fbc6b51 Auto-Submitted: auto-generated Date: Fri, 28 Aug 2026 00:59:56 +0000 Message-Id: <6a90dd8c.2473c.57d5abc7@gitrepo.freebsd.org> The branch main has been updated by dteske: URL: https://cgit.FreeBSD.org/src/commit/?id=14df6e1e686ef1908c107932d9224d3f3fbc6b51 commit 14df6e1e686ef1908c107932d9224d3f3fbc6b51 Author: Devin Teske AuthorDate: 2026-08-28 00:57:53 +0000 Commit: Devin Teske CommitDate: 2026-08-28 00:57:53 +0000 fortune: fall back to all databases if fortunes is missing With no file argument, fortune looks for a database named fortunes in FORTDIR. The base system has not shipped that file since 0538d7bbe620 (FreeBSD 12), only freebsd-tips, so the default invocation failed even though a valid database remained. Callers such as xlockmore's marquee and nose modes (fortune -s) then displayed the error as the epigram. If the named fortunes file is absent, scan every database in the existing search path. /usr/local/share/games/fortune stays on that path so fortune-mod-* packages keep working; when fortune-mod-freebsd-classic restores the fortunes file, it is still preferred. fortune -f with no arguments lists the same files that would be searched. MFC after: 1 week Reviewed by: ziaee, fuz Differential Revision: https://reviews.freebsd.org/D59057 --- usr.bin/fortune/fortune/fortune.6 | 16 +++++++++++--- usr.bin/fortune/fortune/fortune.c | 46 +++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/usr.bin/fortune/fortune/fortune.6 b/usr.bin/fortune/fortune/fortune.6 index 6c2a677d24b6..0b6957870040 100644 --- a/usr.bin/fortune/fortune/fortune.6 +++ b/usr.bin/fortune/fortune/fortune.6 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 1, 2021 +.Dd August 20, 2026 .Dt FORTUNE 6 .Os .Sh NAME @@ -46,6 +46,12 @@ When .Nm is run with no arguments it prints out a random epigram. +It prefers a database named +.Pa fortunes +if one exists in the search path; otherwise it uses every database +in that path, including the base system's +.Pa freebsd-tips +file and any files installed by ports. Epigrams are divided into several categories, where each category is subdivided into those which are potentially offensive and those which are not. @@ -172,9 +178,13 @@ If set, fortune will save some state about what fortune it was up to on disk. .El .Sh FILES -.Bl -tag -width ".Pa /usr/share/games/fortune/*" +.Bl -tag -width ".Pa /usr/local/share/games/fortune/*" .It Pa /usr/share/games/fortune/* -the fortunes databases (those files ending +the base system fortune databases, currently +.Pa freebsd-tips +.It Pa /usr/local/share/games/fortune/* +additional databases installed by ports +(those files ending in .Dq Pa -o contain the .Sy offensive diff --git a/usr.bin/fortune/fortune/fortune.c b/usr.bin/fortune/fortune/fortune.c index 4989f11f1085..0f6490fd4583 100644 --- a/usr.bin/fortune/fortune/fortune.c +++ b/usr.bin/fortune/fortune/fortune.c @@ -85,7 +85,6 @@ typedef struct fd { static bool Found_one; /* did we find a match? */ static bool Find_files = FALSE; /* just find a list of proper fortune files */ -static bool Fortunes_only = FALSE; /* check only "fortunes" files */ static bool Wait = FALSE; /* wait desired after fortune */ static bool Short_only = FALSE; /* short fortune desired */ static bool Long_only = FALSE; /* long fortune desired */ @@ -352,33 +351,32 @@ form_file_list(char **files, int file_cnt) char **pstr; if (file_cnt == 0) { - if (Find_files) { - Fortunes_only = TRUE; + /* + * Prefer a database named "fortunes" so a port that + * restores that file keeps the historic default. If + * it is absent (the base system has shipped only + * freebsd-tips since the other datfiles left src), + * use every database in the search path. LOCALBASE + * stays on that path; port cookies are not moved. + */ + pstr = Fortune_path_arr; + i = 0; + while (*pstr) { + i += add_file(NO_PROB, "fortunes", *pstr++, + &File_list, &File_tail, NULL); + } + if (!i) { pstr = Fortune_path_arr; - i = 0; while (*pstr) { i += add_file(NO_PROB, *pstr++, NULL, &File_list, &File_tail, NULL); } - Fortunes_only = FALSE; - if (!i) { - fprintf(stderr, "No fortunes found in %s.\n", - Fortune_path); - } - return (i != 0); - } else { - pstr = Fortune_path_arr; - i = 0; - while (*pstr) { - i += add_file(NO_PROB, "fortunes", *pstr++, - &File_list, &File_tail, NULL); - } - if (!i) { - fprintf(stderr, "No fortunes found in %s.\n", - Fortune_path); - } - return (i != 0); } + if (!i) { + fprintf(stderr, "No fortunes found in %s.\n", + Fortune_path); + } + return (i != 0); } for (i = 0; i < file_cnt; i++) { percent = NO_PROB; @@ -776,10 +774,6 @@ is_fortfile(const char *file, char **datp, char **posp, int check_for_offend) DPRINTF(2, (stderr, "FALSE (file starts with '.')\n")); return (FALSE); } - if (Fortunes_only && strncmp(sp, "fortunes", 8) != 0) { - DPRINTF(2, (stderr, "FALSE (check fortunes only)\n")); - return (FALSE); - } if ((sp = strrchr(sp, '.')) != NULL) { sp++; for (i = 0; suflist[i] != NULL; i++)