freebsd-dev/sbin
Kirk McKusick a3628327e7 Ensure that files with no allocated blocks are trimmed to zero length.
UFS does not allow files to end with a hole; it requires that the
last block of a file be allocated. As fsck_ffs(8) initially scans
each allocated inode, it tracks the last allocated block in the
inode. It then checks that the inode's size falls in the last
allocated block. If the last allocated block falls before the size,
a `file size beyond end of allocated file' warning is issued and
the file is shortened to reference the last allocated block (to avoid
having it reference a hole at its end). If the last allocated block
falls after the size, a `partially truncated file' warning is issued
and all blocks following the block referenced by the size are freed.

Because of an incorrect unsigned comparison, this test was failing
to handle files with no allocated blocks but non-zero size (which
should have had their size reset to zero). Once that was fixed the
test started incorrectly complaining about short symbolic links
that place the link path in the inode rather than in a disk block.
Because these symbolic links have a non-zero size, but no allocated
blocks, fsck_ffs wanted to zero out their size. This patch has to
detect and avoid changing the size of such symbolic links.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    1 week
Sponsored by: Netflix
2021-05-11 14:52:26 -07:00
..
adjkerntz
bectl sbin/bectl: Skip tests if sparse files are not supported 2021-02-03 09:31:32 +00:00
bsdlabel
camcontrol Cross-reference camcontrol(8) and zonectl(8) man pages. 2021-04-10 10:13:29 +01:00
ccdconfig
clri
comcontrol
conscontrol
ddb
decryptcore decryptcore: do not include sys/sysctl.h 2021-03-07 17:29:03 -06:00
devd devd.conf: Remove support for coldsync 2021-05-07 14:31:08 -04:00
devfs add documentation that the rules need to be reloaded, and how to do it... 2020-12-01 23:25:21 +00:00
devmatch devmatch(8): Fix section ordering 2020-11-20 16:34:01 +00:00
dhclient dhclient(8): Bugfixes for some issues reported by mandoc 2020-10-03 18:42:15 +00:00
dmesg
dump Remove #define _KERNEL hacks from libprocstat 2021-02-21 11:38:21 +02:00
dumpfs
dumpon dumpon.8: Ask DDB to call doadump() rather than calling it directly 2021-03-08 12:39:05 -05:00
etherswitchcfg
fdisk
ffsinfo ffsinfo: Update example to avoid to-be-deprecated vinum 2021-04-03 16:29:14 -04:00
fsck Fix a few mandoc issues 2020-10-09 14:03:45 +00:00
fsck_ffs Ensure that files with no allocated blocks are trimmed to zero length. 2021-05-11 14:52:26 -07:00
fsck_msdosfs Use %ju and cast to (uintmax_t) to avoid using PRI* macros. 2020-09-28 04:30:31 +00:00
fsdb Rewrite the disk I/O management system in fsck_ffs(8). Other than 2021-01-07 15:03:15 -08:00
fsirand Filesystem utilities that modify the filesystem (growfs(8), tunefs(8), 2020-10-25 01:36:33 +00:00
gbde
geom geom(8): list geoms with /dev/ prefix 2020-12-12 07:22:38 +00:00
ggate build: remove LIBPTHREAD/LIBTHR build options 2021-01-22 12:33:27 -06:00
growfs add Xr to the rc.d script... 2021-04-06 16:32:57 -07:00
gvinum gvinum: add deprecation notice 2021-03-28 14:45:05 -04:00
hastctl
hastd hastd(8) assumes it has no extra file descriptors opened 2020-11-29 13:45:53 +00:00
ifconfig ifconfig: Minor documentation fix 2021-05-03 14:38:52 +03:00
init ttys: diff reduction 2021-05-04 14:06:31 -06:00
ipf
ipfw ipfw.8: Fix table example 2021-05-11 17:38:26 +02:00
iscontrol
kldconfig kldconfig(8): Add EXAMPLES to the man page 2020-09-29 17:52:15 +00:00
kldload kldload(8): Improve phrasing 2021-02-11 06:03:53 +01:00
kldstat
kldunload
ldconfig ldconfig: Retire a.out support 2020-12-31 10:29:08 -05:00
md5
mdconfig [skip ci] fix a typo in a comment in mdconfig.c 2021-03-02 18:33:45 -07:00
mdmfs mdmfs(8): Fix an issue reported by mandoc 2020-10-03 18:47:50 +00:00
mknod
mksnap_ffs Remove #define _KERNEL hacks from libprocstat 2021-02-21 11:38:21 +02:00
mount
mount_cd9660
mount_fusefs
mount_msdosfs Fix a few mandoc issues 2020-10-09 14:03:45 +00:00
mount_nfs mount_nfs: update man page description for oneopenown 2021-01-17 19:00:41 -08:00
mount_nullfs mount_nullfs: rename a local variable 2021-02-12 11:30:52 -07:00
mount_udf
mount_unionfs
natd
newfs Explain the newfs naming convention 2021-04-17 23:16:17 +02:00
newfs_msdos
nfsiod
nos-tun
nvmecontrol nvmecontrol: fix typo (s/Managment/Management/) 2021-05-07 13:12:30 +01:00
pfctl pf: Support killing 'matching' states 2021-05-07 22:13:31 +02:00
pfilctl pfilctl: improve formatting of "hooks" and "heads" command output. 2021-03-19 11:18:05 -07:00
pflogd
ping ICMP checksum test: Fix for big endian 2021-01-11 19:03:46 -07:00
ping6 Merge ping6 to ping 2020-11-26 04:29:30 +00:00
quotacheck
rcorder [rcorder] [crunch] Fix C function declarations to include void 2020-09-21 17:59:45 +00:00
reboot Address a mandoc warning 2020-11-10 14:17:05 +00:00
recoverdisk Register the bad read before bailing on terminal errors. 2021-02-02 12:01:38 +00:00
resolvconf
restore
route route(8): Add an example how to print the routing tables 2021-04-13 06:45:22 +02:00
routed sbin/routed: Remove unused code for sgi and NetBSD. 2020-12-25 17:42:47 -08:00
rtsol
savecore savecore: bail on write error even when decompressing 2020-12-11 22:52:12 +00:00
sconfig
setkey
shutdown
spppcontrol
swapon
sysctl Fix building sysctl(8) after c78ad20 2021-05-01 11:10:03 +00:00
tests
tunefs Remove #define _KERNEL hacks from libprocstat 2021-02-21 11:38:21 +02:00
umount
veriexec veriexec(8): Bugfix for an issue reported by mandoc 2020-10-03 18:46:42 +00:00
zfsbootcfg loader: zfs should support bootonce an nextboot 2020-09-21 09:01:10 +00:00
Makefile Merge ping6 to ping 2020-11-26 04:29:30 +00:00
Makefile.amd64
Makefile.arm
Makefile.i386
Makefile.inc build: provide a default WARNS for all in-tree builds 2020-09-18 17:17:46 +00:00
Makefile.mips
Makefile.powerpc64