bugmake - Bugs: bug #33399, Double-colon rules sometimes...


bug #33399: Double-colon rules sometimes behave like if they were single-colon

Submitted by:  None
Submitted on:  Wed 25 May 2011 11:47:05 AM UTC  
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  Paul D. Smith <psmith> Open/Closed:  Closed
Component Version:  3.82 Operating System:  Any
Fixed Release:  4.0 Triage Status:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 14 Nov 2011 07:35:44 AM UTC, comment #3: 

I can't find any other character which causes this problem; using "a\:b" for example works fine with the version of make in CVS.  All other characters that seem like they would be candidates also work fine.

However examining the code I agree with you, it's a bug.  I've committed a fix to CVS for this.

Note that while it is possible to make certain very trivial things work as expected with spaces in filenames, many other things won't work.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Sun 18 Sep 2011 12:05:17 PM UTC, comment #2: 

Actually, given right quoting, make handles whitespace in target names just fine: example in original post works as expected if rules were single-colon.

The problem described is different: it's that make doesn't set double-colon flag on rule when actual and literal target names have different lengths (because of successfully escaped characters (not necessary whitespace (e.g. target a\:b  fails the same way))).

The attached patch fixes this problem, it is only one line long and it doesn't break backward compatibility.

ordcoder <ordcoder>
Mon 12 Sep 2011 01:14:19 AM UTC, comment #1: 

It isn't the backslash that's causing the issue.  It's the whitespace.  If you change the target to a backslash followed by a non-whitespace character then things work fine.  GNU make doesn't support whitespace in target names (see bug #712).

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Wed 25 May 2011 11:47:05 AM UTC, original submission:  

When target of double-colon rule have characters escaped by backslashes, make doesn't mark this rule as double-colon.
Simplest example of makefile illustrating the problem is:

a\ b :: ; @echo one
a\ b :: ; @echo two

Output of make 'a b':

Makefile:2: warning: overriding recipe for target `a b'
Makefile:1: warning: ignoring old recipe for target `a b'

While the expected output is:


I'm using GNU Make 3.82 on Gentoo x86_64. Make built from the latest CVS also has this issue.

After examining the source I made a trivial patch (attached) which fixes this problem (tested on few projects and as far as I can see it doesn't break anything).



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #23449:  double-colon.patch added by None (339B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by ordcoder (Posted a comment)
  • -email is unavailable- added by psmith (Posted a comment)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-11-14 psmith StatusNot A Bug => Fixed
        Assigned toNone => psmith
        Operating SystemPOSIX-Based => Any
        Fixed ReleaseNone => 4.0
    2011-09-12 psmith StatusNone => Not A Bug
        Open/ClosedOpen => Closed
    2011-05-25 None Attached File- => Added double-colon.patch, #23449

    Back to the top

    Powered by Savane 3.6