bugmake - Bugs: bug #28230, $(eval) does not understand...

 
 

bug #28230: $(eval) does not understand multiline

Submitted by:  Stepan Koltsov <yozh>
Submitted on:  Tue 08 Dec 2009 06:53:47 PM UTC  
 
Severity: 3 - NormalItem Group: None
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: NoneOperating System: None
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.

 

Sat 03 Jul 2010 07:05:42 PM UTC, comment #2:

As Philip mentions, this is the intended/documented behavior.

I recommend using "include" rather than eval; have your script write out a file, then include that file.

Paul D. Smith <psmith>
Project Administrator
Tue 08 Dec 2009 10:02:01 PM UTC, comment #1:

To quote the info pages:

The `shell' function performs the same function that backquotes
(``') perform in most shells: it does "command expansion". This means that it takes as an argument a shell command and evaluates to the output of the command. The only processing `make' does on the result is to convert each newline (or carriage-return / newline pair) to a single space. If there is a trailing (carriage-return and) newline it will simply be removed.

So, $(eval) isn't actually seeing two lines in this case, but just a single one. The described behavior is as specified by the documentation, so it seems like "not a bug", though maybe a feature request for a version of $(shell) that gives a multiline result is called for.

Philip Guenther

Anonymous
Tue 08 Dec 2009 06:53:47 PM UTC, original submission:

====
# cat script.sh
#!/bin/sh -e

echo "a = 1"
echo "b = 2"

# cat Makefile
$(eval $(shell ./script.sh))
$(info $(a))
$(info $(b))

xx:
# gmake
1 b = 2

gmake: Nothing to be done for `xx'.
====

"1 b = 2\n\n" is printed. "1\n2\b" expected.

Stepan Koltsov <yozh>

 

(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 yozh (Submitted the item)
  •  

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

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 03 Jul 2010 07:05:42 PM UTCpsmithStatusNone=>Not A Bug
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1