AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system

 View Only
Expand all | Collapse all

Exit status of rpm and dnf command is successfull (0) even if some actions during this transaction were not successfully completed.

  • 1.  Exit status of rpm and dnf command is successfull (0) even if some actions during this transaction were not successfully completed.

    Posted Mon November 25, 2024 09:41 AM

    Hello,

    im looking for an example to get the right exit status for rpm and dnf command if some actions during this transaction were not successfully completed.
    right now even if my rpm scriptlet throws out an error the rpm and dnf command exit code is always 0.

    Q. What has to be settled up in the scriptlet that rpm or dnf throws out exit code >0 if an error occurred?

    oslevel -s   
    7300-01-02-2320
    #lslpp -l rpm.rte
      Fileset                      Level  State      Description         
      ----------------------------------------------------------------------------
    Path: /usr/lib/objrepos
      rpm.rte                4.15.1.2011  COMMITTED  RPM Package Manager

    Path: /etc/objrepos
      rpm.rte                4.15.1.2011  COMMITTED  RPM Package Manager
    #dnf --version
    4.2.17
      Installed: dnf-0:4.2.17-64_53.ppc at Tue Aug 13 08:02:11 2024
      Built    :  at Fri Apr 28 10:34:40 2023

    +++
    Exit status of rpm and dnf command is successfull (0) even
    if some actions during this transaction were not successfully completed. 
    This could cause a security risk on machines. 

    ++example rpm command++
    rpm -ivh <RPM name>
    +++++++++++++++++++++
    ./..
    -----> Skript mit RC [10] beendet <-----
    warning: %post(RPM Name) scriptlet failed, exit status 1
    Error Register agent -- installation aborts
    warning: %posttrans(RPM Name) scriptlet failed, exit status 1
    #echo $?
    0

    ++example dnf command++
    dnf -y install <RPM Name>
    +++++++++++++++++++++

    ./..

    Error Register agent  -- installation aborts
    warning: %post(RPM Name) scriptlet failed, exit status 1

    Error in POSTIN scriptlet in rpm package <RPM Name>
    Error Register agent  -- installation aborts
    warning: %posttrans(RPM Name) scriptlet failed, exit status 1

    Error in POSTTRANS scriptlet in rpm package <RPM Name>
      Verifying        : <RPM Name>                                                                                                                                                                                        1/1 

    Installed:
      <RPM Name>                                                                                                                                                                                                                

    Complete!
    #echo $?
    0

    CHers Patrick



    ------------------------------
    Patrick Hügli
    ------------------------------


  • 2.  RE: Exit status of rpm and dnf command is successfull (0) even if some actions during this transaction were not successfully completed.

    Posted Wed November 27, 2024 08:12 AM

    Hello Patrick,

    All scriptlets must exit with the zero exit status. You can refer the link for more details on pre & post scriplets.

    https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#Scriptlet_Ordering



    ------------------------------
    Sumitra Dawn
    ------------------------------