Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use os.path.relpath instead of lstrip in wifi.py #277

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AdityaGarg8
Copy link

No description provided.

Using lstrip sometimes broken the folder names in wifi folder by removing
the "C" in the relpath.

A code similar to the following was added to debug:

if props:
    log.error(f"Unhandled properties found: {props} in file {relpath}")

assert not props

and the result was:

Unhandled properties found: {'': '4355'} in file -4355__s-C1/P-hawaii-ID_M-YSBC_V-m__m-2.3.txt
Traceback (most recent call last):
  File "/home/aditya/firmware.sh", line 905, in <module>
    wifi_col = WiFiFWCollection(sys.argv[1]+"/wifi")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aditya/firmware.sh", line 737, in __init__
    self.load(source_path)
  File "/home/aditya/firmware.sh", line 776, in load
    assert not props
AssertionError

Signed-off-by: Aditya Garg <gargaditya08@live.com>
@AdityaGarg8
Copy link
Author

Although the issue is something that happens once in a blue moon, probably because I use temporary directories to rename firmware on Linux, extracted from macOS Recovery Images.

@AdityaGarg8
Copy link
Author

AdityaGarg8 commented May 31, 2024

I found a way to reproduce the issue. If a folder in the source_path has a "C" in its name, the error is seen:

aditya@fedora:~$ python3 firmware.sh '/tmp/tmp.Gy9UaW6UCjs/usr/share/firmware' fw.tar
Unhandled properties found: {'': '4377'} in file -4377__s-B3/P-fiji-ID_M-SPPR_V-m__m-2.1.txt
Traceback (most recent call last):
  File "/home/aditya/firmware.sh", line 905, in <module>
    wifi_col = WiFiFWCollection(sys.argv[1]+"/wifi")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aditya/firmware.sh", line 737, in __init__
    self.load(source_path)
  File "/home/aditya/firmware.sh", line 776, in load
    assert not props
AssertionError

@AdityaGarg8
Copy link
Author

After the change in this PR, the bug seems to be fixed.

@AdityaGarg8 AdityaGarg8 changed the title Use os.path.relpath instead of lstrip Use os.path.relpath instead of lstrip in wifi.py May 31, 2024
@AdityaGarg8
Copy link
Author

BTW, on macOS Sonoma, the wifi.py always failed for me ever since macOS Sonoma has been released. I got this log from there today:

aditya@fedora:~$ python3 firmware.sh '/run/media/aditya/macOS Base System/usr/share/firmware' fw.tar
Unhandled properties found: {'gen': 'ID'} in file C-4388__s-C0/java_gen-ID.clmb
Traceback (most recent call last):
  File "/home/aditya/firmware.sh", line 907, in <module>
    wifi_col = WiFiFWCollection(sys.argv[1]+"/wifi")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aditya/firmware.sh", line 739, in __init__
    self.load(source_path)
  File "/home/aditya/firmware.sh", line 778, in load
    assert not props
AssertionError

Currently as a workaround I am making the script extract firmware for my model only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant