AIX 5.3 - There is no process to read data written to a pipe

I have the following code which works on AIX 4.3 but fails at times on AIX 5.3
with:

cat: 0652-054 cannot write to output. There is no process to read data written to a pipe.

validator="${validator_exe} ${validator_parms}"
               cmd_line="${CAT} ${data_file} | ${validator} 2>${validator_errors}"
               if [ "${create_new_files}" = "Y" ]
               then
                  #
                  # update the command-line to redirect the translated data to a file
                  #
                  cmd_line="${cmd_line} 1> ${new_file}"
                  print "         Input file : ${real_data_file}"
                  print "         Output file: ${new_file}"
               fi
               #
               # run the validator and save the return code
               #
               eval ${cmd_line}
               validator_rc=$?

If I switch the code to use a redirect instead of a pipe for the following line of code it works everytime.

From This:

cmd_line="${CAT} ${data_file} | ${validator} 2>${validator_errors}"

To This:

cmd_line="${validator} < ${data_file} 2>${validator_errors}"

Does anyone know anything about why this might occur. :confused:

methinks your "validator" maybe having issues handling input from a pipe since the no-pipe command line always works ... check your "validator" for the bug ...

I just had this issue occur on a .sh script with the following command:

cat $filename | head -1

Same thing, change to

cat $filename > head -1

and it works.

Both of these examples I listed in this post so far, did run for without issues on an AIX 4.3 using sp2 nodes.

I am migrating to P5 running aix 5.3 and that is where the issues are occuring.

I guess it is time to have IBM take a look at this.

Thanks

Hi Unix gurus,
I have problem executing remote ssh from cygwin on WIN XP SP2. I have the the public key in the host to have SSH login without the need of password.
I am sure this is not due to path or environment as I can run this within the shell and I added PATH and all necessary LIBPATH within the script.

From windows DOS prompt, i am executing:
ssh user@host /home/user/tmp/prog.ksh

output:

*******************************************************************************

  •                                                                         \*
    
  •                                                                         \*
    
  • Welcome to AIX Version 5.2! *
  •                                                                         \*
    
  •                                                                         \*
    
  • Please see the README file in /usr/lpp/bos for information pertinent to *
  • this release of the AIX Operating System. *
  •                                                                         \*
    
  •                                                                         \*
    

*******************************************************************************
exec(): 0509-036 Cannot load program /home/user/util/bin/tracking because of the following errors:
0509-150 Dependent module liborbixmt.so could not be loaded.
0509-022 Cannot load module liborbixmt.so.
0509-026 System error: A file or directory in the path name does not exist.
/home/user/tmp/prog.ksh: There is no process to read data written to a pipe

vigsgb : the only thing i know about that is your file may be bigger than 2 gb

The following script tickles this bug quite nicely in AIX 5.3. Running the same script in Solaris and Linux is fine - you won't get the error. If anyone knows if IBM released a fix for this issue, please post details on this page.

#!/bin/ksh
#
# Test for pipe bug in AIX
#
function testpipe
{
    typeset -i count=1 maxcount=$1
    print "Testing $maxcount output lines ..."

    while [ $count -le $maxcount ]; do
        print "Output line $count"
        ((count+=1))
    done | head -1 > /dev/null
}

testpipe 50
testpipe 500
testpipe 5000
sleep 1

Here is the output on AIX 5.3:

Testing 50 output lines ...
Testing 500 output lines ...
Testing 5000 output lines ...
testpipe: There is no process to read data written to a pipe.

I've stumbled upon a solution of sorts:

#!/bin/ksh93
...

does not display this bug. Doesn't mean that IBM shouldn't fix it in the older version of ksh though ... :rolleyes: (walks away whistling coyly)