Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Segmentation Fault

Status
Not open for further replies.

babeo

Technical User
Mar 30, 2000
398
CA
Hi

I have an error message but I don't know what it means and what's the cause:
- I have a compiled script written to produce any date of the year, and it works fine, but whenever I copy or ftp (with bin option) to another UNIX machine to reuse it. I always get the same error message. Here is the error message:
Myserver:/Carol> moving.ksh
moving.ksh[11]: 23561 Segmentation Fault(coredump)

Does anyone know what is it ? and how to fix it?
(I did check the OS version and .profile of these machines, they are the same)

Thanks
 
A segmentation fault usually means that your process has written into memory that it doesn't own. From your output, it appears to be occurring on line 11. Why exactly is impossible to say without seeing the code.

What do you mean by a "compiled script"? Is the entire thing written in ksh?

Russ
bobbitts@hotmail.com
 
Hi Russ
- First Thanks for your response.
- Second answer your question: there is a compiled code was written in house so that I can use the entire code as a command, in my case the code named "olddate", then I use that "command" in my script moving.ksh to get back to any old date I want, to simplyfy it, if I am at the prompt, and I type the command like this: myserver%olddate -2 %y%m%d
I will get the out put as "010416", which is April,Monday the 16th, 2001 from today (18th).

Now, when I first use this "command" on the first UNIX machine (a), it works fine, I then ftp the code to another machine (b) to use for the same purpose, and I get error, I test with other machines I get the same error, so I think may be the code is written to adapt with the environment of machine (a), but not with (b) or others, so I think the only solution is to fix the original code (not compiled yet), but before doing that, I would like to know exactly what the error messages means, and how to recognize (as you figure out for me) where is the line produces the problem. Someone told me that the error is related to something.... library? I'm not sure I understand that person said.

Anyway, I get a new version of that command and it works fine, but I still want to know how I get that error because I use the old version on the same machine (a) in another script, and I get error. Weird!!
If you know the answer. Thanks.
 
If you have the source code, you should probably recompile the program olddate on the new machine.

If that doesn't solve it, try compiling the source on the machine that the program works on with the libraries linked statically. In gcc the flag is -static. This will produce a larger executable but will ensure that the program uses the same library code from platform to platform.



Russ
bobbitts@hotmail.com
 
Thank you for your response.

I think you are right about that even I don't have change to recompile the code, but my "olddate" command has to be run together with .profile , I means (. /mysever/.profile; /myserver/myscript)

and it works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top