1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-25 06:35:46 +00:00

Before installing files, the syspatch ksh script checkfs() tries to

check if the partitions have enough space by looking at the original
files.  It converts via stat(1) calling stat(2) st_dev to a device
name by calling devname(), and then compares this against the mounted
filesystems, to see how much space is left.  This conversion via
devname() went very wrong because dev_mkdb(8) does not maintain a 1:1
relationship between dev_t and name!  The addition of rootdisk and
rrootdisk which are aliased to sd0a or wd0a (to ease the future
crossover to 52-partition support) breaks the 1:1 relationship.
This commit rewrites the file checks to use statfs(2) via df(1) so
that the same device-names are compared.
ok bluhm mlarkin beck afresh1 robert

This is part of 7.8 errata 001.  On systems where /usr is not a seperate
partition, but is part of /, syspatch will fail to install the errata and
the following manual intervention will be required:
    sed -e 's/.checkfs/#checkfs/g' /usr/sbin/syspatch > /root/syspatch
    ksh /root/syspatch
    syspatch # re-run new syspatch command as instructed
    rm /root/syspatch
    dev_mkdb
Most people use seperate /usr partition and won't need this because
syspatch(8) will just work.
This commit is contained in:
deraadt
2025-10-27 16:30:24 +00:00
parent 1fc5576e26
commit abf9f467da

View File

@@ -1,6 +1,6 @@
#!/bin/ksh
#
# $OpenBSD: syspatch.sh,v 1.168 2023/12/13 17:50:23 ajacoutot Exp $
# $OpenBSD: syspatch.sh,v 1.169 2025/10/27 16:30:24 deraadt Exp $
#
# Copyright (c) 2016, 2017 Antoine Jacoutot <ajacoutot@openbsd.org>
#
@@ -91,10 +91,15 @@ checkfs()
set +e # ignore errors due to:
# - nonexistent files (i.e. syspatch is installing new files)
# - broken interpolation due to bogus devices like remote filesystems
eval $(cd / &&
stat -qf "_dev=\"\${_dev} %Sd\";
local %Sd=\"\${%Sd:+\${%Sd}\+}%Uz\"" ${_files}) \
2>/dev/null
for _f in ${_files}; do
_fdev=$(df /${_f} 2>/dev/null | grep "^/dev/" | \
cut -d' ' -f1 | cut -d/ -f3)
[[ -n ${_fdev} ]] || continue
_dev="${_dev} ${_fdev}"
eval $(stat -qf "local ${_fdev}=\$((\$${_fdev}+%Uz))" /${_f} ) \
2>/dev/null
done
set -e
for _d in $(printf '%s\n' ${_dev} | sort -u); do