Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jul 2000 17:37:51 -0400
From:      System Administrator <admin@chemcomp.com>
To:        Rahul Siddharthan <rsidd@physics.iisc.ernet.in>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Tar bug???
Message-ID:  <3978C2AF.7A6362D4@chemcomp.com>
References:  <3978A6F6.55C3E578@chemcomp.com> <20000722021522.A8449@physics.iisc.ernet.in>

next in thread | previous in thread | raw e-mail | index | archive | help
Rahul Siddharthan wrote:
> 
> System Administrator said on Jul 21, 2000 at 15:39:34:
> >
> > I was about to submit a PR when a doubt crossed my mind. Is this a bug
> > or a "feature"?
> >
> > $ tar -f /home/backup/arch.tar -A -v -C /net /net/basil
> > tar: Segmentation fault
> > $
> >
> > Curiously, no core is dumped, so I cannot really debug (?) the problem.
> > How could I? Why isn't there a core anyways?
> 
> It would dump core only if it has write permission in the current
> working directory.  Try running the same command from your
> home directory, if you aren't doing that already.

Ah! That's better...

> Looks like a bug to me.

Indeed.

(gdb) bt
#0  0x8073976 in vfprintf ()
#1  0x80729c4 in fprintf ()
#2  0x8072cb0 in vfprintf ()
#3  0x8052292 in msg_perror (
    str=0x80825c0 "read error at byte %ld reading %d bytes in file %s")
    at port.c:1138
#4  0x8054845 in append_file (p=0x8092095 "/net/basil") at update.c:228
#5  0x8054724 in update_archive () at update.c:182
#6  0x8052b11 in main (argc=8, argv=0xbfbffc18) at tar.c:231
#7  0x80480f9 in _start ()
(gdb)

I can trace back the problem to the call:

228		  msg_perror ("read error at byte %ld reading %d bytes in file %s",
statbuf.st_size - bytes_left, bufsiz, p);

(gdb) p  statbuf.st_size - bytes_left
$5 = 0
(gdb) p p
$6 = 0x8092095 "/net/basil"
(gdb) p bufsiz
$7 = 1024

The problem seems to be that when msg_perror is called with a 0 (zero)
arg, it crashes. Now the problem is that va_arg() is completely out of
my range.. :)

In fact, the real faulty line is:

#3  0x8052292 in msg_perror (
    str=0x80825c0 "read error at byte %ld reading %d bytes in file %s")
    at port.c:1138

  vfprintf (stderr, str, args);

But I can't just display the value of args and I really don't understand
(and never did) the whole va_arg() working principles. 

(gdb) print args
No symbol "args" in current context.
(gdb) 

ARG(H)!

Can someone help me out with this so I can send a PR and get this over
with? :))

Something very strange is that it crashes only when accessing
'automounted' directories:

bash-2.03$ ./tar -f /dev/null -A -v -C . /tmp
bash-2.03$ ./tar -f /dev/null -A -v -C . /   
bash-2.03$ ./tar -f /dev/null -A -v -C . /net/basil/u
./tar: Segmentation fault (core dumped)
bash-2.03$ ./tar -f /dev/null -A -v -C . /net/basil/u/jocelyn
./tar: Segmentation fault (core dumped)
bash-2.03$ ./tar -f /dev/null -A -v -C . /usr/tmp
bash-2.03$ ./tar -f /dev/null -A -v -C . /usr/local/bin
bash-2.03$ ./tar -f /dev/null -A -v -C . /net/sky/usr/home
./tar: Segmentation fault (core dumped)
bash-2.03$ 

And also, it does not crash with the -c function:


bash-2.03$ ./tar -f /dev/null -c -v -C . /net/sky/usr/home
./tar: Removing leading / from absolute path names in the archive.
net/sky/usr/home/
[...]

Weird. But thanks a lot for the core dump hint! I'll remember...
-- 
Antoine Beaupre
System Administrator
Chemical Computing Group, Inc.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3978C2AF.7A6362D4>