WoeUSB-ng icon indicating copy to clipboard operation
WoeUSB-ng copied to clipboard

Silent failure based on filename

Open NickSto opened this issue 3 years ago • 2 comments

It looks like this has a similar issue to slacka/WoeUSB#206: The USB creation failed, then after I renamed the iso file, it succeeded.

Good Habit Checklist for Issue Reporting

  • [x] I've searched the issue tracker and is pretty sure that there's no duplicate issue already filed
  • [x] I've built the latest development snapshot using the instructions in README and verified that the issue can still be reproduced (for bug reports)

Issue Reproduce Instructions

  1. I installed the latest release (v0.2.10), which I see is also the latest development version.
  2. I launched it with /usr/local/bin/woeusbgui
  3. I selected my iso: a Windows 10 21H1 named Windows 10 [bits 64] [down 2021-07-14] [name Win10_21H1_English_x64].iso
  4. I selected my target device - a 7.4GB Kanguru USB drive
  5. I hit "Install"

Then I renamed the iso to its original filename (Win10_21H1_English_x64.iso) and tried again. It succeeded this time.

Expected Behavior

It actually installs the iso onto the USB drive

Current Behavior

It returns instantly with an installation succeeded message. But in the console it gives the traceback I pasted below.

Info of My Environment

WoeUSB Version

v0.2.10

WoeUSB Source

Installed from the release .tar.gz according to the README

  • using sudo python3 -m pip install .

Information about the Operating System

Ubuntu 20.04.3 LTS

Information about the Source Media

Windows 10 version 21H1

  • Win10_21H1_English_x64.iso
  • sha256sum: 6911e839448fa999b07c321fc70e7408fe122214f5c4e80a9ccc64d22d0d85ea

Information about the Target Device

Kanguru Flashblu 30 8GB

Traceback

$ /usr/local/bin/woeusbgui 
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/dist-packages/WoeUSB/gui.py", line 403, in run
    core.main(source_fs_mountpoint, target_fs_mountpoint, self.source, self.target, "device", temp_directory,
  File "/usr/local/lib/python3.8/dist-packages/WoeUSB/core.py", line 155, in main
    if utils.check_source_and_target_not_busy(install_mode, source_media, target_device, target_partition):
  File "/usr/local/lib/python3.8/dist-packages/WoeUSB/utils.py", line 151, in check_source_and_target_not_busy
    if check_is_target_device_busy(source_media):
  File "/usr/local/lib/python3.8/dist-packages/WoeUSB/utils.py", line 134, in check_is_target_device_busy
    if re.findall(device, mount) != []:
  File "/usr/lib/python3.8/re.py", line 241, in findall
    return _compile(pattern, flags).findall(string)
  File "/usr/lib/python3.8/re.py", line 304, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.8/sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "/usr/lib/python3.8/sre_parse.py", line 948, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "/usr/lib/python3.8/sre_parse.py", line 443, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
  File "/usr/lib/python3.8/sre_parse.py", line 598, in _parse
    raise source.error(msg, len(this) + 1 + len(that))
re.error: bad character range 1-0 at position 55

NickSto avatar Jan 16 '22 07:01 NickSto

Huh, @jacobgkau, can you look at this? I'm not familiar with re so it might be easier for you to fix.

WaxyMocha avatar Feb 27 '22 16:02 WaxyMocha

From a quick glance, it looks like it might be using the raw filename string as a regex in re.findall(). You're gonna run into some pain doing that, if the filename contains any special regex characters (there's a lot). If you're just trying to find it in the output of mount, that doesn't require regex at all. You could just do a simple substring in string search.

NickSto avatar Feb 27 '22 17:02 NickSto