Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm: rm -f should not fail #1329

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions bin/ls/tests/ls_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,31 @@
atf_check_equal "$(cat $WITH_1)" "$(cat $WITHOUT_1)"
}

atf_test_case l_flag_nonexistent_msdosfs cleanup
l_flag_nonexistent_msdosfs_head()
{
atf_set "descr" "Verify that -l nonexistent* prints out the right error on MS-DOS file systems"
atf_set "require.user" root
}

l_flag_nonexistent_msdosfs_body()
{
# Create an MS-DOS FS mount
md=$(mdconfig -a -t swap -s 5m)
mkdir mnt
newfs_msdos -h 1 -u 63 "$md"
mount_msdosfs /dev/"${md}" mnt

atf_check -e match:'No such file or directory' -o empty -s exit:1 \
ls -l mnt/nonexistent*
}

l_flag_nonexistent_msdosfs_cleanup()
{
umount mnt
mdconfig -d -u /dev/"${md}"
}

atf_init_test_cases()
{
export BLOCKSIZE=512
Expand Down Expand Up @@ -978,4 +1003,5 @@
atf_add_test_case x_flag
atf_add_test_case y_flag
atf_add_test_case 1_flag
atf_add_test_case l_flag_nonexistent_msdosfs
}

Check warning on line 1007 in bin/ls/tests/ls_tests.sh

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
1 change: 1 addition & 0 deletions bin/mv/tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.include <bsd.own.mk>

ATF_TESTS_SH= mv_test
TAP_TESTS_SH= legacy_test

.include <bsd.test.mk>
35 changes: 35 additions & 0 deletions bin/mv/tests/mv_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env atf-sh
#-
# Copyright (c) 2024 Stefan Eßer <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
#

atf_test_case wildcard_msdosfs cleanup
wildcard_msdosfs_head()
{
atf_set "descr" "Verify that moving to * prints out the right error on MS-DOS file systems"
atf_set "require.user" root
}
wildcard_msdosfs_body()
{
# Create an MS-DOS FS mount
md=$(mdconfig -a -t swap -s 5m)
mkdir mnt
newfs_msdos -h 1 -u 63 "$md"
mount_msdosfs /dev/"${md}" mnt

atf_check -e empty -o empty -s exit:0 touch mnt/A.DAT
atf_check -e match:'No such file or directory' -o empty -s exit:1 \
mv mnt/A.DAT mnt/B*.DAT
}
wildcard_msdosfs_cleanup()
{
umount mnt
mdconfig -d -u /dev/"${md}"
}

atf_init_test_cases()
{
atf_add_test_case wildcard_msdosfs
}

Check warning on line 35 in bin/mv/tests/mv_test.sh

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
23 changes: 23 additions & 0 deletions bin/rm/tests/rm_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,30 @@
atf_check -s exit:0 unlink -- -bar
}

atf_test_case f_flag_msdosfs cleanup
f_flag_msdosfs_head()
{
atf_set "descr" "Verify that -f nonexistent* does not print an error on MS-DOS file systems"
atf_set "require.user" root
}
f_flag_msdosfs_body()
{
# Create an MS-DOS FS mount
md=$(mdconfig -a -t swap -s 5m)
mkdir mnt
newfs_msdos -h 1 -u 63 "$md"
mount_msdosfs /dev/"${md}" mnt

atf_check -s exit:0 rm -f mnt/foo*
}
f_flag_msdosfs_cleanup()
{
umount mnt
mdconfig -d -u /dev/"${md}"
}

atf_init_test_cases()
{
atf_add_test_case unlink_dash_filename
atf_add_test_case f_flag_msdosfs
}

Check warning on line 67 in bin/rm/tests/rm_test.sh

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
8 changes: 6 additions & 2 deletions sys/fs/msdosfs/msdosfs_lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,16 @@
int
msdosfs_lookup(struct vop_cachedlookup_args *ap)
{
int error;

return (msdosfs_lookup_ino(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL,
NULL));
error = msdosfs_lookup_ino(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL,
NULL);
if (error == EINVAL)
error = ENOENT;
return (error);
}

struct deget_dotdot {

Check warning on line 100 in sys/fs/msdosfs/msdosfs_lookup.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
u_long cluster;
int blkoff;
};
Expand Down
Loading