bugmake - Bugs: bug #43378, $(guile ...) must be coaxed to...

 
 

bug #43378: $(guile ...) must be coaxed to accept (or does not accept) valid guile code.

Submitter:  Taahir Ahmed <ahmedtd>
Submitted:  Wed 08 Oct 2014 12:27:13 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Duplicate Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.0 Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 26 Dec 2016 02:36:18 PM UTC, comment #5: 

The issue about # not being handled correctly is Savannah bug #20513

Paul D. Smith <psmith>
Group administrator
Fri 10 Oct 2014 05:54:48 PM UTC, comment #4: 

Yes there are many things you can use instead of #nil: you can use an empty string, an empty list, and #f, at least.  You can see http://www.gnu.org/software/make/manual/html_node/Guile-Types.html for a discussion of how Guile types are converted back into make strings.

Paul D. Smith <psmith>
Group administrator
Fri 10 Oct 2014 05:22:27 PM UTC, comment #3: 

Ah, I see.  The #nil trick is a decent enough workaround, although it will be mystifying to anyone reading the code at first glance.  I wonder if a just plain empty string would work?

Anyway, I'll need to look over my code to see if there are any other places where I'm emitting random stuff into the makefile that just happens to work.

Thanks for the explanation.

Taahir Ahmed <ahmedtd>
Fri 10 Oct 2014 05:10:25 PM UTC, comment #2: 

I agree that make's handling of # is busted: there's actually a bug open elsewhere for similar issues in the $(shell ...) function.  This needs to be fixed... unfortunately it's a bit problematic since by now people are adding backslashes to escape the #, which we don't want, so this will be a backward-incompatible change.  Maybe for a time we can accept both.  Or something.

For your second example, this is intended (and necessary) behavior.  The problem you're having is not that ! is an illegal character (it's not; ! is in no way special to make).  The problem is that the $(guile ...) function expands to the results of the Guile code.  In your case the function you invoked was append!, and that function expands to the new list after the append is done.  So after make runs this:


$(guile (append! %load-path (list "./")))


make sees (and tries to parse) this:


/usr/share/guile/2.0 /usr/share/guile/site/2.0 /usr/share/guile/site /usr/share/guile ./


and that gives you the "missing separator" error.

You can avoid this by having the final term in your Guile code be #nil; as per the documentation make converts #nil to the empty string:


$(guile (append! %load-path (list "./")) #nil)


Note backslash is not needed for # here, for some reason (ugh!)

Paul D. Smith <psmith>
Group administrator
Wed 08 Oct 2014 03:41:26 AM UTC, comment #1: 

I just realized that the sharps can be escaped with backslash (not sure why that didn't occur to me before).

However, the other problematic characters can't be handled this way: if I enter a \! in $(guile), both characters get passed through to the guile layer, not just the !.

Taahir Ahmed <ahmedtd>
Wed 08 Oct 2014 12:27:13 AM UTC, original submission:  

The $(guile) function does not accept all valid guile code.

For example, the sharps here are unconditionally interpreted as comments:

----make code snip----
libelektros_CFLAGS := $(guile (augmk/pkg-config/cflags "eigen3" #:sedsystem #t))
----make code snap----

Sharps are fairly important syntactic components of guile --- they are the syntax both for several literal types and for keyword arguments.  The snippet illustrates both usages.

Other characters cause problems as well.  For example, adding to the load path:

----make code snip----
$(guile (append! %load-path (list "./")))
----make code snap----

For this snippet, I get "***missing separator.  Stop.".  I have to explicitly show make that this is an assignment in order for it to be accepted:

----make code snip----
DUMMY:=$(guile (append! %load-path (list "./")))
----make code snap----

Looking at the parse function, it seems like all function calls are handled as a variable assignment (possibly to nothing).  However, the manual shows several non-assignment uses of the $(guile) function, so I assume that this is meant to be supported behavior.

Taahir Ahmed <ahmedtd>

 

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

Attach Files:
   
   
Comment:
   

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)
  • -email is unavailable- added by ahmedtd (Submitted the item)
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2016-12-26 psmith StatusNone Duplicate
        Open/ClosedOpen Closed
    2014-10-10 psmith Component VersionNone 4.0

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code