git: ac15e5619d1b - stable/14 - crashinfo: Create core.txt.last symlink

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Tue, 25 Aug 2026 17:45:39 UTC
The branch stable/14 has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=ac15e5619d1bde4bba0b1529812bb6f6730af91d

commit ac15e5619d1bde4bba0b1529812bb6f6730af91d
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2026-05-15 14:58:41 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-08-25 17:44:41 +0000

    crashinfo: Create core.txt.last symlink
    
    When saving a coredump, savecore(8) maintains .last symlinks for the
    info and vmcore artifacts, but not for the crashinfo text report.
    
    Make crashinfo(8) create the link, pointing at the current
    core.txt.<bounds> file.
    
    This makes /var/crash/core.txt.last track the same core dump as
    info.last and vmcore.last.
    
    [mhorne: I tweaked the submission, such that the link will be created as
    soon as the core.txt.X file is generated; not only after a successful
    report has been written.]
    
    Signed-off-by:  Ricardo Branco <rbranco@suse.de>
    Reviewed by:    mhorne
    MFC after:      1 week
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/2199
    
    (cherry picked from commit 4dfc78e0e3bb096514455e9bb6cf63e46e84db13)
---
 usr.sbin/crashinfo/crashinfo.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/usr.sbin/crashinfo/crashinfo.sh b/usr.sbin/crashinfo/crashinfo.sh
index 3bb1e1456462..0281f1541f2b 100755
--- a/usr.sbin/crashinfo/crashinfo.sh
+++ b/usr.sbin/crashinfo/crashinfo.sh
@@ -149,11 +149,13 @@ fi
 VMCORE=$CRASHDIR/vmcore.$DUMPNR
 INFO=$CRASHDIR/info.$DUMPNR
 FILE=$CRASHDIR/core.txt.$DUMPNR
+LINK=$CRASHDIR/core.txt.last
 HOSTNAME=`hostname`
 
 if $BATCH; then
 	echo "Writing crash summary to $FILE."
 	exec > $FILE 2>&1
+	ln -sf $FILE $LINK
 fi
 
 GDB=/usr/local/bin/gdb
@@ -204,6 +206,7 @@ machine=$(gdb_command $KERNEL 'printf "%s", machine')
 if ! $BATCH; then
 	echo "Writing crash summary to $FILE."
 	exec > $FILE 2>&1
+	ln -sf $FILE $LINK
 fi
 
 echo "$HOSTNAME dumped core - see $VMCORE"