bugtexinfo - GNU documentation system - Bugs: bug #33374, "local" as function name...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #33374: "local" as function name is questionable sh syntax

Submitted by:  Jonathan Nieder <jrn>
Submitted on:  Mon 23 May 2011 02:58:33 AM UTC  
 
Category: texi2dviRelease: 2011-05-21
Priority: 3 - LowSeverity: 3 - Normal
Item Group: enhancementPrivacy: Public
Open/Closed: ClosedAssigned to: None
Status: Fixed

Mon 23 May 2011 10:06:33 PM UTC, comment #1:

Hi Jonathan -- thank you very much for the careful explanation and patch. I installed it.

I also took this opportuntity to upload the current texi2dvi to ftp.gnu.org in the probably-vain hope that distros will pick it up before the next full release. As far as I know, the present script should work fine with earlier releases and has lots of bug fixes over what was in 4.13.

Thanks again.

Karl Berry <karl>
Project Administrator
Mon 23 May 2011 02:58:33 AM UTC, original submission:

Hi,

As previously reported at <http://bugs.debian.org/619786>, texi2dvi errors out when run using recent versions of dash from git://git.kernel.org/pub/scm/utils/dash/dash.git as shell:

| $ texi2dvi
| /usr/bin/texi2dvi: 144: /usr/bin/texi2dvi: Syntax error: Bad function name
| $ sed -ne 144p /usr/bin/texi2dvi
| ) || local () {
| $ dash -c 'true || local () { echo hi; }; echo continuing'; echo $?
| dash: 1: Syntax error: Bad function name
| 2

The cause is use of "local" as a function name --- like typeset and export, "local" is a special builtin in these versions of dash, and using it as a function name is a syntax error[*].

ksh similarly errors out when it sees an attempt to define "export" or "typeset" as a function, but it does not treat "local" as special, and perhaps future versions of dash will follow that lead. So I am reporting this not to say "this construct is invalid shell command language" but rather "this is at the edge of portability and probably worth avoiding".

Anyway, it's simple to hide this construct from the parser for such shells by wrapping the function definition in 'eval'. Shells that support "local" don't have to parse that code and shells that do not support "local" are not going to have a problem with it.

Thanks for reading, and hope that helps,
Jonathan

[*] http://austingroupbugs.net/view.php?id=383

Jonathan Nieder <jrn>

 

Attached Files
file #23438:  texi2dvi-local-fallback-syntax added by jrn (1012B - application/octet-stream - patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by karl (Posted a comment)
  • -unavailable- added by jrn (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 23 May 2011 10:06:33 PM UTCkarlOpen/ClosedOpen=>Closed
      StatusNone=>Fixed
    Mon 23 May 2011 02:58:33 AM UTCjrnAttached File-=>Added texi2dvi-local-fallback-syntax, #23438

    Back to the top


    Powered by Savane 3.1-cleanup1