Bug 1315813
Summary: | inconsistent {%post,%pre}* -p behavior | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Kaleb KEITHLEY <kkeithle> | ||||
Component: | rpm | Assignee: | Packaging Maintenance Team <packaging-team-maint> | ||||
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 25 | CC: | fweimer, jorton, jzeleny, novyjindrich, packaging-team-maint, pknirsch, pmatilai | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2016-10-12 09:24:33 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Why this is happening is explained by Ville Skyttä in bug 1312374. Why the lines starting with "#" are not rpm comments in bodies of scripts? In scripts "#" can have other meaning than a begin of a comment and if in bodies of scripts the lines starting with "#" were rpm comments then it wouldn't be possible to put "#" into script. Yes this can be solved by escape characters but that is not implemented in rpm. Once it was implemented like this and now it is not easy to change that and preserve backward compatibility. One solution for this situation can be add a new parameter for scriptlets that would mean just use specified program and no script body follows after this line. (In reply to Ľuboš Kardoš from comment #1) > Why this is happening is explained by Ville Skyttä in bug 1312374. Why the > lines starting with "#" are not rpm comments in bodies of scripts? In > scripts "#" can have other meaning than a begin of a comment and if in > bodies of scripts the lines starting with "#" were rpm comments then it > wouldn't be possible to put "#" into script. > > Yes this can be solved by escape characters but that is not implemented in > rpm. Once it was implemented like this and now it is not easy to change that > and preserve backward compatibility. Actually it was not, IMNSHO, explained very well in 1312374. Knowledge that only exists in the rpm developers heads is not useful to anyone. Repeating several times that # are not comments lines, when all the available documentation says it is, isn't a lot of help either. This is too important of a tool for it to not be accurately documented. (In reply to Ľuboš Kardoš from comment #2) > One solution for this situation can be add a new parameter for scriptlets > that would mean just use specified program and no script body follows after > this line. Isn't that what -p is for? Why do two lines: %post y -p /sbin/ldconfig %post z -p /sbin/ldconfig behave differently? When even proven packagers tell us to use ... -p /sbin/ldconfig (in package reviews, e.g.) these things should work the same way. POLA (principle of least astonishment) would suggest to me that they would behave the same. When they don't, and the documentation doesn't explain why, then there's a problem. This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle. Changing version to '25'. (In reply to Kaleb KEITHLEY from comment #4) > (In reply to Ľuboš Kardoš from comment #2) > > One solution for this situation can be add a new parameter for scriptlets > > that would mean just use specified program and no script body follows after > > this line. > > Isn't that what -p is for? No. -p is for specifying a different scriptlet interpreter from the default /bin/sh - think of for example -p /usr/bin/python or perl. In which case you certainly expect a scriptlet body to be there. > Why do two lines: > > %post y -p /sbin/ldconfig > > %post z -p /sbin/ldconfig > > behave differently? > > When even proven packagers tell us to use ... -p /sbin/ldconfig (in package > reviews, e.g.) these things should work the same way. POLA (principle of > least astonishment) would suggest to me that they would behave the same. > When they don't, and the documentation doesn't explain why, then there's a > problem. -p /sbin/ldconfig always was more of a hack / abuse rather than proper use of the feature - ldconfig is NOT a script interpreter so its up to the packager to ensure there is no body to the scriptlet because ldconfig cannot handle it. See bug 564613 which is related in that section end markers are one solution to this issue: %post y -p /sbin/ldconfig # comment is considered %post body %post z -p /sbin/ldconfig %end # comment is just a comment in a generic spec context NOTABUG as explained above. |
Created attachment 1134247 [details] xx.spec Description of problem: %post -p /sbin/ldconfig runs ldconfig differently if there's a following comment Version-Release number of selected component (if applicable): 4.8 (rhel6), 4.11 (rhel7), 4.13 (f23) all do it. How reproducible: Steps to Reproduce: using the attached xx.spec file % cp xx.spec ~/rpmbuild/SPECS % cd ~rpmbuild % rpmbuild -ba SPECS/xx.spec % rpm -vv -i RPMS/x86_64/xx-y-1.0-1.x86_64.rpm notice that ldconfig runs successfully % rpm -vv -i RPMS/x86_64/xx-y-1.0-1.x86_64.rpm notice that ldconfig exits with an error and the error message /sbin/ldconfig: relative path `1' used to build cache You can also strace them and see that installing xx-y runs ldconfig with a single argument ( ["/sbin/ldconfig ]), and installing xx-z runs ldconfig with three arguments ( ["/sbin/ldconfig", "/tmp/tmp.XXXXXX", "1" ] ). The /tmp/tmp.XXXXXX file contains the lines between the %post z -p ldconfile line and the %files line. Actual results: Expected results: Additional info: