Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 510774 - pkisilent returns 0 on errors
Summary: pkisilent returns 0 on errors
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Dogtag Certificate System
Classification: Retired
Component: Scripts
Version: 1.1
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Ade Lee
QA Contact: Chandrasekar Kannan
URL:
Whiteboard:
Depends On:
Blocks: 431020 freeipa20 445047
TreeView+ depends on / blocked
 
Reported: 2009-07-10 17:49 UTC by Rob Crittenden
Modified: 2015-01-04 23:39 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-06-04 19:59:09 UTC
Embargoed:


Attachments (Terms of Use)

Description Rob Crittenden 2009-07-10 17:49:43 UTC
Description of problem:

pkisilent always returns 0 whether the command succeeds or not. This makes it difficult to use within a script.

Version-Release number of selected component (if applicable):

dogtag 1.1 SVN revision 675

Steps to Reproduce:
1. /usr/bin/pkisilent -foo
2. echo $?

Comment 1 Ade Lee 2009-12-03 15:28:44 UTC
Simple patch to fix.

Index: scripts/pkisilent
===================================================================
--- scripts/pkisilent   (revision 876)
+++ scripts/pkisilent   (working copy)
@@ -157,7 +157,15 @@
 ###############################################################################
 
 my $output = `java -cp $ENV{CLASSPATH} @ARGV`;
+my $status = $?;
 
 print "#######################################################################\n";
 print "$output\n";
 print "#######################################################################\n";
+
+if ($status != 0) {
+  exit(255);
+} else {
+  exit(0);
+}
+

Comment 2 Jack Magne 2009-12-03 20:58:31 UTC
Attachments id=375817 id=375819 jmagne+

With caveat of checking for an empty string in the function:
checkRequireArgs.

Comment 3 Ade Lee 2009-12-03 21:30:34 UTC
Checked in as part of fixes to 504030:

Checked into tip:
[builder@dhcp231-70 silent]$  svn ci -m "fixes for BZ 510774,531162,504030,
493418"  
Sending        silent/scripts/pkisilent
Sending        silent/src/argparser/ArgParser.java
Sending        silent/src/ca/ConfigureCA.java
Sending        silent/src/common/ComCrypto.java
Sending        silent/src/drm/ConfigureDRM.java
Sending        silent/src/ocsp/ConfigureOCSP.java
Sending        silent/src/subca/ConfigureSubCA.java
Sending        silent/src/tks/ConfigureTKS.java
Sending        silent/src/tps/ConfigureTPS.java
Transmitting file data .........
Committed revision 877.

Checked into 8.1
[builder@oliver silent]$ svn ci -m "fixes for BZ 510774,531162, 504030, 493418"
Sending        silent/scripts/pkisilent
Sending        silent/src/argparser/ArgParser.java
Sending        silent/src/ca/ConfigureCA.java
Sending        silent/src/drm/ConfigureDRM.java
Sending        silent/src/ocsp/ConfigureOCSP.java
Sending        silent/src/subca/ConfigureSubCA.java
Sending        silent/src/tks/ConfigureTKS.java
Sending        silent/src/tps/ConfigureTPS.java
Transmitting file data ........
Committed revision 878.

Comment 4 Ade Lee 2009-12-03 21:34:06 UTC
Note to docs/ QE:

This is easy to test. See description.
You should be able to invoke pkisilent and check status with 
echo $?

You should get 0 for success, and non-zero for any errors.

Comment 5 Asha Akkiangady 2010-05-13 15:41:11 UTC
Tested pkisilent for CA, KRA, OCSP, RA, TKS and CA clone, returns 0 when success and non zero for failures.

Marking the bug verified.


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