bug-make
[Top][All Lists]
Advanced

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

Re: make-3.81: bug-report: function abspath works incorrectly on widows


From: Vitaly Murashev
Subject: Re: make-3.81: bug-report: function abspath works incorrectly on widows
Date: Thu, 26 Jun 2008 14:44:38 +0400

On Wed, Jun 25, 2008 at 9:37 PM, Eli Zaretskii <address@hidden> wrote:
>> Date: Wed, 25 Jun 2008 20:19:39 +0400
>> From: "Vitaly Murashev" <address@hidden>
>>
>> I found a bug in GNU Make 3.81 on MS Windows. So let me discuss it and
>> suggest a patch.
>
> Thanks.  Your code is generally OK, but, unless I'm missing something,
> it has a few deficiencies:
>
>  . It doesn't add an explicit drive letter to file names such as
>    "/foo/bar", and generally treats such names incorrectly.

You are right, and i suppose that the best way is to keep original GNU
Make behavior intact for this case.
E.g. "/foo/bar" must be treated as full qualified path even on MS Windows.
And my fix must affects only paths which are not prefixed with '/'.

>
>  . It doesn't produce fully qualified file names from drive-relative
>    names such as "d:foo/bar".

Not really. My patch produces the same output for "d:foo/bar"
and for "d:/foo/bar", the result is "d:/foo/bar"

>
>  . It assumes Windows file names use only `/' as directory separator
>    character, while in reality there could be `\' as well.

Yes, it does, but before my patch it assumes the same. And as i can
understand it is a common behavior for GNU Make. Even the 'current
directory'-variable internally uses '/' as a path separator. So i
don't like to fix this issue.
- - - - -

Please note, that the main goal of my patch is to fix code like this:

DIR_HERE = $(abspath $(dir $(lastword $(MAKEFILE_LIST))))

This code on MS Windows works incorrectly if it is invoked inside a
makefile which has been included from another makefile via full
qualified path to it. For example, we have two makefiles in the same
directory:
"d:\devl\test\makefile" and "d:\devl\test\test.mak"

'makefile' has the next code:
---
DIR_HERE = $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
$(info makefile, DIR_HERE=$(DIR_HERE))
include $(DIR_HERE)/test.mak
---

'test.mak' has the next code:
---
$(info test.mak, DIR_HERE=$(DIR_HERE))
---

Output without my patch:
---
D:\devl\test>make
makefile, DIR_HERE=D:/devl/test
test.mak, DIR_HERE=D:/devl/test/D:/devl/test
make: *** No targets.  Stop.
---

Output with my patch:
---
D:\devl\test>make_msvc.net2003.exe
makefile, DIR_HERE=D:/devl/test
test.mak, DIR_HERE=D:/devl/test
make_msvc.net2003.exe: *** No targets.  Stop.
---

Reworked patch is in attachment.
Thanks.

Attachment: function.c.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]