Skip to content

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

Open
@markvmk

Description

@markvmk

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions