abuild: add test for invalid filenames

reject filenames with newlines

fixes #10024
This commit is contained in:
Natanael Copa 2021-02-04 14:34:47 +01:00
parent 9246fbc8b4
commit f35f2aa859
2 changed files with 17 additions and 2 deletions

View File

@ -804,6 +804,13 @@ postcheck() {
e=1
fi
fi
# check that we don't have any files names with newline
i=$(find "$dir" -name $'*\n*')
if [ -n "$i" ]; then
error "Found filenames with newline:"
echo "$i"
e=1
fi
# check directory permissions
i=$(find "$dir" -type d -perm -777 | sed "s|^$dir|\t|")
if [ -n "$i" ]; then

View File

@ -24,13 +24,20 @@ teardown() {
@test "abuild: build failure" {
cd testrepo/buildfail
run $ABUILD cleanpkg all
run $ABUILD all
[ $status -ne 0 ]
}
@test "abuild: test check for invalid file names" {
cd testrepo/invalid-filename
run $ABUILD all
echo "$output"
[ $status -ne 0 ]
}
@test "abuild: test check for /usr/lib64" {
cd testrepo/lib64test
run $ABUILD cleanpkg all
run $ABUILD all
[ $status -ne 0 ]
}
@ -55,3 +62,4 @@ teardown() {
[ "$checksums" = "$checksums2" ]
}