Fix dataoff
attribute access on ext_fnhdr
#1611
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue discription
Just discovered on some of my OBS project the error while building:
Attempt to fix
I quickly looked through the code and noticed that the last commits probably introduce a broken logic:
The
dataoff
attribute ofext_fnhdr
can be existent only after calling theself._appendHdr()
function. However, this function internally have a note that it happens only in some conditions while handling something that have 'very log filenames'. Soext_fnhdr
could be None after all.The commit 'd61b781' probably introduces an optimisation to read
ext_fnhdr_data
once and beforehand before the next while loop will be repeatedly accessing it. However, in some cases as noted inself._appendHdr()
theext_fnhdr
could be None, so I added here a condition to prepareext_fnhdr_data
only ifext_fnhdr
is not None.The code that access
ext_fnhdr_data
is assumed to be only for 'very long filenames' handling, so if no 'very long filenames' that no attempt to access toext_fnhdr_data
. So it is probably safe to leaveext_fnhdr_data
as None.The assertion error
After patching the code to pass previously described issue the next assertion check is occurs:
I guess the assertion is checking the condition that the next code actually will handle the 'very long filenames'. So if the check is not pass that I think some guard is missing.
Previous code had the condition to
continue
while loop that probably prevented handling thevery long filenames
if they actually are not.So I just restored it and everything becomes works fine.
I didn't go deep into the task's domain but just handled errors. So please check the suggestion to merge carefully.