Skip to content

Commit

Permalink
test gufi_stat_bin format width without format sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
calccrypto committed Feb 14, 2025
1 parent cfa2550 commit b44cef6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/gufi_stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static int print_callback(void * args, int count, char **data, char **columns) {
/* if the first character starts a number */
int width = 0;
if (*f && (((*f == '-') || (*f == '+') ||
(('0' <= *f) && (*f <= '9'))))) {
(('0' <= *f) && (*f <= '9'))))) {
int multiplier = 1;
if (*f == '-') {
multiplier = -1;
Expand Down
3 changes: 1 addition & 2 deletions test/regression/gufi_stat_bin.expected
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ prefix/unusual#? directory
'prefix/unusual#? directory ,/unusual, name?#' prefix/unusual#? directory ,/unusual, name?# 'prefix/unusual#? directory ,/unusual, name?#' 664 -rw-rw-r-- ? ? 81b4 regular file 15 - 0 1970-01-01 00:00:15 +0000 15 1970-01-01 00:00:15 +0000 15

# bad print format specifier
?

??prefix?prefix?prefix
'prefix/directory/subdirectory/directory_symlink' -> 'prefix/directory/subdirectory' prefix/directory/subdirectory/directory_symlink 777 lrwxrwxrwx -- -- ? ? a1ff symbolic link 'prefix/directory/subdirectory/directory_symlink' -> 'prefix/directory/subdirectory' - 0 1970-01-01 00:00:04 +0000 4 1970-01-01 00:00:04 +0000 4
'prefix/file_symlink' -> 'prefix/1KB' prefix/file_symlink 777 lrwxrwxrwx -- -- ? ? a1ff symbolic link 'prefix/file_symlink' -> 'prefix/1KB' - 0 1970-01-01 00:00:09 +0000 9 1970-01-01 00:00:09 +0000 9

Expand Down
5 changes: 4 additions & 1 deletion test/regression/gufi_stat_bin.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ echo "# custom print format"
echo

echo "# bad print format specifier"
"${GUFI_STAT_BIN}" -f '%e\n' "${INDEXROOT}"
"${GUFI_STAT_BIN}" -f '%e' "${INDEXROOT}"
"${GUFI_STAT_BIN}" -f '%-60' "${INDEXROOT}"
"${GUFI_STAT_BIN}" -f '%+' "${INDEXROOT}"
"${GUFI_STAT_BIN}" -f '%' "${INDEXROOT}"
echo

for entry in "${symlinks[@]}"
Expand Down

0 comments on commit b44cef6

Please sign in to comment.