bugmake - Bugs: bug #65276, SECONDEXPANSION doesn't work...


bug #65276: SECONDEXPANSION doesn't work correctly with escaped spaces

Submitter:  None
Submitted:  Thu 08 Feb 2024 06:44:26 PM UTC
Severity:  3 - Normal Item Group:  Bug
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.3 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup

Fri 09 Feb 2024 12:09:25 AM UTC, comment #2: 

Thanks! Yes, make doesn't support filenames with spaces. But (almost) everywhere, this shortcoming can be circumvented by escaping the space. And I've just checked, this problem is not just about spaces, but supposedly all escaped characters pose a problem: I tried the same thing with a colon in the filename, make gives the same error.

Geza Herman <geza>
Thu 08 Feb 2024 08:42:49 PM UTC, comment #1: 

I will take a look at this, but up-front I will say that GNU Make, like all POSIX make instances, does not intend to support pathnames containing spaces as either targets or prerequisites.

It may be possible to get them to work in some limited situations with a lot of effort, but it's not a goal of GNU Make to allow this to work.  We don't have any tests of this behavior in our regression tests for example.

If it ends up being simple to make this work then we will try to do so, but if it's not easy or straightforward then we will not try to do it.

Paul D. Smith <psmith>
Group administrator
Thu 08 Feb 2024 06:44:26 PM UTC, original submission:  

I attached a Makefile and t.cpp. Put these into a directory which has a space in its name. Run make, notice that it works correctly.

Now, at line 14, change the order-only dependency to "| $$(ROOT)/build" (add a $ in front). Delete the "build" directory, and try again make. This time make will fail a "No rule to make target '<path>/sp bug/build/t.o' message.

If I use the -d switch to make, I see this:

Considering target file 'all'.
 File 'all' does not exist.
 Looking for an implicit rule for 'all'.
 No implicit rule found for 'all'.
  Considering target file '<path>/sp bug/build/t.o'.
   File '<path>/sp bug/build/t.o' does not exist.
   Looking for an implicit rule for '<path>/sp bug/build/t.o'.
   Trying pattern rule with stem 't'.
   Trying implicit prerequisite '<path>/sp\'.
   Trying pattern rule with stem 't'.
   Trying implicit prerequisite '<path>/sp\'.
   Looking for a rule with intermediate file '<path>/sp\'.
    Avoiding implicit rule recursion.
   No implicit rule found for '<path>/sp bug/build/t.o'.
   Finished prerequisites of target file '<path>/sp bug/build/t.o'.
  Must remake target '<path>/sp bug/build/t.o'.
make: *** No rule to make target '<path>/sp bug/build/t.o', needed by 'all'.  Stop.

It seems that even though "sp\ bug" has the space escaped, it is still split into two parts, "sp\" and "bug".



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

Attach Files:

Attached Files
file #55677:  Makefile added by None (302B - application/octet-stream)
file #55678:  t.cpp added by None (15B - text/x-c++src)


Depends on the following items: None found

Items that depend on this one: None found


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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-02-08 None Attached File- Added Makefile, #55677
        Attached File- Added t.cpp, #55678

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code