bugmake - Bugs: bug #16670, Repeated backslash-escaped...

 
 

bug #16670: Repeated backslash-escaped newlines not POSIXly replaced

Submitted by:  Ray Ingles <sorceror>
Submitted on:  Wed 24 May 2006 01:56:09 PM UTC  
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  Paul D. Smith <psmith> Open/Closed:  Closed
Component Version:  3.81 Operating System:  POSIX-Based
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.

 

Sat 03 Mar 2012 06:53:16 PM UTC, comment #3: 

I modified the .POSIX pseudo target behavior so that if it's set, then we get POSIX-style backslash/newline handling.  The default, though, remains the GNU make method.

If you want to portably get the POSIX behavior without specifying .POSIX, you can do this:

# empty variable
E =
FOO = a      $E\
$E\
b

That is, add empty variable references so that the parser doesn't think that the backslash/newlines are really consecutive, and that the whitespace is not trailing.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Tue 02 Jun 2009 02:24:45 PM UTC, comment #2: 

Ugh.  Savannah's comments kind of suck.  I mean, the current behavior gives:

a b

and the POSIXly-correct behavior would give:

a         b

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Tue 02 Jun 2009 02:23:06 PM UTC, comment #1: 

OK, the fix for this is simple enough.  However, it does cause user-visible changes.  It's not so much the replacing of each backslash/newline/following whitespace with a space that's the issue, it's the fact that TRAILING whitespace on the previous line is no longer condensed.  The current behavior basically condenses ALL whitespace starting with the last non-whitespace character on the previous line and going until the next non-whitespace character (where backslash/newline are considered whitespace) and replaces it with a single space.  So, in the current version of make this:

FOO = a        \
     b

Gives a value of $(FOO) that is "a b".  In the new behavior this would give "a         b", because the trailing whitespace on the previous line is preserved, plus one extra space for the backslash/newline/following whitespace.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Wed 24 May 2006 01:56:09 PM UTC, original submission:  

According to POSIX, each escaped newline (newline preceeded by a backslash) is supposed to be replaced with a single space when not in a command. However, sequential escaped newlines are replaced by only a single space. The attached makefile illustrates the problem.

Ray Ingles <sorceror>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #10043:  makefile added by sorceror (38B - application/octet-stream - Makefile illustrating repeated escaped newlines replaced with single space.)

 

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)
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-03-03 psmith StatusNone => Fixed
        Assigned toNone => psmith
        Open/ClosedOpen => Closed
        Fixed ReleaseNone => 4.0
    2006-05-24 sorceror Attached File- => Added makefile, #10043

    Back to the top


    Powered by Savane 3.6