Operating System - Linux
1825810 Members
2438 Online
109688 Solutions
New Discussion

GNU tar: memory fault, with coredump

 
Matt Hearn
Regular Advisor

GNU tar: memory fault, with coredump

Hey all! I'm trying to read some tar tapes made on a Tru64 system, so that I can restore the files to an HP-UX 11.11 system. I'm aware of the 2GB limitation on the native HP tar, so I've installed the GNU one, version 1.15.1.

Unfortunately, the GNU version seems to hiccup and issue a memory fault(coredump). It SEEMS like it's failing at a specific file, one that for whatever reason has an owner number of -1 and a group number of -2. The native tar is able to restore it, just sticking it as owned by root:sys, but GNUtar can't seem to do it.

I tried using the --user and --group tags, but it still dies a painful and horrific death.

I'm considering trying to see if I can just dd the entire tape into an on-disk tarball, but I'm concerned that if I don't know the size I'll end up with a tarball with a lot of empty space at the end that may or may not actually untar.

Any ideas? Thanks!

 

 

P.S. this thread has been moved from HP-UX > System Administration to HP-UX > languages - HP Forums Moderator

21 REPLIES 21
A. Clay Stephenson
Acclaimed Contributor

Re: GNU tar: memory fault, with coredump

There will be an EOF marker at the end of the tarball just as there would be with any file written to tape. If you choose to dd the file, it's far more important that you choose input and output block sizes that are integral multiples of the tape's blocksize.

The only thing that I can suggest is that you download the source for tar and compile it with the -g option. If it does crash, gdb can then pinpoint the explosion. There is even a fairly good chance that if you compile and use -g, the code will no longer crash because the optimizer has been disabled.
If it ain't broke, I can fix that.
Matt Hearn
Regular Advisor

Re: GNU tar: memory fault, with coredump

I assume I'd need the Ansi C compiler to do that, right? I've never had any luck compiling anything in HP-UX without it, and I don't have it on this box, nor any depot or anything I could get it from.

Right now I am dd-ing the file (you're right, I just had to figure out what the block size was; luckily it was the default). I'm hoping maybe that gnu tar will be able to use the --delete option to get rid of the faulty file without dying, but if not I may try an older version and see if it has difficulties as well.
Matt Hearn
Regular Advisor

Re: GNU tar: memory fault, with coredump

I was able to get gdb installed and look at the core file. Here's what I get:

Core was generated by `tar'.
Program terminated with signal 11, Segmentation fault.
#0 0x00010d3c in ?? ()
(gdb)


Unfortunately from there I don't know what to do in gdb, so I'm kinda lost. Interesting that it says Seg Fault in the core, but "Memory Fault" when it actually fails. Although I guess that's the same thing, it threw me off. There's definitely more coming from google when I search for "tar segmentation fault" than "tar memory fault."
A. Clay Stephenson
Acclaimed Contributor

Re: GNU tar: memory fault, with coredump

Yes, you would need the ANSI compiler or aCC to compile Gnu tar --- or you could install Gnu's gcc and that will do the trick.
If it ain't broke, I can fix that.
Matt Hearn
Regular Advisor

Re: GNU tar: memory fault, with coredump

Cool, I'm way ahead of you, even now I'm running the configure and getting ready to kick off my "gmake."

Unfortunately, because I got a C- in C programming, I'm not good at compiling source; I want to use that -g option to disable the optimizer, but I don't know WHERE to use it. I would assume I have to edit the Makefile; any idea how? Or can I pass the -g option to gmake somehow?

Thanks!!!
Dennis Handly
Acclaimed Contributor

Re: GNU tar: memory fault, with coredump

Core was generated by `tar'.
Program terminated with signal 11, Segmentation fault.
#0 0x00010d3c in ??

>Unfortunately from there I don't know what to do in gdb

It looks like it was stripped.
Can you do:
(gdb) bt
(gdb) info reg
(gdb) disas $pc-4*8 $pc+4*4
(gdb) q
Matt Hearn
Regular Advisor

Re: GNU tar: memory fault, with coredump

Sure. This is kinda long, hopefully the forum won't truncate it:

Core was generated by `tar'.
Program terminated with signal 11, Segmentation fault.
#0 0x00010d3c in ?? ()
(gdb) bt
#0 0x00010d3c in ?? ()
#1 0x00010cdc in ?? ()
Cannot access memory at address 0x40010000
(gdb) info reg
warning: reading register flags: No such process
flags: ffffffff warning: reading register sr5: No such process

sr5: ffffffff00000000 warning: reading register r1: No such process

r1: ffffffff00000000 warning: reading register sr6: No such process

sr6: ffffffff00000000 warning: reading register rp: No such process

rp: ffffffff00000000 warning: reading register sr7: No such process

sr7: ffffffff00000000 warning: reading register r3: No such process

r3: ffffffff00000000 warning: reading register cr0: No such process

cr0: ffffffff00000000 warning: reading register r4: No such process

r4: ffffffff00000000 warning: reading register cr8: No such process

cr8: ffffffff00000000 warning: reading register r5: No such process

r5: ffffffff00000000 warning: reading register cr9: No such process

cr9: ffffffff00000000 warning: reading register r6: No such process

r6: ffffffff00000000 warning: reading register ccr: No such process

ccr: ffffffff00000000 warning: reading register r7: No such process

r7: ffffffff00000000 warning: reading register cr12: No such process

cr12: ffffffff00000000 warning: reading register r8: No such process

r8: ffffffff00000000 warning: reading register cr13: No such process

cr13: ffffffff00000000 warning: reading register r9: No such process

r9: ffffffff00000000 warning: reading register cr24: No such process

cr24: ffffffff00000000 warning: reading register r10: No such process

r10: ffffffff00000000 warning: reading register cr25: No such process

cr25: ffffffff00000000 warning: reading register r11: No such process

r11: ffffffff00000000 warning: reading register cr26: No such process

cr26: ffffffff00000000 warning: reading register r12: No such process

r12: ffffffff00000000 warning: reading register mpsfu_high: No such process

mpsfu_high: ffffffff00000000 warning: reading register r13: No such process

r13: ffffffff00000000 warning: reading register mpsfu_low: No such process

mpsfu_low: ffffffff00000000 warning: reading register r14: No such process

r14: ffffffff00000000 warning: reading register mpsfu_ovflo: No such process

mpsfu_ovfl: ffffffff00000000 warning: reading register r15: No such process

r15: ffffffff00000000 warning: reading register pad: No such process

pad: ffffffff00000000 warning: reading register r16: No such process

r16: ffffffff00000000 warning: reading register fpsr: No such process

fpsr: ffffffff warning: reading register r17: No such process

r17: ffffffff00000000 warning: reading register fpe1: No such process

fpe1: ffffffff warning: reading register r18: No such process

r18: ffffffff00000000 warning: reading register fpe2: No such process

fpe2: ffffffff warning: reading register r19: No such process

r19: ffffffff00000000 warning: reading register fpe3: No such process

fpe3: ffffffff warning: reading register r20: No such process

r20: ffffffff00000000 warning: reading register fpe4: No such process

fpe4: ffffffff warning: reading register r21: No such process

r21: ffffffff00000000 warning: reading register fpe5: No such process

fpe5: ffffffff warning: reading register r22: No such process

r22: ffffffff00000000 warning: reading register fpe6: No such process

fpe6: ffffffff warning: reading register r23: No such process

r23: ffffffff00000000 warning: reading register fpe7: No such process

fpe7: ffffffff warning: reading register r24: No such process

r24: ffffffff00000000 warning: reading register fr4: No such process

fr4: ffffffff warning: reading register r25: No such process

r25: ffffffff00000000 warning: reading register fr4R: No such process

fr4R: ffffffff warning: reading register r26: No such process

r26: ffffffff00000000 warning: reading register fr5: No such process

fr5: ffffffff warning: reading register dp: No such process

dp: ffffffff00000000 warning: reading register fr5R: No such process

fr5R: ffffffff warning: reading register ret0: No such process

ret0: ffffffff00000000 warning: reading register fr6: No such process

fr6: ffffffff warning: reading register ret1: No such process

ret1: ffffffff00000000 warning: reading register fr6R: No such process

fr6R: ffffffff warning: reading register sp: No such process

sp: ffffffff00000000 warning: reading register fr7: No such process

fr7: ffffffff warning: reading register r31: No such process

r31: ffffffff00000000 warning: reading register fr7R: No such process

fr7R: ffffffff warning: reading register sar: No such process

sar: ffffffff00000000 warning: reading register fr8: No such process

fr8: ffffffff warning: reading register pcoqh: No such process

pcoqh: ffffffff00000000 warning: reading register fr8R: No such process

fr8R: ffffffff warning: reading register pcsqh: No such process

pcsqh: ffffffff00000000 warning: reading register fr9: No such process

fr9: ffffffff warning: reading register pcoqt: No such process

pcoqt: ffffffff00000000 warning: reading register fr9R: No such process

fr9R: ffffffff warning: reading register pcsqt: No such process

pcsqt: ffffffff00000000 warning: reading register fr10: No such process

fr10: ffffffff warning: reading register eiem: No such process

eiem: ffffffff00000000 warning: reading register fr10R: No such process

fr10R: ffffffff warning: reading register iir: No such process

iir: ffffffff00000000 warning: reading register fr11: No such process

fr11: ffffffff warning: reading register isr: No such process

isr: ffffffff00000000 warning: reading register fr11R: No such process

fr11R: ffffffff warning: reading register ior: No such process

ior: ffffffff00000000 warning: reading register fr12: No such process

fr12: ffffffff warning: reading register ipsw: No such process

---Type to continue, or q to quit---
ipsw: ffffffff00000000 warning: reading register fr12R: No such process

fr12R: ffffffff warning: reading register goto: No such process

goto: ffffffff00000000 warning: reading register fr13: No such process

fr13: ffffffff warning: reading register sr4: No such process

sr4: ffffffff00000000 warning: reading register fr13R: No such process

fr13R: ffffffff warning: reading register sr0: No such process

sr0: ffffffff00000000 warning: reading register fr14: No such process

fr14: ffffffff warning: reading register sr1: No such process

sr1: ffffffff00000000 warning: reading register fr14R: No such process

fr14R: ffffffff warning: reading register sr2: No such process

sr2: ffffffff00000000 warning: reading register fr15: No such process

fr15: ffffffff warning: reading register sr3: No such process

sr3: ffffffff00000000 warning: reading register fr15R: No such process

(gdb) disas $pc-4*8 $pc+4*4
fr15R: ffffffff Dump of assembler code from 0x10d1c to 0x10d4c:
0x10d1c: Cannot access memory at address 0x10d1c
Matt Hearn
Regular Advisor

Re: GNU tar: memory fault, with coredump

Also, I've tried to compile using gnu's gcc, and I'm getting the usual errors about how various things are ANSI C options and it fails.

I'd LIKE to get my hands on an older version of GNU tar, but hpux.cs.utah.edu only maintains the current version. Any ideas where I might be able to find a depot for a previous version of gtar?
Dennis Handly
Acclaimed Contributor

Re: GNU tar: memory fault, with coredump

>This is kinda long,

Unfortunately there was nothing useful.
How did you get the stack trace? Did you first do:
$ gdb tar core
Matt Hearn
Regular Advisor

Re: GNU tar: memory fault, with coredump

I did:

# /usr/local/bin/gdb executable core

I tried it with

# /usr/local/bin/gdb tar core

and the output looks about the same, at least to me.
Dennis Handly
Acclaimed Contributor

Re: GNU tar: memory fault, with coredump

# /usr/local/bin/gdb executable core

That looks right except you should use HP's gdb:
/opt/langtools/bin/gdb

You can download a copy from http://www.hp.com/go/wdb
Steven Schweda
Honored Contributor

Re: GNU tar: memory fault, with coredump

> I've installed the GNU one, version 1.15.1.

Why? GNU tar 1.18 is current.

http://www.gnu.org/software/tar/

> [...] I want to use that -g option to
> disable the optimizer, but I don't know
> WHERE to use it. [...]

The INSTALL document explains this:

./configure CFLAGS=-g

I'm eccentric, but I'd start by building the
current version normally, and then, if that
fails, I'd start looking at debugging it.

> [...] I'm aware of the 2GB limitation [...]

Have you large files in the archive which
cause trouble, or are you just trying to be
careful?
Matt Hearn
Regular Advisor

Re: GNU tar: memory fault, with coredump

>Why? GNU tar 1.18 is current.
>
> http://www.gnu.org/software/tar/

Because 1.15.1 is the version available in depot form at hpux.cs.utah.edu. I've never been able to compile source on HP-UX because my bosses won't drop $966 on the ANSI C compiler.

I did get the 1.15.1 source and tried to compile with gnu's gcc, and got the usual results: there are options in the Makefile and source code that require ANSI C.

> Have you large files in the archive which
> cause trouble, or are you just trying to be
> careful?

The tapes I'm trying to read have some large datafiles, up to about 60GB in size. So the native tar won't read it. Unfortunately it seems that GNU tar can't handle funny owner/group information, even if told to ignore it!
Matt Hearn
Regular Advisor

Re: GNU tar: memory fault, with coredump

> You can download a copy from
> http://www.hp.com/go/wdb

Which of course doesn't seem to be working today for whatever reason; I enter in my login info, click to agree to the license agreement, and am dumped to a blank page. I am not having much luck tonight!
Steven Schweda
Honored Contributor

Re: GNU tar: memory fault, with coredump

> I did get the 1.15.1 source and tried to
> compile with gnu's gcc, and got the usual
> results: there are options in the Makefile
> and source code that require ANSI C.

If you're claiming that GCC can't compile GNU
"tar", then I find that a bit difficult to
swallow. Especially when I've used "gcc
(GCC) 4.2.1" to build "tar (GNU tar) 1.18"
on my system:

dy # uname -a
HP-UX dy B.11.11 U 9000/785 2012616114 unlimited-user license


As usual, it might help to see exactly what
you did, and what went wrong when you did it.
(It _is_ true that the HP bundled C compiler
will fail to build the thing, but GCC should
have no trouble.)
Matt Hearn
Regular Advisor

Re: GNU tar: memory fault, with coredump

I'll be the first to admit that when it comes to compiling stuff, I'm completely out of my depth. Here's what I did:

I downloaded tar-1.18, placed it in a location in root's home (/root/), unzipped and untarred it, entered the directory. I typed "./configure" and it poured a bunch of things to my screen, the bulk of which are meaningless to me.

I then typed "/usr/local/bin/gmake" and got a lengthy response finishing with:

gmake[3]: Entering directory `/root/tar-1.18/lib'
source='argp-ba.c' object='argp-ba.o' libtool=no \
DEPDIR=.deps depmode=hp /usr/bin/posix/sh ../build-aux/depcomp \
cc -DHAVE_CONFIG_H -I. -I. -I.. -c argp-ba.c
(Bundled) cc: "argp-ba.c", line 25: warning 5: "const" will become a keyword.
(Bundled) cc: "argp-ba.c", line 25: error 1000: Unexpected symbol: "char".
gmake[3]: *** [argp-ba.o] Error 1
gmake[3]: Leaving directory `/root/tar-1.18/lib'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/root/tar-1.18/lib'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/root/tar-1.18'
gmake: *** [all] Error 2

I find it hard to swallow that gcc would choke on the word "char," so I don't know what on earth is going on here. I'm sure there's some kind of changes I need to make to the Makefile so that it'll compile on my system, but I don't know what they would be. I tried changing every reference to "cc" to "gcc," and even to "/usr/local/bin/gcc," but that doesn't seem to do much.
Dennis Handly
Acclaimed Contributor

Re: GNU tar: memory fault, with coredump

>Which of course doesn't seem to be working today for whatever reason;

It worked a few hours ago. Works fine for me now but I'm internal.
Steven Schweda
Honored Contributor

Re: GNU tar: memory fault, with coredump

> (Bundled) cc: "argp-ba.c", line 25: warning 5: "const" will become a keyword.

"(Bundled) cc" is not GCC.

I'd expect the "configure" script to find
"gcc", if it's on your PATH. Is
/usr/local/bin on your PATH? What does
"gcc --version" say?
Dennis Handly
Acclaimed Contributor

Re: GNU tar: memory fault, with coredump

>Steven: I'd expect the "configure" script to find "gcc", if it's on your PATH.

If it always finds cc before gcc, I think you can use: configure ... cc=gcc
Matt Hearn
Regular Advisor

Re: GNU tar: memory fault, with coredump

Oh, duh. /usr/local/bin was NOT in my path. I put it there, reran configure and gmake, got this (among other, non-error messages):

///usr/include/stdio.h:593: error: expected declaration specifiers or '...' before '__size_t'
///usr/include/stdio.h:593: warning: conflicting types for built-in function 'snprintf'
///usr/include/stdio.h:594: error: expected declaration specifiers or '...' before '__size_t'
///usr/include/stdio.h:594: warning: conflicting types for built-in function 'vsnprintf'
In file included from ./stdlib.h:31,
from ./getopt.h:36,
from argp.h:25,
from argp-eexst.c:26:
///usr/include/stdlib.h:284: warning: parameter names (without types) in function declaration
In file included from ./sys/time.h:26,
from /usr/include/sys/resource.h:50,
from /usr/include/sys/wait.h:91,
from ///usr/include/stdlib.h:298,
from ./stdlib.h:31,
from ./getopt.h:36,
from argp.h:25,
from argp-eexst.c:26:
///usr/include/sys/time.h:546: error: expected declaration specifiers or '...' before '__size_t'
///usr/include/sys/time.h:546: error: expected declaration specifiers or '...' before '__size_t'
In file included from /usr/include/sys/resource.h:50,
from /usr/include/sys/wait.h:91,
from ///usr/include/stdlib.h:298,
from ./stdlib.h:31,
from ./getopt.h:36,
from argp.h:25,
from argp-eexst.c:26:
./sys/time.h:36: error: redefinition of 'struct timeval'
In file included from ./stdlib.h:31,
from ./getopt.h:36,
from argp.h:25,
from argp-eexst.c:26:
///usr/include/stdlib.h:349: warning: parameter names (without types) in function declaration
///usr/include/stdlib.h:350: error: expected declaration specifiers or '...' before '__size_t'
gmake[3]: *** [argp-eexst.o] Error 1
gmake[3]: Leaving directory `/root/tar-1.18/lib'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/root/tar-1.18/lib'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/root/tar-1.18'
gmake: *** [all] Error 2


I also grabbed the version:

# gcc --version
gcc (GCC) 4.2.1
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


I think GCC hates me. :) Thanks!
Steven Schweda
Honored Contributor

Re: GNU tar: memory fault, with coredump

> I think GCC hates me. :) Thanks!

Apparently it hates its own (or someone
else's) header files, which usually means a
bad GCC installation.

> from ///usr/include/stdlib.h:298,

The multi-slash paths for the header files
don't inspire confidence, either.

> # gcc --version
> gcc (GCC) 4.2.1

Where did you get the kit, and was it
intended for your OS? According to my notes,
I got an 11.11 depot for gcc 4.1.2 from:

http://hpux.cs.utah.edu/ftp/hpux/Gnu/
or:
http://ftp.uni-magdeburg.de/aftp/projects/hpux/Gnu/

They seem to have newer stuff (4.2.1) now.

Trusting no one, I used that GCC to build the
stuff from the (4.2.1) source kit:

http://gcc.gnu.org/

Of course, the Java build failed on HP-UX:

jc1: out of memory allocating 4072 bytes after a total of 707417224 bytes

which seems to be a known problem:

http://gcc.gnu.org/ml/java-prs/2006-q4/msg00090.html

so I had to limit things a bit:

# langs='c,c++,objc,obj-c++,treelang'
# ../gcc-4.2.1/configure --enable-languages=$langs

And I did need to install GNU "bison" and
m4, and I re-jiggered my PATH to get the
right m4 and diff used, but it was all good
fun (and educational).

Otherwise, what could go wrong?