summaryrefslogtreecommitdiff
path: root/mk/wrapper
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2016-01-31 17:27:41 +0000
committerrillig <rillig@pkgsrc.org>2016-01-31 17:27:41 +0000
commitd4c2a0ce15915dfbd3ced363e69e63e9f0caf5a1 (patch)
tree2832887a601f9d4b5e548053ac1adc615d58d29e /mk/wrapper
parent03d463627d978cb544d7ab7e3177507df3aadd17 (diff)
downloadpkgsrc-d4c2a0ce15915dfbd3ced363e69e63e9f0caf5a1.tar.gz
Fixed subst.mk not to corrupt files
Up to now, using subst.mk may have led to file corruption during active package development. This happened when a sed(1) command had a syntax error, in which case the whole sed(1) command was terminated, leaving an empty original file behind. This commit changes that behavior by applying the sed(1) commands to the original file and saving the result in a temporary file. Only after that succeeded is the original file overwritten. During this rewrite, SUBST_POSTCMD has been removed, since it was only used in one place (mk/wrapper), and since it relied on the exact sequence of the internal commands. No package in either main pkgsrc or pkgsrc-wip uses this variable right now.
Diffstat (limited to 'mk/wrapper')
-rw-r--r--mk/wrapper/bsd.wrapper.mk4
1 files changed, 2 insertions, 2 deletions
diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk
index 8f79a36263e..2bdb9b6ad0b 100644
--- a/mk/wrapper/bsd.wrapper.mk
+++ b/mk/wrapper/bsd.wrapper.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.wrapper.mk,v 1.93 2015/04/27 19:59:07 jperkin Exp $
+# $NetBSD: bsd.wrapper.mk,v 1.94 2016/01/31 17:27:41 rillig Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -688,7 +688,7 @@ SUBST_MESSAGE.unwrap= Unwrapping files-to-be-installed.
SUBST_FILES.unwrap= ${_UNWRAP_FILES}
SUBST_SED.unwrap= ${_UNWRAP_SED}
.if defined(_WRAPPER_DEBUG) && !empty(_WRAPPER_DEBUG:M[yY][eE][sS])
-SUBST_POSTCMD.unwrap= ${DO_NADA}
+_SUBST_KEEP.unwrap= ${CP} -f "$$file" "$$file.before-unwrap"
.endif
.endif