public inbox for ecos-maintainers@sourceware.org
 help / color / mirror / Atom feed
From: Gary Thomas <gary@mlbassoc.com>
To: Bart Veer <bartv@ecoscentric.com>
Cc: John Dallaway <john@dallaway.org.uk>,
	  ecos-maintainers@ecos.sourceware.org
Subject: Re: #!/usr/bin/env tclsh
Date: Fri, 06 Feb 2009 12:38:00 -0000	[thread overview]
Message-ID: <498C2F1E.20609@mlbassoc.com> (raw)
In-Reply-To: <pn4oz7g3d6.fsf@delenn.bartv.net>

Bart Veer wrote:
>>>>>> "John" == John Dallaway <john@dallaway.org.uk> writes:
> 
>     John> This patch simplifies the #! magic used to invoke Tcl
>     John> scripts by using "/usr/bin/env tclsh" to find the tclsh
>     John> executable. Very old Cygwin installations providing only
>     John> tclsh83.exe or cygtclsh80.exe are no-longer supported.
>     John> Checked-in.
> 
> Actually, this patch has broken things in various ways. Consider e.g.
> file2c.tcl in the romfs package. The CDL invokes this using e.g.:
> 
>   sh file2c.tcl testromfs_le.bin testromfs_le.h
> 
> With the old magic this still worked fine because sh would ignore the
> #! at the start completely and move on to the 'exec sh -c' on line 3.
> With the new '#!/usr/bin/env tclsh' the sh invocation ignores the
> #! comment on line 1 so ends up trying to run the whole Tcl script as
> a shell script. Needless to say this is not very successful.
> 
> io/framebuf is similarly affected. services/memalloc/common is not. I
> have not yet checked all the other packages that use Tcl scripts.
> 
> Possible solutions are:
> 
> 1) revert the change
> 2) remove the 'sh' bits from the relevant CDL scripts, treating the
>    Tcl script as plain executables.
> 3) make the CDL invoke /usr/bin/env tclsh directly, treating the
>    Tcl scripts as Tcl scripts.
> 
> (1) would be a bad move. I think I would prefer (3) to (2).

Why isn't this working? According to 'man sh' on my Linux system:
       If the program is a file beginning with #!, the remainder of the first line specifies an  interpreter
       for  the program.  The shell executes the specified interpreter on operating systems that do not han-
       dle this executable format themselves.  The arguments to the interpreter consist of a single optional
       argument following the interpreter name on the first line of the program, followed by the name of the
       program, followed by the command arguments, if any.

It would seem that since Linux *does* handle this directly, 'sh'
chooses to ignore it :-(

In any case, I vote for (2), otherwise you may end up with the
same problem all of this was trying to fix in the first place,
namely not knowing where/how to find 'tclsh'


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

  reply	other threads:[~2009-02-06 12:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <496635B7.8060808@dallaway.org.uk>
     [not found] ` <49663810.3010202@eCosCentric.com>
2009-01-08 17:51   ` John Dallaway
2009-01-08 18:21     ` Jonathan Larmour
2009-02-06 12:24 ` Bart Veer
2009-02-06 12:38   ` Gary Thomas [this message]
2009-02-06 12:53     ` Bart Veer
2009-02-06 13:49   ` John Dallaway
2009-02-06 14:03     ` Gary Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=498C2F1E.20609@mlbassoc.com \
    --to=gary@mlbassoc.com \
    --cc=bartv@ecoscentric.com \
    --cc=ecos-maintainers@ecos.sourceware.org \
    --cc=john@dallaway.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).