1#!/bin/sh 2 3# 4# Copyright (c) 2026 Peter Holm <pho@FreeBSD.org> 5# 6# SPDX-License-Identifier: BSD-2-Clause 7# 8 9# "nullfs mount over a file" scenario 10 11set -u 12prog=$(basename "$0" .sh) 13 14file=/tmp/$prog.file 15mp=/tmp/$prog.mp 16touch $file $mp 17 18s=0 19mount_nullfs $file $mp || exit 1 20echo a > $mp 21cmp -s $file $mp || 22 { echo "Files differ"; ls -l $file $mp; s=1; } 23umount $mp 24cmp -s $file $mp && 25 { echo "Files are equal"; ls -l $file $mp; s=2; } 26 27rm -f $file $mp 28exit $s 29