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
This commit is contained in:
Ricardo Branco
2026-05-15 16:58:41 +02:00
committed by Mitchell Horne
parent 453de99b38
commit 4dfc78e0e3
+3
View File
@@ -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"