Issue 73996 - Don't generate relative paths up to the root directory
Summary: Don't generate relative paths up to the root directory
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: quetschke
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks: 73499
  Show dependency tree
 
Reported: 2007-01-29 22:20 UTC by quetschke
Modified: 2013-08-07 15:34 UTC (History)
2 users (show)

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


Attachments
Patch for dmake (5.34 KB, patch)
2007-01-30 02:27 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 2007-01-29 22:20:52 UTC
Currently, when generating the target name of a prerequisite target using the
.SETDIR attribute and the current target dmake creates a relative target paths.
This is usually a good idea, but when the relative path goes up to the root
directory and down into a different tree this might not be always the best idea.
The same applies for the TMD macro.
(For the native windows version there was always the absolute path used if the
prerequisite lived on a different drive.)

I'm actually not able to think of a problem for *nix systems with this practice,
but when mixing a cygwin dmake with native W32 executables there are potential
problems.
For example the relative path from /home/user/ to /cygdrive/d/mydir/mytarget.bar
would be ../../cygdrive/d/mydir/mytarget.bar .

I don't see any harm in using the absolute path whenever the relative path would
go up to the root directory for all OSs, it even slightly shortens the path,
so that I wont make this patch cygwin specific.
Comment 1 quetschke 2007-01-29 22:34:58 UTC
Great, my example showed me that this approach is not enough to completely
solve this problem. So far I only thought of pathes like this:
 ../../tmp/foo/bar.baz
with mounted posix path components to produce problems, but there is also
the /cygdrive/X/ case.
Comment 2 quetschke 2007-01-30 02:27:05 UTC
Created attachment 42561 [details]
Patch for dmake
Comment 3 quetschke 2007-01-30 02:40:26 UTC
The previous patch has the desired behavior for "normal" *nix OSs plus it has
some extra handling for the cygwin /cygdrive/X/ case.

I verified that it works as expected with this makefile:

--- makefile ---
SHELL*:=/bin/sh
SHELLFLAGS*:=-ce

# The directory we started dmake in was /cygdrive/d/w1/something/

all: a1
	@echo Making all with: $?

#a1 .SETDIR=/tmp :
#a1 .SETDIR=/cygdrive/d/temp :
a1 .SETDIR=/cygdrive/c/temp :
	@echo Making a1
--- makefile ---

I wont create a testcase as that would depend on the path the testsuite is
executed in.

Commited to dmake48.
Comment 4 quetschke 2007-06-27 21:48:56 UTC
This works well and dmake48 is finished.
Comment 5 quetschke 2007-06-27 21:49:22 UTC
c