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

[bug] the file mode is ignorred when applying patches #23

Open
markvmk opened this issue Jul 11, 2023 · 0 comments
Open

[bug] the file mode is ignorred when applying patches #23

markvmk opened this issue Jul 11, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@markvmk
Copy link

markvmk commented Jul 11, 2023

If a patch creates new file, the file mode is ignored and default permissions (0644) are applied for the created file.
This results in loosing the executable permission for the generated file even though that permission was present in the patch file.

The issue was spotted when using conan's apply_conandata_patches() function which uses patch-ng to implement the patching functionality.

When a patch creates new file, it is generated in this part of the implementation:

if old == b'/dev/null':

The 'new file mode' in the patch file is only referenced here in the source, while detecting the patch type:
and re.match(b'(?:index \\w{7}..\\w{7} \\d{6}|new file mode \\d*)', p.header[idx+1])):

but it is not referenced or consumed further to set the correct file mode of a new generated file.

@uilianries uilianries added the bug Something isn't working label Aug 1, 2024
@uilianries uilianries self-assigned this Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants