Bug 1544361 - The add_installed_file method does not honor file permission mode
Summary: The add_installed_file method does not honor file permission mode
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-rpmfluff
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Hutař
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-12 09:37 UTC by Jiri Konecny
Modified: 2018-02-13 22:50 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-13 22:49:45 UTC
Type: Bug


Attachments (Terms of Use)
bug_reproducer.py (259 bytes, text/x-python)
2018-02-12 09:37 UTC, Jiri Konecny
no flags Details

Description Jiri Konecny 2018-02-12 09:37:07 UTC
Created attachment 1394823 [details]
bug_reproducer.py

Description of problem:
When add_permission_file method is called with parameter mode=0755 the created RPM file does not honor this file permission mode. It is possible that this is happening only for .so lib file.

Version-Release number of selected component (if applicable):
0.5.3-2.fc28

How reproducible:
Always

Steps to Reproduce:
1. Run my reproducer (where the mode="0755" parameter is used)
2. Look inside of the created RPM file to see that the .so file is not executable

Actual results:
The foo.so library inside is not executable even when the mode is set to 0755.

Expected results:
The foo.so library should be executable.


Additional info:
This is happening only on Rawhide. It is working correctly on Fedora 27 and before.

Comment 1 Jan Hutař 2018-02-13 21:02:03 UTC
Looking into test-rpmbuild-test-1.0-1/LOGS/x86_64/build.log, there is:

[...]
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
*** WARNING: ./usr/lib/fun.so is executable but has empty or no shebang, removing executable bit
Processing files: test-1.0-1.x86_64
[...]

so I assume build process just become "smarter" in Rawhide. I thought t could be resolved with:

--- bz1544361.py.ORIG	2018-02-13 21:53:57.718403384 +0100
+++ bz1544361.py	2018-02-13 22:00:38.001926208 +0100
@@ -1,12 +1,12 @@
 #!/bin/python3
 
-from rpmfluff import SimpleRpmBuild, SourceFile
+from rpmfluff import SimpleRpmBuild, GeneratedSourceFile, make_elf
 
 
 p = SimpleRpmBuild("test", "1.0", "1")
 
 p.add_installed_file("/usr/lib/fun.so",
-                     SourceFile("fun.so", "Content of the library"),
+                     GeneratedSourceFile("fun.so", make_elf()),
                      mode="0755")
 
 p.make()

but looks like it still do not fool rpmbuild sufficiently...

Comment 2 Jan Hutař 2018-02-13 22:23:28 UTC
Hmm, had to improve our faked ELF file header a bit:

https://pagure.io/rpmfluff/c/d5db46219051aa32bdcd17a8e05bdedf3ec72520?branch=master

Comment 3 Jan Hutař 2018-02-13 22:49:45 UTC
Built into Rawhide:

https://koji.fedoraproject.org/koji/taskinfo?taskID=25018946


Note You need to log in before you can comment on or make changes to this bug.