Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jun 2001 05:21:42 -0600 (MDT)
From:      jhein@timing.com
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        jkh@freebsd.org
Subject:   bin/28274: [PATCH] for pkg_add sym link issue in isdir() in pkg_install/lib/file.c
Message-ID:  <200106191121.f5JBLge58580@brain.timing.com>

next in thread | raw e-mail | index | archive | help

>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:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 19 04:30:02 PDT 2001
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106191121.f5JBLge58580>