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

High inode number result in a CPIOException #12

Open
hoinmic opened this issue Jan 10, 2025 · 3 comments
Open

High inode number result in a CPIOException #12

hoinmic opened this issue Jan 10, 2025 · 3 comments

Comments

@hoinmic
Copy link

hoinmic commented Jan 10, 2025

The inode value is saved in https://github.com/sbabic/swugenerator/blob/main/swugenerator/swu_file.py#L86 and checked in https://github.com/sbabic/swugenerator/blob/main/swugenerator/swu_file.py#L108-L116.

An inode is usually an unsigned 64 bit value. Here, however, it is checked for 32 bits (signed).

What exactly is the intention of this IF? Should all fields really be checked?

Accordingly, the script does not work on my XFS filesystem with high inode numbers.

(.venv) ansible@antares-01:/var/tmp/dummy$ swugenerator -s sw-description -o dummy.swu  create
Traceback (most recent call last):
  File "/home/ansible/swugenerator/.venv/bin/swugenerator", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/ansible/swugenerator/.venv/lib/python3.11/site-packages/swugenerator/main.py", line 324, in main
    parse_args(sys.argv[1:])
  File "/home/ansible/swugenerator/.venv/lib/python3.11/site-packages/swugenerator/main.py", line 316, in parse_args
    args.func(args)
  File "/home/ansible/swugenerator/.venv/lib/python3.11/site-packages/swugenerator/main.py", line 191, in create_swu
    swu.process()
  File "/home/ansible/swugenerator/.venv/lib/python3.11/site-packages/swugenerator/generator.py", line 288, in process
    self.cpiofile.addartifacttoswu(artifact.fullfilename)
  File "/home/ansible/swugenerator/.venv/lib/python3.11/site-packages/swugenerator/swu_file.py", line 67, in addartifacttoswu
    self.write_header(cpio_filename)
  File "/home/ansible/swugenerator/.venv/lib/python3.11/site-packages/swugenerator/swu_file.py", line 113, in write_header
    raise CPIOException("STOP: value out of range", i, value)
swugenerator.swu_file.CPIOException: ('STOP: value out of range', 0, 6982369213)

thx

@hoinmic hoinmic changed the title High inode numbers result in a CPIOException High inode number result in a CPIOException Jan 10, 2025
@sbabic
Copy link
Owner

sbabic commented Jan 12, 2025

Who rules is the CPIO format, and the new ASCII header is used. In this format, each field is 8 byte ASCII, that is a 32 bit value. However, SWUpdate relies just on the size of the artifact, and the rest of fields like inode are ignored and they can be zeroed. Fields don't need to be checked, this is just to make them CPIO compliant. Instead of raising an exception, all fields but size could be zeroed. In case of size, the exception must remain, because at the moment there is no support for single artifact greater than 4GB due to this limitation.

@hoinmic
Copy link
Author

hoinmic commented Jan 14, 2025

Sorry for the strange question, but I don't understand it right now. Why does the 8Byte ASCII value of the ascii_header ( https://github.com/sbabic/swupdate/blob/master/include/cpiohdr.h#L34-L50 ) not lead to a 64bit value?

@sbabic
Copy link
Owner

sbabic commented Jan 14, 2025

Sorry for the strange question, but I don't understand it right now. Why does the 8Byte ASCII value of the ascii_header ( https://github.com/sbabic/swupdate/blob/master/include/cpiohdr.h#L34-L50 ) not lead to a 64bit value?

Because it is ASCII and not a BINARY. The format is "new ASCII", all fields are human readableA, but you need two bytes to represent a single byte. Just open the SWU and you see the reason.

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

No branches or pull requests

2 participants