Bug 520158 - warning: %postun(nss-softokn-3.12.3.99.3-21.fc12.x86_64) scriptlet failed, exit status 1
Summary: warning: %postun(nss-softokn-3.12.3.99.3-21.fc12.x86_64) scriptlet failed, ex...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: nss-softokn
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Elio Maldonado Batiz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 520529 520715 521580 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-08-28 16:49 UTC by Andreas Schwab
Modified: 2010-09-25 00:34 UTC (History)
7 users (show)

Fixed In Version: 3.12.4-18.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-09-25 00:32:22 UTC


Attachments (Terms of Use)
Fix logic in %postun trigger (400 bytes, patch)
2009-09-01 16:34 UTC, Elio Maldonado Batiz
no flags Details | Diff
Fix logic in %postun trigger (3.82 KB, patch)
2009-09-01 18:32 UTC, Elio Maldonado Batiz
no flags Details | Diff

Description Andreas Schwab 2009-08-28 16:49:54 UTC
[ $1 = 0 ] && %{__rm} -f %{_sysconfdir}/prelink.conf.d/nss-softokn-prelink.conf

will return 1 if $1 != 0.  You want to use "[ $1 != 0 ] || ..." instead.

Comment 1 Elio Maldonado Batiz 2009-09-01 15:51:35 UTC
*** Bug 520529 has been marked as a duplicate of this bug. ***

Comment 2 Elio Maldonado Batiz 2009-09-01 15:54:07 UTC
Fix applied in nss-softokn-3.12.3.99.3-24.fc12.

Comment 3 Elio Maldonado Batiz 2009-09-01 16:02:52 UTC
"Fix" didn't work.

Comment 4 Elio Maldonado Batiz 2009-09-01 16:34:13 UTC
Created attachment 359420 [details]
Fix logic in %postun trigger

Comment 5 Elio Maldonado Batiz 2009-09-01 18:32:45 UTC
Created attachment 359435 [details]
Fix logic in %postun trigger

I tested this with the scratch build at 
http://koji.fedoraproject.org/koji/taskinfo?taskID=1648481

Requesting Bob Relyea's review.

Comment 6 Bob Relyea 2009-09-01 21:38:04 UTC
ouch, the logic makes my head hurt.

OK [ $1 = 0 ] returns 1 if $1 == 0 and continues.
   [ $1 = 0 } returns 0 if $1 != 0 and runs the exit 0.

This is correct, however I think you want to run /sbin/ldconfig before the test so it runs even in the update case.

bob

Comment 7 Andreas Schwab 2009-09-02 08:26:35 UTC
This is wrong, the shell uses negative logic.  0 means true and 1 (!= 0) means false, thus [ $1 = 0 ] returns 0 if $1 == 0.
You need the overall exit code to be 0 so you always need to use || as the toplevel operator.  I don't understand why the original fix didn't work.

Comment 8 Elio Maldonado Batiz 2009-09-02 16:55:31 UTC
You are right, in [ expr ] test evaluates expr, and if the result is true, it return exit status of 0, otherwise it returns a non-zero. I don't why the original fix doesn't work either.

I propose the following to make the logic patently clear:

%postun
/sbin/ldconfig >/dev/null 2>/dev/null
if [ $1 > 0 ] then; exit 0 fi
%{__rm} -f %{_sysconfdir}/prelink.conf.d/nss-softokn-prelink.conf

Comment 9 Bob Relyea 2009-09-02 17:06:33 UTC
Why not:

if [ $1 = 0 ] then;
%{__rm} -f %{_sysconfdir}/prelink.conf.d/nss-softokn-prelink.conf  
fi
exit 0


bob

Comment 10 Tom Horsley 2009-09-02 17:09:37 UTC
OK, I haven't really been following this, but these code snippets look
like someone thinks $1 is the result of running the ldconfig command.
That is not the case, $? is the result from running ldconfig (just
ignore me if I don't understand how $1 is being used :-).

Comment 11 Elio Maldonado Batiz 2009-09-02 17:38:49 UTC
The thinking is that after uninstall the %postun script will called and passed a argument, $1, equal to the number of instances remaining. Only when no instances remain will we remove the nss-prelink.conf file.

Comment 12 John Reiser 2009-09-06 18:16:54 UTC
Things are getting worse, not better.  Rawhide of Sunday, Sept.6 gives:
  Cleanup        : nss-softokn-3.12.4-2.fc12.i686
/var/tmp/rpm-tmp.1QWujd: line 2: [: missing `]'
/var/tmp/rpm-tmp.1QWujd: line 4: syntax error near unexpected token `fi'
/var/tmp/rpm-tmp.1QWujd: line 4: `fi'
Non-fatal POSTUN scriptlet failure in rpm package nss-softokn
warning: %postun(nss-softokn-3.12.4-2.fc12.i686) scriptlet failed, exit status 2

Comment 13 Elio Maldonado Batiz 2009-09-17 04:07:09 UTC
The following

%postun
/sbin/ldconfig >/dev/null 2>/dev/null
[ $1 = 0 ] || exit 0
%{__rm} -f %{_sysconfdir}/prelink.conf.d/nss-softokn-prelink.conf

works. 

As of this writing updating nss-softokn-3.12.4-8.fc12 works for me. I installed Fedora 12 Alpha "asis" which comes with 3.12.3.99-6 and did a yum update on nss, ns-softokn, etc. which updated to 3.12.4-8 without conflicts and warnings after the cleanup of the older version.

Comment 14 Elio Maldonado Batiz 2009-09-17 04:17:59 UTC
*** Bug 520715 has been marked as a duplicate of this bug. ***

Comment 15 Elio Maldonado Batiz 2009-09-17 04:46:13 UTC
*** Bug 521580 has been marked as a duplicate of this bug. ***

Comment 16 Bug Zapper 2009-11-16 11:48:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 17 Elio Maldonado Batiz 2010-09-25 00:34:44 UTC
No longer using %postun or any scriptlets as we don't do prelink blacklisting.


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