mainAutoconf - Support: sr #108262, Correct quoting for a parameter in...

 
 

sr #108262: Correct quoting for a parameter in the documentation

Submitter:  Markus Elfring <elfring>
Submitted:  Fri 08 Mar 2013 01:01:27 PM UTC
   
 
Priority:  * 5 - Unprioritized Severity:  3 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 09 Mar 2013 02:05:54 PM UTC, comment #7: 

Thanks for your clarification.

Should it appear also in any section of the Autoconf documentation?

Do you know any function which can be reused for the suggested safe quoting of paths and file names?

Markus Elfring <elfring>
Sat 09 Mar 2013 01:23:21 PM UTC, comment #6: 

Autoconf does not escape ' in variables stored for make.  While it is possible to write code for GNU make that can escape ' in an arbitrary make variable, it is up to you to write your Makefile.in to request this treatment.  Automake does not do this sort of escaping for projects using Makefile.am (because it cannot be portably done with non-GNU make), but Automake-NG will target only GNU make and so it might provide ways to safely escape all possible path names, including ones with ' in the name.  Basically, the autoconf approach is to assume that space is much more likely than single quote to appear in a filename; therefore, writing a make expansion that is in turn passed to the shell is much more likely to be useful if it uses shell single quoting to protect any spaces in the textual make expansion, and assume that the make expansion will never produce a single quote that completely throws off shell parsing.

Eric Blake <ericb>
Group administrator
Sat 09 Mar 2013 06:20:45 AM UTC, comment #5: 

I miss still a bit of information.

Are paths stored in variables like "srcdir" in a way that "special" characters (like a single quote) are escaped by the Autoconf software?
I imagine that another function would be needed to display such data as an original/unescaped string if it was adjusted by the system infrastructure somehow.

I would like to point out that there are also use cases to distinguish the places better in a command where variable expansion/substitution should be performed.


Markus Elfring <elfring>
Fri 08 Mar 2013 06:41:57 PM UTC, comment #4: 

A variable like "srcdir" belongs to the set of preset output variables.
Does the tool "make" provide a function for the application of similar adjustments to custom strings for safe quoting in a target environment?

Markus Elfring <elfring>
Fri 08 Mar 2013 05:48:47 PM UTC, comment #3: 

Yes, that's right, 'make' doesn't care about shell quoting; it interpolates regardless of what the shell thinks the quotes are.

Paul Eggert <eggert>
Group administrator
Fri 08 Mar 2013 05:47:05 PM UTC, comment #2: 

Thanks for your adjustment.

I had a different understanding for the handling of single quotes here. Is expansion of make variables also performed inside single-quoted strings before the affected command is passed from a recipe to an executing shell?

Markus Elfring <elfring>
Fri 08 Mar 2013 05:25:19 PM UTC, comment #1: 

Thanks, I pushed the attached documentation patch to explain things better.

(file #27578)

Paul Eggert <eggert>
Group administrator
Fri 08 Mar 2013 01:01:27 PM UTC, original submission:  

I find the apostrophes around a parameter inappropriate like the following example in the documentation.
        $(MAKEINFO) '$(srcdir)/time.texinfo'

I assume that macro/variable expansion should not be avoided here, should it otherwise?

Markus Elfring <elfring>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #27578:  patch.txt added by eggert (1KiB - text/plain - doc fix)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ericb (Posted a comment)
  • -email is unavailable- added by eggert (Updated the item)
  • -email is unavailable- added by elfring (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
    2013-03-08 eggert Open/ClosedOpen Closed
    2013-03-08 eggert Attached File- Added patch.txt, #27578
        StatusNone Done

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code