Bug 1379030

Summary: Broken %postun scriptlet
Product: [Fedora] Fedora Reporter: Mattias Ellert <mattias.ellert>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: darrellpf, ignatenko, jakub, nickc
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-19 10:11:07 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:

Description Mattias Ellert 2016-09-24 04:01:13 UTC
Description of problem:

Running transaction
  Reinstalling: binutils-2.27-8.fc26.x86_64                                 1/2 
  Erasing     : binutils-2.27-8.fc26.x86_64                                 2/2 
/sbin/ldconfig: relative path `1' used to build cache
warning: %postun(binutils-2.27-8.fc26.x86_64) scriptlet failed, exit status 1
Non-fatal POSTUN scriptlet failure in rpm package binutils
Non-fatal POSTUN scriptlet failure in rpm package binutils
  Verifying   : binutils-2.27-8.fc26.x86_64                                 1/2 
  Verifying   : binutils-2.27-8.fc26.x86_64                                 2/2 

Version-Release number of selected component (if applicable):
binutils-2.27-8.fc26

How reproducible:
Always

Steps to Reproduce:
1. dnf reinstall binutils

Actual results:
Errors during package upgrade

Expected results:
No errors

Additional info:

http://pkgs.fedoraproject.org/cgit/rpms/binutils.git/tree/binutils.spec#n545

says:
%postun -p /sbin/ldconfig

should say:
%postun
/sbin/ldconfig

Comment 1 Nick Clifton 2016-09-26 08:47:03 UTC
*** Bug 1379117 has been marked as a duplicate of this bug. ***

Comment 2 Jakub Jelinek 2016-09-26 08:54:12 UTC
https://fedoraproject.org/wiki/Packaging:Scriptlets
says %postun -p /sbin/ldconfig
is recommended.  So, either the packaging guidelines are incorrect and should be fixed (and tons of packages that do this), or rpm just shouldn't pass any arguments to scriptlets with -p /sbin/ldconfig

Comment 3 Mattias Ellert 2016-09-26 09:33:11 UTC
You are right that %postun -p /sbin/ldconfig is recommended if the only thing you are doing in the scriptlet is calling /sbin/ldconfig. This is not the case here.

The %post scriptlet, which also calls /sbin/ldconfig in addition to having a lot of other lines of shell script does it correctly:

http://pkgs.fedoraproject.org/cgit/rpms/binutils.git/tree/binutils.spec#n514

Using -p /sbin/ldconfig with a non-empty scriptlet containing shell code is equivalent to trying to run

#! /sbin/ldconfig
<scriptlet code goes here>

I.e. you are telling rpm to try to tell the /sbin/ldconfig binary to interpret shell script code, which fails miserably.

%postun without a -p option is equivalent to the default %postun -p /bin/bash, i.e. what is run is

#! /bin/bash
<scriptlet code goes here>

If you are only calling /sbin/ldconfig it is more efficient to use -p /sbin/ldconfig with an empty scriptlet, since you then skip the shell invocation. But if there are other things that you want to do in the scriptlet in addition to the call to /sbin/ldconfig you need it.

Comment 4 Nick Clifton 2016-09-26 11:51:59 UTC
Should be fixed in: binutils-2.27-9.fc26

Comment 5 Nick Clifton 2016-09-26 13:03:46 UTC
*** Bug 1379344 has been marked as a duplicate of this bug. ***