1*ee1c3d38SAlan Somers# SPDX-License-Identifier: BSD-2-Clause 2*ee1c3d38SAlan Somers# 3*ee1c3d38SAlan Somers# Copyright (c) 2026 ConnectWise 4*ee1c3d38SAlan Somers# All rights reserved. 5*ee1c3d38SAlan Somers# 6*ee1c3d38SAlan Somers# Redistribution and use in source and binary forms, with or without 7*ee1c3d38SAlan Somers# modification, are permitted provided that the following conditions 8*ee1c3d38SAlan Somers# are met: 9*ee1c3d38SAlan Somers# 1. Redistributions of source code must retain the above copyright 10*ee1c3d38SAlan Somers# notice, this list of conditions and the following disclaimer. 11*ee1c3d38SAlan Somers# 2. Redistributions in binary form must reproduce the above copyright 12*ee1c3d38SAlan Somers# notice, this list of conditions and the following disclaimer in the 13*ee1c3d38SAlan Somers# documentation and/or other materials provided with the distribution. 14*ee1c3d38SAlan Somers# 15*ee1c3d38SAlan Somers# THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16*ee1c3d38SAlan Somers# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17*ee1c3d38SAlan Somers# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18*ee1c3d38SAlan Somers# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19*ee1c3d38SAlan Somers# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20*ee1c3d38SAlan Somers# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21*ee1c3d38SAlan Somers# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22*ee1c3d38SAlan Somers# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23*ee1c3d38SAlan Somers# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24*ee1c3d38SAlan Somers# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25*ee1c3d38SAlan Somers 26*ee1c3d38SAlan Somers# Regression test for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295957 27*ee1c3d38SAlan Somers# 28*ee1c3d38SAlan Somers# Almost any fuse file system would work, but this tests uses fusefs-ext2 29*ee1c3d38SAlan Somers# because it's simple and its download is very small. 30*ee1c3d38SAlan Somersatf_test_case execute cleanup 31*ee1c3d38SAlan Somersexecute_head() 32*ee1c3d38SAlan Somers{ 33*ee1c3d38SAlan Somers atf_set "descr" "Execute a file mounted on a fusefs file system" 34*ee1c3d38SAlan Somers atf_set "require.user" "root" 35*ee1c3d38SAlan Somers atf_set "require.progs" "fuse-ext2 mkfs.ext2" 36*ee1c3d38SAlan Somers atf_set "require.kmods" "fusefs" 37*ee1c3d38SAlan Somers} 38*ee1c3d38SAlan Somersexecute_body() 39*ee1c3d38SAlan Somers{ 40*ee1c3d38SAlan Somers atf_check mkdir mnt 41*ee1c3d38SAlan Somers atf_check truncate -s 64m ext2.img 42*ee1c3d38SAlan Somers atf_check -o ignore -e ignore mkfs.ext2 ext2.img 43*ee1c3d38SAlan Somers atf_check fuse-ext2 -o rw+ ext2.img mnt 44*ee1c3d38SAlan Somers atf_check cp /usr/bin/true mnt 45*ee1c3d38SAlan Somers atf_check su -m nobody -c mnt/true 46*ee1c3d38SAlan Somers} 47*ee1c3d38SAlan Somersexecute_cleanup() 48*ee1c3d38SAlan Somers{ 49*ee1c3d38SAlan Somers umount $PWD/mnt || true 50*ee1c3d38SAlan Somers} 51*ee1c3d38SAlan Somers 52*ee1c3d38SAlan Somersatf_init_test_cases() 53*ee1c3d38SAlan Somers{ 54*ee1c3d38SAlan Somers atf_add_test_case execute 55*ee1c3d38SAlan Somers} 56