Issue 85136 - dmake can't find config files when in directory containing $ in name
Summary: dmake can't find config files when in directory containing $ in name
Status: CLOSED FIXED
Alias: None
Product: Build Tools
Classification: Code
Component: dmake (show other issues)
Version: current
Hardware: PC Windows, all
: P3 Trivial (vote)
Target Milestone: ---
Assignee: quetschke
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-10 11:25 UTC by shay
Modified: 2013-08-07 15:34 UTC (History)
2 users (show)

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


Attachments
Patch for dmake (775 bytes, patch)
2008-02-06 22:10 UTC, quetschke
no flags Details | Diff
Patch for dmake (926 bytes, patch)
2008-02-07 15:26 UTC, quetschke
no flags Details | Diff
Patch for dmake (541 bytes, patch)
2008-02-07 15:40 UTC, quetschke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description shay 2008-01-10 11:25:46 UTC
dmake.exe can't find its configuration files when it is run from within a
directory that contains a $ character in its name.

E.g. put the following in C:\Temp\makefile.mk:

all :
	+@echo Hello

and put dmake.exe and its startup\ directory in C:\Temp\$test

Then 'cd' to C:\Temp and run:

$test\dmake.exe

The output is:

dmake.exe:  Error: -- Configuration file `C:\Temp\est\startup\startup.mk' not found
Comment 1 quetschke 2008-02-06 15:57:12 UTC
Usually I would say don't do that  ;)  I mean using $ in targets/prerequisites
is asking for trouble as macros in target names are evaluated before defining
the rules or - even worse - dynamic prerequisites are evaluated at run time.

I might be able to fix this particular problem by not expanding $(ABSMAKECMD).
Your problem comes from startup.mk being searched for in
 "$(ABSMAKECMD:d)startup/startup.mk"
but there might lurk problems in every dynamic macro. It might just work because
absolute paths are rarely used.
Comment 2 quetschke 2008-02-06 22:10:44 UTC
Created attachment 51412 [details]
Patch for dmake
Comment 3 quetschke 2008-02-06 22:13:19 UTC
The previous patch fixes the ABSMAKECMD problem and thus the config.mk problem.
Comment 4 quetschke 2008-02-06 22:23:06 UTC
Committed. Please verify.
Comment 5 shay 2008-02-07 09:29:01 UTC
I checked out cws_src680_dmake412, confirmed that the source contains your
patch, and re-tested the bug exactly as I originally reported, and I'm afraid
that I still get exactly the same error.

Should this bug be re-opened, or rejected as "don't do that!"?
Comment 6 quetschke 2008-02-07 15:26:21 UTC
Created attachment 51420 [details]
Patch for dmake
Comment 7 quetschke 2008-02-07 15:40:05 UTC
Created attachment 51422 [details]
Patch for dmake
Comment 8 quetschke 2008-02-07 15:49:26 UTC
Hmm, I only checked if $(ABSMAKECMD) and $(MAKESTARTUP) were set to the right
value and kept the $, but dmake was doing a little more behind our backs.

The previous two patches (committed) take care of this and I verified that I
now actually can run the following makefile with dmake being installed to a path
that has a $ in it.

-- makefile.mk --
SHELL:=cmd.exe 
SHELLFLAGS:=/S /C

all :
	@echo AXXA
	@echo ABSMAKECMD:$(ABSMAKECMD)A
	@echo MAKESTARTUP:$(MAKESTARTUP):A
-- makefile.mk --

$ ./dmake/dmake.exe
AXXA
ABSMAKECMD:d:\w1\cws_src680_dmake412\mingw$\dmake\dmake.exeA
MAKESTARTUP:d:\w1\cws_src680_dmake412\mingw$\dmake\startup\startup.mk:A


Please check again.
Comment 9 shay 2008-02-08 08:58:55 UTC
Yes, looks good to me now. I can even build perl using a dmake.exe in
C:\Temp\$test. Thanks!
Comment 10 hjs 2008-02-26 16:10:24 UTC
ok, last comment from shay counts as "verified" regarding this particular issue.
also, i couldn't find regressions regarding nested macros or similar (yes, i
tried ;)). but i still don't feel comfortable with this change...
Comment 11 quetschke 2008-02-26 16:49:11 UTC
> also, i couldn't find regressions regarding nested macros or similar (yes, i
> tried ;)). but i still don't feel comfortable with this change...

At first I wasn't feeling comfortable with this either, but I tripple checked
that it actually was a bug before. Before the patch a macro holding a
(make-)filename was always expanded twice, now it's done only when needed.

And removing unneeded Expand() calls is a small run-time optimization ;)
Comment 12 hjs 2009-02-24 11:53:27 UTC
.