Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make: avoid double slash in name of temporary d...



details:   https://anonhg.NetBSD.org/src/rev/0e14e25a6f19
branches:  trunk
changeset: 961810:0e14e25a6f19
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Apr 19 16:35:11 2021 +0000

description:
make: avoid double slash in name of temporary directory

If the environment variable TMPDIR is not set, make uses a default path
that includes a trailing '/'.

For extra correctness it always appended an extra '/', leading to paths
of the form '/tmp//makeXXXXXX'.  This looked suspicious, as if there had
been a forgotten empty part between the two '/'.  Avoid this ambiguity
by replacing '//' with '/'.

diffstat:

 usr.bin/make/main.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 7475d1931b90 -r 0e14e25a6f19 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Mon Apr 19 14:42:18 2021 +0000
+++ b/usr.bin/make/main.c       Mon Apr 19 16:35:11 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.538 2021/04/14 17:24:48 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.539 2021/04/19 16:35:11 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.538 2021/04/14 17:24:48 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.539 2021/04/19 16:35:11 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -2198,7 +2198,7 @@
                return tmpdir;
 
        /* Honor $TMPDIR but only if it is valid. Ensure it ends with '/'. */
-       (void)Var_Subst("${TMPDIR:tA:U" _PATH_TMP "}/",
+       (void)Var_Subst("${TMPDIR:tA:U" _PATH_TMP ":S,/$,,W}/",
            SCOPE_GLOBAL, VARE_WANTRES, &tmpdir);
        /* TODO: handle errors */
 



Home | Main Index | Thread Index | Old Index