From jhein@timing.com  Tue Jun 19 04:21:45 2001
Return-Path: <jhein@timing.com>
Received: from Daffy.timing.com (daffy.timing.com [206.168.13.218])
	by hub.freebsd.org (Postfix) with ESMTP
	id 6555237B401; Tue, 19 Jun 2001 04:21:44 -0700 (PDT)
	(envelope-from jhein@timing.com)
Received: from brain.timing.com (brain.timing.com [206.168.13.195])
	by Daffy.timing.com (8.9.3/8.9.3) with ESMTP id FAA23394;
	Tue, 19 Jun 2001 05:21:43 -0600 (MDT)
	(envelope-from jhein@timing.com)
Received: (from jhein@localhost)
	by brain.timing.com (8.11.3/8.11.3) id f5JBLge58580;
	Tue, 19 Jun 2001 05:21:42 -0600 (MDT)
	(envelope-from jhein)
Message-Id: <200106191121.f5JBLge58580@brain.timing.com>
Date: Tue, 19 Jun 2001 05:21:42 -0600 (MDT)
From: jhein@timing.com
Reply-To: jhein@timing.com
To: FreeBSD-gnats-submit@freebsd.org
Cc: jkh@freebsd.org
Subject: [PATCH] for pkg_add sym link issue in isdir() in pkg_install/lib/file.c
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         28274
>Category:       bin
>Synopsis:       [PATCH] for pkg_add to sym linked dir that is > 1 sym link deep
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 19 04:30:02 PDT 2001
>Closed-Date:    Sat Aug 11 14:26:11 PDT 2001
>Last-Modified:  Sat Aug 11 14:26:23 PDT 2001
>Originator:     John Hein <jhein@timing.com>
>Release:        FreeBSD 4.3-RELEASE i386, and -CURRENT
>Organization:
Timing Solutions Corporation
>Environment:

System: FreeBSD brain.timing.com 4.3-RELEASE-TSC FreeBSD 4.3-RELEASE-TSC #0: Fri Jun 15 15:37:47 MDT 2001 imp@marvin.timing.com:/net/brain/uv/staging/imp/FreeBSD-tsc-4/sys/compile/BRAIN i386

System: FreeBSD bugs.timing.com 5.0-CURRENT FreeBSD 5.0-CURRENT #4: Fri Jun  8 18:36:42 MDT 2001     imp@bugs.timing.com:/net/brain/uv/staging/imp/FreeBSD-current/src/sys/compile/BUGS  i386


>Description:

The fix in rev 1.40 (jkh) of usr.sbin/pkg_install/lib/file.c to handle sym
 linked dirs doesn't catch sym links deeper than one.


>How-To-Repeat:

mkdir /tmp/prefix
ln -s /tmp/prefix /tmp/a
ln -s /tmp/a /tmp/b
pkg_add -p /tmp/b some_pkg.tgz

You should see something to the effect of:

pkg_add: extract_plist: unable to cwd to '/tmp/b'


>Fix:

Follow sym link all the way to '.'
(patch against -current version of the file...)

$ cvs diff -u file.c
Index: file.c
===================================================================
RCS file: /base/FreeBSD-CVS/src/usr.sbin/pkg_install/lib/file.c,v
retrieving revision 1.49
diff -u -r1.49 file.c
--- file.c	2001/06/13 11:55:40	1.49
+++ file.c	2001/06/19 11:05:55
@@ -48,7 +48,7 @@
 
     if (lstat(fname, &sb) != FAIL && S_ISDIR(sb.st_mode))
 	return TRUE;
-    else if (lstat(strconcat(fname, "/"), &sb) != FAIL && S_ISDIR(sb.st_mode))
+    else if (lstat(strconcat(fname, "/."), &sb) != FAIL && S_ISDIR(sb.st_mode))
 	return TRUE;
     else
 	return FALSE;
>Release-Note:
>Audit-Trail:

From: John E Hein <jhein@timing.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/28274: [PATCH] for pkg_add to sym linked dir that is > 1 sym link deep
Date: Fri, 10 Aug 2001 10:27:30 -0600

 This PR can be closed
 
 The patch was committed in rev 1.51
State-Changed-From-To: open->closed 
State-Changed-By: dd 
State-Changed-When: Sat Aug 11 14:26:11 PDT 2001 
State-Changed-Why:  
requested by originator 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=28274 
>Unformatted:
