Issue 46987 - $(mktmp ...) works different than documented
Summary: $(mktmp ...) works different than documented
Status: CLOSED FIXED
Alias: None
Product: Build Tools
Classification: Code
Component: dmake (show other issues)
Version: current
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: hjs
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-07 23:17 UTC by quetschke
Modified: 2013-08-07 15:34 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Documentation fix for mktmp and new :m macro expansion (5.78 KB, patch)
2005-04-12 02:33 UTC, quetschke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description quetschke 2005-04-07 23:17:59 UTC
While looking at issue 43241 I found that $(mktmp ...) is *not* working
as the man page describes it:

  ... The diversion text may contain the
  same escape codes as those described in the MACROS  section.   Thus  if
  the  data  text is to contain new lines they must be inserted using the
  \n escape sequence.  For example the expression:

              all:
                   cat $(mktmp this is a\n\
                   test of the text diversion\n)

But the documentation is not consistent in this case anyway, the escape codes
are only part of the tokenization (:t) macro modifier and are not supported
anywhere else.

I guess this "feature" was disabled once mktmp was used with DOS filenames
and produced surprising results.

@hjs: How do we solve this problem? Fix the documentation?

(ATM the last line of the generated mktmp file is terminated with a linefeed
(issue 15816) and linefeeds in between can be inserted with the :t macro
modifier.)

P.S.: I could offer to add an evaluate (:v) macro modifier that evaluates
escape codes if present.
Comment 1 quetschke 2005-04-07 23:19:44 UTC
I take it
Comment 2 quetschke 2005-04-12 02:33:21 UTC
Created attachment 24952 [details]
Documentation fix for mktmp and new :m macro expansion
Comment 3 quetschke 2005-04-18 19:59:31 UTC
Committed to CWS dmake43p01.

reassign to verify
Comment 4 quetschke 2005-04-18 19:59:56 UTC
vq->hjs: please verify
Comment 5 hjs 2006-04-06 17:13:40 UTC
in this example the tab escape chhar following the newline escapechar is
stripped. this might be desireable after line continuation but is surprising in
the first line.

-----------------------------------------

test:=test1\n\ttes\tt2\n\
    test3

all:
    cat $(mktmp $(test:m))
Comment 6 quetschke 2006-04-06 17:56:37 UTC
Hmm, the problem is in the part of the code that I didn't touch.

Try:

test:=test1\n\ttes\tt2\n\
    test3

all:
	echo "X:$(test:m):Z"

and you'll see that the :m is doing the right thing, but $(mktmp is cutting of
the leading spaces.

OK, to keep the current behaviour and create a new issue with:
"function macro mktmp is cutting of leading whitespaces" ?
Comment 7 hjs 2006-04-06 18:19:00 UTC
perfectly fine, just wanted to mention it
Comment 8 hjs 2006-04-21 17:31:59 UTC
.