High inode number result in a CPIOException
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
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.
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?
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.