nongiach / arm_now

arm_now is a qemu powered tool that allows instant setup of virtual machines on arm cpu, mips, powerpc, nios2, x86 and more, for reverse, exploit, fuzzing and programming purpose.
https://github.com/nongiach/arm_now/wiki
MIT License
867 stars 87 forks source link

Resizing filesystem with --correct option fails #49

Open MrH100000 opened 3 years ago

MrH100000 commented 3 years ago

I attempted to resize the filesystem with the arm_now resize +1G --correct command. It successfully resized the partition, but failed when trying to correct the filesystem with the following error:

resize2fs 1.44.1 (24-Mar-2018)
Resizing the filesystem on arm_now/rootfs.ext2 to 1150976 (1k) blocks.
The filesystem on arm_now/rootfs.ext2 is now 1150976 (1k) blocks long.

-rw-r--r-- 1 username users 1.1G Feb 18 20:21 arm_now/rootfs.ext2
[+] Resized to +1G
Traceback (most recent call last):
  File "/usr/local/bin/arm_now", line 11, in <module>
    load_entry_point('arm-now==1.26', 'console_scripts', 'arm_now')()
  File "/usr/local/lib/python3.6/dist-packages/arm_now/arm_now.py", line 88, in main
    do_resize(a["<new_size>"], a["--correct"])
  File "/usr/local/lib/python3.6/dist-packages/arm_now/arm_now.py", line 281, in do_resize
    fs.correct()
  File "/usr/lib/python3.6/contextlib.py", line 52, in inner
    return func(*args, **kwds)
  File "/usr/local/lib/python3.6/dist-packages/arm_now/filesystem.py", line 73, in correct
    porange("[+] Correcting ... (be patient)".format(size=size))
NameError: name 'size' is not defined

This seems to be because of an unnecessary variable .format(size=size) when the program is printing the status message.

I think this would be fixed either by #12 , or by removing .format(size=size) from the status message in the filesystem correct() function. https://github.com/nongiach/arm_now/blob/e631a88d2b9763711d0d439154a98324993ce73d/arm_now/filesystem.py#L73