Skip to content

Commit

Permalink
fixup! Added check for files bigger than 4GB (#186)
Browse files Browse the repository at this point in the history
* Loop will break if filename contains newline(which is possible), use null-separated list instead.

Refer-to: For loops over find output are fragile. Use find -exec or a while read loop. - SC2044 · koalaman/shellcheck Wiki <https://github.com/koalaman/shellcheck/wiki/SC2044>
Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
  • Loading branch information
brlin-tw committed May 8, 2018
1 parent fe83365 commit 981bbde
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/woeusb
Original file line number Diff line number Diff line change
Expand Up @@ -1104,25 +1104,19 @@ workaround_buggy_motherboards_that_ignore_disks_without_boot_flag_toggled(){
check_fat32_filesize_limitation(){
util_check_function_parameters_quantity 1 $#
local -r source_fs_mountpoint="${1}"
local IFS_backup=$IFS

IFS=$'\n'
for file in ` find "${source_fs_mountpoint}" -type f `; do
if (( $(stat -c "%s" $file) > 4294967295 )); then # Max fat32 file size is 2^32 - 1 bytes
while IFS= read -r -d '' file; do
if (( "$(stat -c '%s' "${file}")" > 4294967295 )); then # Max fat32 file size is 2^32 - 1 bytes
printf_with_color\
red\
'Error: File "%s" in source image has exceed the FAT32 Filesystem 4GiB Single File Size Limitation and cannot be installed. You must specify a different --target-filesystem.\n'\
"${file}"
prntf_with_color\
red\
'Refer: https://github.com/slacka/WoeUSB/wiki/Limitations#fat32-filesystem-4gib-single-file-size-limitation for more info.\n'
IFS=$IFS_backup
unset IFS_backup
return 1
fi
done
IFS=$IFS_backup
unset IFS_backup
done < <(find "${source_fs_mountpoint}" -type f)
return 0
}; declare -fr check_fat32_filesize_limitation

Expand Down

0 comments on commit 981bbde

Please sign in to comment.