From jin@george.lbl.gov  Mon Dec 12 23:58:03 2005
Return-Path: <jin@george.lbl.gov>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 82D1A16A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 Dec 2005 23:58:03 +0000 (GMT)
	(envelope-from jin@george.lbl.gov)
Received: from smtp106.sbc.mail.mud.yahoo.com (smtp106.sbc.mail.mud.yahoo.com [68.142.198.205])
	by mx1.FreeBSD.org (Postfix) with SMTP id 0723543D5A
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 Dec 2005 23:58:02 +0000 (GMT)
	(envelope-from jin@george.lbl.gov)
Received: (qmail 42356 invoked from network); 12 Dec 2005 23:19:04 -0000
Received: from unknown (HELO ?192.168.2.8?) (jinmtb@sbcglobal.net@68.127.176.52 with plain)
  by smtp106.sbc.mail.mud.yahoo.com with SMTP; 12 Dec 2005 23:19:03 -0000
Message-Id: <439E06CE.1020007@george.lbl.gov>
Date: Mon, 12 Dec 2005 15:25:02 -0800
From: "Jin Guojun [VFFS]" <jin@george.lbl.gov>
To: FreeBSD-gnats-submit@freebsd.org
Subject: tar (bsdtar) core dump on non-existing symlink

>Number:         90315
>Category:       bin
>Synopsis:       tar(1) (bsdtar) core dump on non-existing symlink
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kientzle
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 13 00:00:23 GMT 2005
>Closed-Date:    Sun Apr 02 18:42:24 GMT 2006
>Last-Modified:  Sun Apr 02 18:42:24 GMT 2006
>Originator:     Jin Guojun[VFF]
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
>Environment:
 System: FreeBSD wolf.Belkin 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Fri Dec 
 9 13:26:21 PST 2005 root@wolf.Belkin:/usr/src/sys/i386/compile/MinMax i386
 
         FreeBSD 6.0-RELEASE i386
>Description:
         "tar -chf" under FreeBSD 6.0-RELEASE coredumps on non-exist symlink.
         This does not happen to any previous FreeBSD release. They 
 report as:
 tar: test/yyyy: Cannot stat: No such file or directory
 
         coredumps is found on i386 machines. Plesae verify on other
         architectures.
 
>How-To-Repeat:
 
 % cd /tmp; mkdir test
 % ln -s /home/xxxx/yyyy test
 % tar -chf - test > /dev/null
 Segmentation fault (core dumped)
 % ls -l test
 -rw-------  1 jin  wheel  397312 Dec 12 11:58 bsdtar.core
 lrwxr-xr-x  1 jin  wheel      15 Dec 12 11:57 yyyy@ -> /home/xxxx/yyyy
 
>Fix:
 
         it coredumps in /usr/src/usr.bin/tar/write.c at line 689:
 
                 if (!S_ISDIR(st->st_mode) && (st->st_nlink > 1))
                 lookup_hardlink(bsdtar, entry, st);
 
         (xxgdb) p st
         $1 = (const struct stat *) 0x0
 
         st is passed in from line 651 in write_hierarchy called from 396
         in write_archive()
         At line 631, lst assigned to 0x0 (NULL), and line 650 did not
         check this contition and passed it to write_entry() and
         cause core dump.
 
         Simple fix:
                 check lst at line 650.
                 if it is NULL, print warning message and skip to continue.
 
 -- 
 ------------ Jin Guojun ----------- v --- jin@george.lbl.gov ---
 Distributed Systems Department		http://www.dsd.lbl.gov/~jin
 Lawrence Berkeley National Laboratory,	Berkeley, CA 94720
 
 
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Dec 13 00:05:18 UTC 2005 
Responsible-Changed-Why:  
Rescue this PR from the 'pending' category. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=90315 
Responsible-Changed-From-To: freebsd-bugs->kientzle 
Responsible-Changed-By: arved 
Responsible-Changed-When: Mon Jan 2 18:46:42 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=90315 
State-Changed-From-To: open->closed 
State-Changed-By: kientzle 
State-Changed-When: Sun Apr 2 18:41:46 UTC 2006 
State-Changed-Why:  
Duplicate of bin/95175 

http://www.freebsd.org/cgi/query-pr.cgi?pr=90315 
>Unformatted:
