IBM Support

IZ74672: KSH REDIRECTION FAILURE CAUSES FLAGS TO WORK INCORRECTLY APPLIES TO AIX 5300-11

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • In some instances, the -z and -n flags may return the
    opposite result of what is expected.
    
    One instance where this is observed is after receiving
    an error when using variable substitution during a
    redirection attempt. For example:
    
    #!/bin/ksh
    
    TEST="test"
    
    > /tmp/$$/output
    
    if [ -z "${TEST}" ]
    then
      echo "Error - TEST is not empty, it is: $TEST"
    fi
    
    
    If the /tmp/<PID> directory does not exist, that
    redirection attempt will display an error message, and
     the evaluation of the -z flag immediately after the
     redirection attempt will be incorrect.
    

Local fix

  • Workaround:
    Changing the format of the 'if' statement can avoid the
    issue.
    For example, change:
    
    if [ -z "${TEST}" ]
    
    to:
    
    if [[ -z "${TEST}" ]]
    

Problem summary

  • Under some circumstances, the -z and -n tests may not
    return correct values.
    

Problem conclusion

  • Made code changes to take care of all error conditions.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ74672

  • Reported component name

    AIX 5.3

  • Reported component ID

    5765G0300

  • Reported release

    530

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Submitted date

    2010-04-15

  • Closed date

    2010-04-30

  • Last modified date

    2013-03-28

Fix information

  • Fixed component name

    AIX 5.3

  • Fixed component ID

    5765G0300

Applicable component levels

  • R530 PSY U837633

       UP10/09/20 I 1000

PTF to Fileset Mapping

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG11P","label":"APARs - AIX 5.3 environment"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"530","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
28 March 2013