Closed SidewinderGER closed 1 month ago
I just realized there is another issue with this piece of code. Immediately following the code block mentioned above there is the following line:
rc=$?
Before the fix to #288 , this line always captured the return code from the resize2fs
command. However, with the introduction of the code block for setting $mountdir
on demand, it may capture the return code of the mktemp
command, which is most probably not intended. The line rc=$?
should be moved up above the if
block.
Wow, what an almost comical set of oversights on my part. Thank you so much for the detailed report and fixes, I'll get them address ASAP.
To anyone who reads this remember to never code exhausted 😅
version="v24.10.10"
First of all, thanks for this great tool!
The recent bugfix for #288 did not work as intended. In certain situations, PiShrink still fills up the entire machine's space with a file called
/PiShrink_zero_file
containing of all zeroes.The issue is in line 353ff. The following code got recently added there:
The purpose of this code is to set
$mountdir
to a temporary path in case it does not have a value assigned already. Unfortunately, there are two issues here:$mount_dir
before running the script).-n
(test for non-empty string) is inappropriate, it should have been-z
(test for empty string).Hence, the code should rather be:
After applying this fix in my working copy, the script works as expected.