seg fault

Discuss Programming

seg fault

Postby Stryker » Mon Jul 19, 2004 12:02 am

I'm working on a new packaging system and am still at the very begining. I'm getting a seg fault and i'm not sure why. it prints out "done" and the only thing after that is return 0; I think something's wrong with package::install() because only the install script gives the segfault. But I can't seem to track it down.

The package is available at http://calyptos.com/files/packager/0/li ... .2b.tar.gz

I'd appreciate any help, even put you in the credits if u want.
Stryker
scripter
scripter
 
Posts: 98
Joined: Thu Jan 23, 2003 8:50 pm

Postby Tux » Mon Jul 19, 2004 3:57 am

Will this break my system?
Tux
guru
guru
 
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Postby Tux » Mon Jul 19, 2004 4:30 am

I had to modify the install script to make it works, but this feels very kludgy and i'm sure what I passed to LD_LIBRARY_PATH is wrong, anyway:

Code: Select all
#!/bin/bash
cd lib;
lib=`pwd`;
cd ../;
cd bin/;
bin=`pwd`/installer;
cd ../;
cd demo;
export LD_LIBRARY_PATH=$lib:$bin:firefox.cpk
Tux
guru
guru
 
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Postby Stryker » Mon Jul 19, 2004 9:39 am

won't break anything, only touches the current directory and /tmp.

It's a little slow cuz it uses the packages is really a .tar.gz file, I have plans to change this. The code isn't the prettiest, but it will do. What was wrong with the install script? your system probably doesnt like "../libs" as LD_LIBRARY_PATH? I should probably do what you did and make it the whole path. Don't be too hard of a critic though I've only been working on this for a day so far. You're modified script was broken, now its:

Code: Select all
#!/bin/bash
cd lib;
lib=`pwd`;
cd ../;
cd bin/;
bin=`pwd`/installer;
cd ../;
cd demo;
export LD_LIBRARY_PATH=$lib
$bin firefox.cpk


and works... except the seg fault
Stryker
scripter
scripter
 
Posts: 98
Joined: Thu Jan 23, 2003 8:50 pm

Postby Tux » Mon Jul 19, 2004 10:16 am

It must be your code, but i'm afraid I can't help you to debug that. It's bad enough doing my own stuff :)

Tried gdb?
Tux
guru
guru
 
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Postby Stryker » Mon Jul 19, 2004 10:19 am

yeah, i can run the program with gdb but i dont know how to pass arguments to the program being executed. the man pages weren't much of a help either.
Stryker
scripter
scripter
 
Posts: 98
Joined: Thu Jan 23, 2003 8:50 pm

Postby Stryker » Mon Jul 19, 2004 10:19 am

did it not run for you? what distro do you have? how's it set up?
Stryker
scripter
scripter
 
Posts: 98
Joined: Thu Jan 23, 2003 8:50 pm

Postby Tux » Mon Jul 19, 2004 10:23 am

Code: Select all
[tux@mithrandir tux]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --disable-libunwind-exceptions --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
[tux@mithrandir tux]$ uname -a
Linux mithrandir 2.6.6 #1 Mon Jun 7 13:37:14 BST 2004 i686 athlon i386 GNU/Linux
[tux@mithrandir tux]$


That's FC2.
I will try it out in Slackware later, but i'm up to the neck in things to do already.
Tux
guru
guru
 
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Postby Tux » Mon Jul 19, 2004 10:25 am

Stryker wrote:yeah, i can run the program with gdb but i dont know how to pass arguments to the program being executed. the man pages weren't much of a help either.


Go into bin
run gdb installer
Then gdb is running;

> run ../test/firefox.cpk

That ^ runs the installer thing, just like the script. Remember to set your library cap in the teminal before running gdb.
Tux
guru
guru
 
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Postby Stryker » Mon Jul 19, 2004 10:29 am

that won't work, I need to set LD_LIBRARY_PATH (which isn't an issue, dont worry about that) but installer HAS to have a command line argument (the package) passed to it to work
Stryker
scripter
scripter
 
Posts: 98
Joined: Thu Jan 23, 2003 8:50 pm

Postby Tux » Mon Jul 19, 2004 10:31 am

It is getting it apssed to it, gdb is doing it for you.
Start gdb and type 'help run' and you will understand.
Tux
guru
guru
 
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Postby Stryker » Mon Jul 19, 2004 10:51 am

oh I didn't see the run firefox.cpk part.

well, getting gdb to work i came up with:

Code: Select all
[yerba]$ LD_LIBRARY_PATH=/home/calyptos/calyptos.com/files/packager/0/libcalpack-0.2c/lib/ gdb ../bin/installer
GNU gdb 2002-04-01-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...(no debugging symbols found)...
(gdb) run firefox.cpk
Starting program: /home/.waddy/calyptos/calyptos.com/files/packager/0/libcalpack-0.2c/bin/installer firefox.cpk
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
Extracting firefox.cpk...Done.
Aquiring package settings...done.
Removing temporary folder...done.
Package name: Firefox 0.9
Install path: /tmp/firefox-calpack-test
Packager: CalyptOS
Date packaged: July 18, 2004
mv: cannot overwrite directory `/tmp/firefox-calpack-test/firefox.cpk'
Installing...failed!
(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x4000956f in fixup () from /lib/ld-linux.so.2
(gdb) bt
#0  0x4000956f in fixup () from /lib/ld-linux.so.2
#1  0x400097c0 in _dl_runtime_resolve () from /lib/ld-linux.so.2
#2  0x400aa14f in __libc_start_main () from /lib/libc.so.6
(gdb)


I think it was because of the way i declared the syscall1 variable in package::install, so I changed it to char syscall1[255] and it works fine now.

thanks.

i'm uploading it as libcalpack-0.2c, if anyone's willing to test if it works on there system and tell us about it at http://calyptos.com/feedback.php i'd appreciate it. Especially if it doesn't work. But even if it works, It'd help us in determining any problems users may have. (hey, it worked for this guy with a stock installation of slackware 9.0... how is this other guy different)
Last edited by Stryker on Mon Jul 19, 2004 3:23 pm, edited 1 time in total.
Stryker
scripter
scripter
 
Posts: 98
Joined: Thu Jan 23, 2003 8:50 pm

Postby Tux » Mon Jul 19, 2004 11:51 am

0.2c working fine.
Tux
guru
guru
 
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Postby Stryker » Wed Jul 21, 2004 9:45 pm

good. There's an even better one I've been working on, a simple executable file to run an application. The only problem is the bigger the program the longer it takes to load, i've got a plan for that though.

you should try http://calyptos.com/files/packager/0/firefox.run
Stryker
scripter
scripter
 
Posts: 98
Joined: Thu Jan 23, 2003 8:50 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests