bugmake - Bugs: bug #17521, target-specific variables inluding...


bug #17521: target-specific variables inluding semicolon

Submitter:  None
Submitted:  Fri 25 Aug 2006 08:43:51 AM UTC
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.81 Operating System:  Any
Fixed Release:  3.82 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup

Mon 08 Jun 2009 12:47:19 PM UTC, comment #4: 

Fixed.  Thanks.

Paul D. Smith <psmith>
Group administrator
Tue 03 Feb 2009 04:22:09 PM UTC, comment #3: 

escaping the "offending" semicolons with a backslash alleviates the problem, but remains a source of inconsistency and frustration.

Fri 25 Aug 2006 03:55:38 PM UTC, comment #2: 

Actually, Eli, if the example shown is accurate (I haven't tried it) then this seems to be a bug.  First note that the two cases behave differently: the one without the semicolon strips the backslash and the one with it does not.  That can't be right.

Second, the text you're quoting applies to backslashes inside the command script: these backslashes are in variable values (even though they're target-specific variables they still follow the rules for setting variables) and the behavior of backslashes in variable values didn't change.

Again, I haven't looked at this at all but offhand I'd say there's some issue with the parser finding semicolons in target-specific variables: remember make needs to handle semicolons in a normal target definition such as "all: ; @echo all" specially.

Paul D. Smith <psmith>
Group administrator
Fri 25 Aug 2006 01:05:44 PM UTC, comment #1: 

This is not a bug, but a documented change in behavior, intended to bring GNU Make in line with Posix specification for Make.

From the NEWS file:

  • WARNING: Backward-incompatibility!

  In order to comply with POSIX, the way in which GNU make processes
  backslash-newline sequences in command strings has changed.  If your
  makefiles use backslash-newline sequences inside of single-quoted
  strings in command scripts you will be impacted by this change.  See
  the GNU make manual subsection "Splitting Command Lines" (node
  "Splitting Lines"), in section "Command Syntax", chapter "Writing the
  Commands in Rules", for details.

In other words, your Makefile violates Posix rules for Make; in order to fix your Makefile, either use double quotes instead of single quotes, or put the single-quoted string into a Make variable and use that variable in rule's commands.

Eli Zaretskii <eliz>
Group Member
Fri 25 Aug 2006 08:43:51 AM UTC, original submission:  

$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

This program built for i686-pc-cygwin
$ cat Makefile
test:  HELLO = 'hello \

test2: HELLO2 = 'hello; \

test :
@echo $(HELLO)
test2 :
@echo $(HELLO2)

$ make test
hello world
$ make test2
hello; \

I expect 'hello; world'.




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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-28 psmith Fixed Release4.0 3.82
    2009-06-08 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Operating SystemMS Windows Any
        Fixed ReleaseNone 4.0

    Back to the top

    Powered by Savane 3.13-ec27.
    Corresponding source code