Skip to content

show readable error message when applying patch without (extracted) source#4738

Merged
boegel merged 4 commits intoeasybuilders:developfrom
Flamefire:patch-error-msg
Aug 27, 2025
Merged

show readable error message when applying patch without (extracted) source#4738
boegel merged 4 commits intoeasybuilders:developfrom
Flamefire:patch-error-msg

Conversation

@Flamefire
Copy link
Contributor

When there is no source self.src is an empty list which leads to a rather generic error message. Improve that by showing that there was no source to apply the patch to.

For extensions self.src is set to a string as only a single source is supported.
Accessing self.src[0].['finalpath'] leads to an error

TypeError: string indices must be integers
This happens when the source didn't got extracted so self.ext_dir and hence beginpath will be None.
Make the error show that the source was not extracted.

While doing that get rid of patch['source'] which can never be set as it would trigger a failure in create_patch_info as it isn't specified as an allowed key. It isn't useful anyway as only the first source will have its finalpath set correctly, the other, when unpacked to the same folder, are just referring to that folder instead of their subfolder.

@boegel boegel added this to the release after 4.9.4 milestone Feb 12, 2025
@boegel
Copy link
Member

boegel commented Feb 18, 2025

@Flamefire Any idea why that one test keeps failing here?

@Flamefire
Copy link
Contributor Author

I think this is envmodules/modules#82 caused by running the extension step multiple times without resetting the environment. I hope the new commit fixes this.

@Flamefire
Copy link
Contributor Author

Yes that was the issue :)

@Flamefire
Copy link
Contributor Author

Rebased

@boegel
Copy link
Member

boegel commented Aug 13, 2025

@Flamefire Test needs love?

UnboundLocalError: local variable 'unpack_src' referenced before assignment

…ource

When there is no source `self.src` is an empty list which leads to a
rather generic error message. Improve that by showing that there was no
source to apply the patch to.

For extensions `self.src` is set to a string as only a single source is
supported.
Accessing `self.src[0].['finalpath']` leads to an error
> TypeError: string indices must be integers
This happens when the source didn't got extracted so `self.ext_dir` and
hence `beginpath` will be `None`.
Make the error show that the source was not extracted.
@Flamefire
Copy link
Contributor Author

Rebased and fixed. The test easyblock used a generic signature.

Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@boegel boegel removed the bug fix label Aug 27, 2025
@boegel boegel merged commit 6026f49 into easybuilders:develop Aug 27, 2025
37 checks passed
@Flamefire Flamefire deleted the patch-error-msg branch August 27, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants