bugmake - Bugs: bug #17245, $(notdir foo/) should return ....

 
 

bug #17245: $(notdir foo/) should return . instead of blank

Submitted by:  None
Submitted on:  Mon 31 Jul 2006 09:11:01 PM UTC  
 
Severity: 3 - NormalItem Group: Enhancement
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Component Version: 3.79.1Operating System: POSIX-Based
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 08 Jun 2009 03:45:46 AM UTC, comment #2:

The notdir function has been around for so many years now I'm not sure how reasonable it is to change it, even if the alternative is better. How many thousands of makefiles have been written expecting notdir to work the way it does?

At any rate I'm marking this as an Enhancement.

Paul D. Smith <psmith>
Project Administrator
Sun 31 Dec 2006 01:54:40 AM UTC, comment #1:

Well, if you need such functionality, you can write your own function:

====
MyNotDir_1 = $(if $(patsubst %/,,$1),$(notdir $1),.)#OK
MyNotDir = $(foreach v,$1,$(call MyNotDir_1,$v))
====

Now, MyNotDir acts as you expect.

I've tested it on make 3.80 & make 3.81.

Of course, GNUmake should better add a new internal function for this, so that users like you don't have to bother adding his own functions.

Jun Chen <chjfth>
Mon 31 Jul 2006 09:11:01 PM UTC, original submission:

Documentation for notdir says:

"A file name that ends with a slash becomes an empty string. This is unfortunate, because it means that the result does not always have the same number of whitespace-separated file names as the argument had; but we do not see any other valid alternative."

Wrong. $(notdir foo/) should return . (a period).

This way, $(dir name)/$(notdir name) = name always.

A path ending in / is only really valid if it is a directory. If it is a directory, then it contains . and .. so returning . should be valid if the original path was valid. And foo/./bar is the same as foo/bar unless a filesystem is screwed up.

So the . should be returned instead of nothing, to keep the number of filenames the same, and to allow join to rejoin them correctly.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by chjfth (Posted a comment)
  •  

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 08 Jun 2009 03:45:46 AM UTCpsmithItem GroupBug=>Enhancement

    Back to the top


    Powered by Savane 3.1-cleanup1