From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27767 invoked by alias); 6 Feb 2009 12:38:02 -0000 Received: (qmail 27707 invoked by uid 22791); 6 Feb 2009 12:38:01 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from 137-67-76-76-skybeam.com (HELO mail.chez-thomas.org) (76.76.67.137) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Feb 2009 12:37:56 +0000 Received: by mail.chez-thomas.org (Postfix, from userid 999) id 5A84F3B529E0; Fri, 6 Feb 2009 05:37:51 -0700 (MST) Received: from hermes.chez-thomas.org (hermes_local [192.168.1.101]) by mail.chez-thomas.org (Postfix) with ESMTP id F12513B5263B; Fri, 6 Feb 2009 05:37:50 -0700 (MST) Message-ID: <498C2F1E.20609@mlbassoc.com> Date: Fri, 06 Feb 2009 12:38:00 -0000 From: Gary Thomas User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Bart Veer CC: John Dallaway , ecos-maintainers@ecos.sourceware.org Subject: Re: #!/usr/bin/env tclsh References: <496635B7.8060808@dallaway.org.uk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact ecos-maintainers-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-maintainers-owner@ecos.sourceware.org X-SW-Source: 2009-02/txt/msg00009.txt.bz2 Bart Veer wrote: >>>>>> "John" == John Dallaway 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 ------------------------------------------------------------