Re: scripting on HP-UX 11

 

scripting on HP-UX 11

Is there any reason why the same string inside a script (performing uncompress and untar) should success in HP-UX 10 and any other Unix but fail on HP-UX 11?
HP-UX B.11.00 U 9000/800

Line:
(uncompress < ${LOCPATCHBIN}.Z ; echo $? > /tmp/err$$) | (cd $TEMPDIR; tar -xf - )
Even more:
While uncompress terminates normally if launched by hand, during the script it terminates with error code 141 (whose meaning I do not know).
Thank you for your help


Xavier Giannakopoulos
Tivoli Systems Inc.
5 REPLIES 5
Bill McNAMARA_1
Honored Contributor

Re: scripting on HP-UX 11

I'm just taking a guess here,
you should sepearte the lines and use set -x to help debug the script but it is possible that LOCPATCHBIN refers to the software distributor directory that changed from 10.20 to 11.00
/var/adm/sw on the two OSes is structured differently.
You may want to look into that.
For error numbers look for errno.h
and/or the return codes of the application from the RETURNS section of the man for each command.. when you find out from the debug set -x which one has failed.

Later,
Bill
It works for me (tm)

Re: scripting on HP-UX 11

Thank you very much for your answer. In fact it corresponds mainly to things that I already tried.
I did the set -x.
LOCPATCHBIN is computed by the script, and is right.
About the return code, I did not find any mention of code 141 neither in errno.h and various subincludes, nor in compress manpage. Maybe I have to download the source code for compress...
And finally I am sure that uncompress is failing because the output says so, and the script is making the difference between the two parts of the command.
I wanted to know if there is a reason why the same line in a script would fail if using a pipe, but success if using a temporary file.

Thanks again, Xavier
Dan Hetzel
Honored Contributor

Re: scripting on HP-UX 11

Hi Xavier,

Have you tried the following ?

zcat ${LOCPATCHBIN}.Z |(cd $TEMPDIR; tar -xf -)

I've tried this on 11.0 and it works

Regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com

Re: scripting on HP-UX 11

Nope, no change:

+ zcat /var/xxxxxx.tar.Z
+ cd /var/xxxxxxxx.8971
+ tar -xf -
+ tar_ret=0
+ + cat /tmp/err8971
+ echo 141
+ 1> /tmp/err8971
uncompress_ret=141
+ rm -f /tmp/err8971
+ [ 141 -ne 0 ]
Klaus Crusius
Trusted Contributor

Re: scripting on HP-UX 11


The error coed 141 appears, because the uncompress was terminated after receiving signal 13 (128+13==141) SIGPIPE.

That happens, if the process after the pipe closes its STDIN before uncompress is finished.
Maybe tar doesn't do what you want?
There is a live before death!