From owner-freebsd-questions Fri Jul 21 14:45:47 2000 Delivered-To: freebsd-questions@freebsd.org Received: from smtp13.bellglobal.com (smtp13.bellglobal.com [204.101.251.52]) by hub.freebsd.org (Postfix) with ESMTP id A6FCA37B8F1 for ; Fri, 21 Jul 2000 14:45:38 -0700 (PDT) (envelope-from admin@chemcomp.com) Received: from hermes.chemcomp.com (ppp12584.qc.bellglobal.com [206.172.133.97]) by smtp13.bellglobal.com (8.8.5/8.8.5) with ESMTP id RAA12103; Fri, 21 Jul 2000 17:49:48 -0400 (EDT) Received: from chemcomp.com (sky.chemcomp.com [192.1.1.62]) by hermes.chemcomp.com (Postfix) with ESMTP id DBF2116824; Fri, 21 Jul 2000 17:39:07 -0400 (EDT) Message-ID: <3978C2AF.7A6362D4@chemcomp.com> Date: Fri, 21 Jul 2000 17:37:51 -0400 From: System Administrator Organization: Chemical Computing Group, Inc. X-Mailer: Mozilla 4.72 [en] (X11; I; FreeBSD 4.0-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: Rahul Siddharthan Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Tar bug??? References: <3978A6F6.55C3E578@chemcomp.com> <20000722021522.A8449@physics.iisc.ernet.in> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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