Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xinstall When creating a relative symlink (-lr), use...



details:   https://anonhg.NetBSD.org/src/rev/ffa9ef15c77b
branches:  trunk
changeset: 580818:ffa9ef15c77b
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue May 10 01:24:42 2005 +0000

description:
When creating a relative symlink (-lr), use the originally provided `to_name'
to create and metalog, rather than using the realpath(3) modified version.
Fixes a problem with -lr when -ddestdir contains a symlink.

Add some XXX comments reminding us that the `from_name' in a symlink may
point outside of destdir in the metalog, even though our build process
doesn't trigger this.

diffstat:

 usr.bin/xinstall/xinstall.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 63ae204bdc9a -r ffa9ef15c77b usr.bin/xinstall/xinstall.c
--- a/usr.bin/xinstall/xinstall.c       Tue May 10 00:39:04 2005 +0000
+++ b/usr.bin/xinstall/xinstall.c       Tue May 10 01:24:42 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xinstall.c,v 1.89 2005/05/08 23:05:02 lukem Exp $      */
+/*     $NetBSD: xinstall.c,v 1.90 2005/05/10 01:24:42 lukem Exp $      */
 
 /*
  * Copyright (c) 1987, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
 #else
-__RCSID("$NetBSD: xinstall.c,v 1.89 2005/05/08 23:05:02 lukem Exp $");
+__RCSID("$NetBSD: xinstall.c,v 1.90 2005/05/10 01:24:42 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -506,6 +506,7 @@
                if (realpath(from_name, src) == NULL)
                        err(1, "%s: realpath", from_name);
                do_symlink(src, to_name);
+                       /* XXX: src may point outside of destdir */
                metadata_log(to_name, "link", NULL, src, NULL);
                return;
        }
@@ -546,8 +547,9 @@
 
                (void)strlcat(lnk, ++s, sizeof(lnk));
 
-               do_symlink(lnk, dst);
-               metadata_log(dst, "link", NULL, lnk, NULL);
+               do_symlink(lnk, to_name);
+                       /* XXX: lnk may point outside of destdir */
+               metadata_log(to_name, "link", NULL, lnk, NULL);
                return;
        }
 
@@ -556,6 +558,7 @@
         * try the names the user provided
         */
        do_symlink(from_name, to_name);
+               /* XXX: from_name may point outside of destdir */
        metadata_log(to_name, "link", NULL, from_name, NULL);
 }
 



Home | Main Index | Thread Index | Old Index