LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-02-2003, 07:26 AM   #1
live2
LQ Newbie
 
Registered: Mar 2003
Distribution: Redhat
Posts: 14

Rep: Reputation: 0
Segmentation Fault


I have recently put together a new comoputer, I think it's a 2GHZ athalon (quite an improvement over the 233 MHZ pentium I had been using). I have installed Redhat 8.0, and it seems to work for the most part. I have a perl script that I use to resize jpg files, which uses ImageMagick, and it works on the three other computers I use, all ao which have some version or other of Redhat on them. When I run this little script on my new computer it tells me segmentation fault. First, what, more or less, is a segmentation fault?

I have tried to troubleshoot the program by commenting out all of the lines that reffered to ImageMagick, and then running the program to see which line was causing the error. It seems that the offending line is the following:

$image->Read(file=>\*PICS);

I don't know if this is a hardware problem or a software problem, and I have no idea how to proceed. I would deeply appreciate any help.

Thanks
 
Old 03-02-2003, 09:19 AM   #2
quietguy47
Member
 
Registered: Mar 2003
Location: Everett
Distribution: Slackware
Posts: 805

Rep: Reputation: 35
What is the error message?
 
Old 03-02-2003, 09:44 AM   #3
kater
Member
 
Registered: Feb 2003
Location: Switzerland, Berne
Distribution: Slackware 9.0
Posts: 186

Rep: Reputation: 30
A segfault (=Segmentation Fault) is an unexpected error in a programm routine. Simply: Your programm crashed.
 
Old 03-02-2003, 09:53 AM   #4
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Quote:
I have a perl script that I use to resize jpg files, which uses ImageMagick, and it works on the three other computers I use, all ao which have some version or other of Redhat on them.
If these are older versions of RedHat then they probably have different versions of perl on them. Is it possible that the newer version of perl that you have is not backwards compatible?
 
Old 03-02-2003, 10:56 AM   #5
live2
LQ Newbie
 
Registered: Mar 2003
Distribution: Redhat
Posts: 14

Original Poster
Rep: Reputation: 0
The error message is simply "Segmentation fault" with exactly that capitalization(or lack thereof). It is a very simple script (I'm a simple programmer) so it seems unlikely that it would be a change in perl or the perl interface to ImageMagick. Do you think that I should contact the ImageMagick people and ask them? I will include the whole script since it is so short. I use it all the time, and if anyone else wants to use it, feel free. You have to make sure that you have the perl interface to ImageMagick installed.

#!/usr/bin/perl

#Program to resize all .jpg files in current directory and save them as a.jpg. first argument is height, second argument is width.

$width=pop(@ARGV);
$height=pop(@ARGV);

use Image::Magick;
$image = Image::Magick->new;
@files=`ls *.jpg`;
foreach $file (@files){
$file=~s/.jpg//;
chomp ($file);
open PICS, "<${file}.jpg" or die "cannot open ${file}.jpg";
binmode PICS;
$image->Read(file=>\*PICS);
close PICS;
$image->Resize(width=>$width, height=>$height);
print "${file}a.jpg\n";
open PICS, ">${file}a.jpg" or die "cannot open ${file}a.jpg";
$image->Write(file=>PICS);
close PICS;
undef @$image;
}
 
Old 03-02-2003, 01:04 PM   #6
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
Quote:
I have recently put together a new comoputer, I think it's a 2GHZ athalon
umm...you built a computer, but don't know exactly what the cpu is....?

Quote:
First, what, more or less, is a segmentation fault?
Segemntation fault is when your program tries to use memory that has not been allocated to it - since, you wrote this program, maybe you should look through it for memory problems - most likely a buffer overrun.
 
Old 03-02-2003, 09:36 PM   #7
jetblackz
Member
 
Registered: Mar 2002
Location: Debian Galaxy
Distribution: Debian
Posts: 711

Rep: Reputation: 30
I would run

www.memtest86.com

for 15-30 mins before jumping into conclusion.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what does Segmentation Fault mean ? baronlynx Linux - Newbie 10 10-25-2009 05:32 PM
yast segmentation fault, system freezing - nvidia driver at fault? BaltikaTroika SUSE / openSUSE 2 12-02-2005 10:34 AM
Help !!! Segmentation fault mola Linux - Software 3 06-23-2005 12:13 PM
Segmentation fault tejas15_10 Programming 9 06-20-2005 10:12 AM
Segmentation fault santhosh_o Programming 3 10-26-2004 06:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:23 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration