LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-19-2008, 05:28 PM   #16
tostay2003
Member
 
Registered: Jun 2006
Posts: 126

Original Poster
Rep: Reputation: 15

Quote:
Originally Posted by Mr. C. View Post
The code of interest is the code that sets up the call to the script above and the test for its exit status. We know the script above exits correctly with exit code 1. You can verify this with strace, by placing strace in front of the call in your other script to the script above. strace will show you the exit value.

See my edit above for setting -x on functions in ksh.
strace is giving the following error

Quote:
ERROR: unable to open /dev/log
FYI : This script is being called from an Application as well, and it too says that the script is not returning exit status properly.

Last edited by tostay2003; 08-19-2008 at 05:29 PM.
 
Old 08-19-2008, 11:17 PM   #17
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Are you on Solaris? I see you are in the non-*nix forum.

If so, use truss, not strace.

I've given you the tools I would use to see how to trace a shell script, and to see the actual exit code that is passed to the _exit(2) system call. Other than debugging with a debugger (which is likely to be far more pain than you want to endure), I'm not sure what else I can do. I don't have access to your code, I have given you code that shows you how the exit functions work, and I've given tracing tools. I'm out of suggestions.
 
Old 08-20-2008, 10:37 AM   #18
tostay2003
Member
 
Registered: Jun 2006
Posts: 126

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Mr. C. View Post
Are you on Solaris? I see you are in the non-*nix forum.

If so, use truss, not strace.

I've given you the tools I would use to see how to trace a shell script, and to see the actual exit code that is passed to the _exit(2) system call. Other than debugging with a debugger (which is likely to be far more pain than you want to endure), I'm not sure what else I can do. I don't have access to your code, I have given you code that shows you how the exit functions work, and I've given tracing tools. I'm out of suggestions.
I made a truss on the script and obtained the below result. How to we analyze, whats happening. the '+' are from Script1 and i guess anything below is from script two (where returned code is printed)
Quote:
File=
+ [ -z ]
+ print Cannot find File : H21
Cannot find File : H21
+ exit 1
waitid(P_PID, 4958, 0xFFBFF8D0, WEXITED|WTRAPPED|WNOWAIT) = 0
ioctl(0, TIOCGPGRP, 0xFFBFF8EC) = 0
ioctl(0, TCGETS, 0x00039178) = 0
waitid(P_PID, 4958, 0xFFBFF8D0, WEXITED|WTRAPPED) = 0
brk(0x0003A3F0) = 0
Returned Code is 0
write(1, " R e t u r n e d C o d".., 19) = 19
read(19, 0x00039610, 128) = 0
ioctl(19, TCGETA, 0xFFBFFBC4) Err#25 ENOTTY
ioctl(19, TCGETA, 0xFFBFFC24) Err#25 ENOTTY
close(19) = 0
_exit(0)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sub-process /usr/bin/dpkg returned an error code (1) rapattack Debian 10 04-24-2008 11:19 PM
Sendmail returned error code 111 newlinuxgeek Linux - Software 1 02-14-2008 02:16 AM
tracing the error code returned by wait call lg3 Linux - Software 0 02-21-2005 03:53 AM
dpkg returned an error code (1) Segmentation fault questionman Debian 6 11-02-2004 12:04 AM
The program returned an error code (3) Omega Linux - Software 1 05-04-2003 09:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration