Skip to content

Commit 704d9c2

Browse files
committed
Fix audit server code to handle --* controller names
1 parent 8f99876 commit 704d9c2

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

server/bin/pbench-audit-server.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function verify_incoming {
194194
# directory, handled in another part of the audit.
195195
continue
196196
fi
197-
lclreport="${workdir}/$(basename ${controller})"
197+
lclreport="${workdir}/$(basename -- ${controller})"
198198
> ${lclreport}
199199

200200
tarball_dirs="${workdir}/tarballdirs"
@@ -277,7 +277,7 @@ function verify_results {
277277
# directory, handled in another part of the audit.
278278
continue
279279
fi
280-
lclreport="${workdir}/$(basename ${controller})"
280+
lclreport="${workdir}/$(basename -- ${controller})"
281281
> ${lclreport}
282282

283283
# The hierarchy of a controller in the results tree should only
@@ -328,7 +328,7 @@ function verify_results {
328328
wrong_user_links="${workdir}/wronguserlinks"
329329
> ${wrong_user_links}
330330
while read path link ; do
331-
tb=$(basename ${path})
331+
tb=$(basename -- ${path})
332332
if [ ! -e $ARCHIVE/${controller}/${tb}.tar.xz ]; then
333333
# The tar ball does not exist in the archive hierarchy.
334334
printf "\t\t${path}\n" >> ${invalid_tb_links}
@@ -342,7 +342,7 @@ function verify_results {
342342
# a directory or link in the incoming hierarchy.
343343
printf "\t\t${path}\n" >> ${invalid_tb_dir_links}
344344
else
345-
prefix_path=$(dirname ${path})
345+
prefix_path=$(dirname -- ${path})
346346
prefix_file="$ARCHIVE/${controller}/.prefix/${tb}.prefix"
347347
# Version 002 agents use the metadata log to store a
348348
# prefix.
@@ -484,9 +484,9 @@ function verify_controllers {
484484
elif [ "${hierarchy_root}" = "$RESULTS" ]; then
485485
kind="results"
486486
user=""
487-
elif [ "$(dirname ${hierarchy_root})" = "$USERS" ]; then
487+
elif [ "$(dirname -- ${hierarchy_root})" = "$USERS" ]; then
488488
kind="results"
489-
user=$(basename ${hierarchy_root})
489+
user=$(basename -- ${hierarchy_root})
490490
else
491491
printf "${PROG}: verify_controllers bad argument, hierarchy_root=\"${hierarchy_root}\"\n" >&2
492492
return 1
@@ -502,7 +502,7 @@ function verify_controllers {
502502
> ${controllers}.unsorted
503503
find ${hierarchy_root} -maxdepth 1 \
504504
\( ! -type d -fprintf ${unexpected_objects}.unsorted "\t%f\n" \) \
505-
-o \( -type d ! -name . ! -name $(basename ${hierarchy_root}) -fprintf ${controllers}.unsorted "%f\n" \)
505+
-o \( -type d ! -name . ! -name $(basename -- ${hierarchy_root}) -fprintf ${controllers}.unsorted "%f\n" \)
506506
status=$?
507507
if [ $status -ne 0 ]; then
508508
printf "*** ERROR *** unable to traverse hiearchy ${hierarchy_root}: find failed with $status\n"
@@ -599,7 +599,7 @@ function verify_users {
599599
> ${users}.unsorted
600600
find $USERS -maxdepth 1 \
601601
\( ! -type d -fprintf ${unexpected_objects}.unsorted "\t%f\n" \) \
602-
-o \( -type d ! -name . ! -name $(basename $USERS) -fprintf ${users}.unsorted "%f\n" \)
602+
-o \( -type d ! -name . ! -name $(basename -- $USERS) -fprintf ${users}.unsorted "%f\n" \)
603603
status=$?
604604
if [ $status -ne 0 ]; then
605605
printf "*** ERROR *** unable to traverse hiearchy $USERS: find failed with $status\n"
@@ -638,7 +638,7 @@ function verify_archive {
638638
> ${controllers}.unsorted
639639
find $ARCHIVE -maxdepth 1 \
640640
\( ! -type d -fprintf ${bad_controllers}.unsorted "\t%M %10s %t %f\n" \) \
641-
-o \( -type d ! -name . ! -name $(basename $ARCHIVE) -fprintf ${controllers}.unsorted "%p\n" \)
641+
-o \( -type d ! -name . ! -name $(basename -- $ARCHIVE) -fprintf ${controllers}.unsorted "%p\n" \)
642642
if [ $? -gt 0 ]; then
643643
printf "\n*** ERROR *** unable to traverse $ARCHIVE hierarchy\n"
644644
let cnt=cnt+1
@@ -657,21 +657,21 @@ function verify_archive {
657657
# $ARCHIVE directory itself, while keeping them all in sorted order.
658658
sort ${controllers}.unsorted > ${controllers}
659659
while read controller ;do
660-
lclreport="${workdir}/$(basename ${controller})"
660+
lclreport="${workdir}/$(basename -- ${controller})"
661661
> ${lclreport}
662662

663663
> ${directories}.unsorted
664664
> ${unexpected_symlinks}.unsorted
665665
> ${unexpected_objects}.unsorted
666666
> ${tarballs}
667667
find ${controller} -maxdepth 1 \
668-
\( -type d ! -name . ! -name $(basename ${controller}) ! -name .prefix -fprintf ${directories}.unsorted "\t %f\n" \) \
668+
\( -type d ! -name . ! -name $(basename -- ${controller}) ! -name .prefix -fprintf ${directories}.unsorted "\t %f\n" \) \
669669
-o \( -type l -fprintf ${unexpected_symlinks}.unsorted "\t %f -> %l\n" \) \
670670
-o \( -type f ! -name '*.tar.xz.md5' ! -name '*.tar.xz' -fprintf ${unexpected_objects}.unsorted "\t %f\n" \) \
671671
-o \( -type f \( -name '*.tar.xz.md5' -o -name '*.tar.xz' \) -fprintf ${tarballs} "%f\n" \)
672672
status=$?
673673
if [ $status -gt 0 ]; then
674-
printf "*** ERROR *** unable to traverse controller hierarchy for $(basename ${controller}): find failed with $status\n" >> ${lclreport}
674+
printf "*** ERROR *** unable to traverse controller hierarchy for $(basename -- ${controller}): find failed with $status\n" >> ${lclreport}
675675
let cnt=cnt+1
676676
else
677677
sort ${directories}.unsorted > ${directories}
@@ -689,7 +689,7 @@ function verify_archive {
689689
rm -f ${tarballs}
690690

691691
if [ -s ${lclreport} ]; then
692-
printf "\nController: $(basename ${controller})\n"
692+
printf "\nController: $(basename -- ${controller})\n"
693693
cat ${lclreport}
694694
let cnt=cnt+1
695695
fi

0 commit comments

Comments
 (0)