From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.bugs Subject: reading "#!" Date: 02 Jun 2003 07:32:20 +0200 Organization: informatimago.com Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <877k85rqmz.fsf@thalassa.informatimago.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1054531929 27557 80.91.224.249 (2 Jun 2003 05:32:08 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 2 Jun 2003 05:32:09 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 02 07:32:07 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19MhvT-0007A9-00 for ; Mon, 02 Jun 2003 07:32:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Mhwr-0005Qk-1I for gnu-bug-gnu-emacs@m.gmane.org; Mon, 02 Jun 2003 01:33:33 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19Mhwl-0005KZ-L0 for bug-gnu-emacs@prep.ai.mit.edu; Mon, 02 Jun 2003 01:33:27 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19MhwN-0004kX-K8 for bug-gnu-emacs@prep.ai.mit.edu; Mon, 02 Jun 2003 01:33:04 -0400 Original-Received: from mailbox6.ucsd.edu ([132.239.1.58]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19MhwI-0004DE-UO for bug-gnu-emacs@prep.ai.mit.edu; Mon, 02 Jun 2003 01:32:59 -0400 Original-Received: from mail.fu-berlin.de (mail.fu-berlin.de [160.45.11.165]) by mailbox6.ucsd.edu (8.12.9/8.12.3) with ESMTP id h525WUQF049300 for ; Sun, 1 Jun 2003 22:32:40 -0700 (PDT) Original-Received: by mail.fu-berlin.de (Smail3.2.0.98) from Curry.ZEDAT.FU-Berlin.DE (160.45.10.36) with esmtp id ; Mon, 2 Jun 2003 07:32:30 +0200 (MEST) Original-Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.fu-berlin.de with bsmtp id ; Mon, 2 Jun 2003 07:32:27 +0200 (MEST) Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: thalassa.informatimago.COM!not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 55 X-Orig-NNTP-Posting-Host: thalassa.informatimago.com (195.114.85.198) X-Orig-X-Trace: fu-berlin.de 1054531947 9154852 195.114.85.198 (16 [41911]) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-Spamscanner: mailbox6.ucsd.edu (v1.2 May 26 2003 01:55:38, -0.5/5.0 2.55) X-MailScanner: PASSED (v1.2.7 35022 h525WUQF049300 mailbox6.ucsd.edu) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:5214 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5214 $ emacs --version GNU Emacs 21.3.50.1 Copyright (C) 2002 Free Software Foundation, Inc. GNU Emacs comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of Emacs under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING. $ emacs --no-init-file --no-site-file --batch \ --eval '(read-from-string "#!/bin/bash")' loops indefinitely, or at least, more than I care to wait for it. (Not specific to --batch). The bug seems to be in read1 (lread.c) arround: if (c == '!') { /* #! appears at the beginning of an executable file. Skip the first line. */ while (c != '\n') c = READCHAR; goto retry; } That's not because we have a "#!' that it's followed by '\n'! Make it: while((c != '\n')&&(c>'\0')){ c = READCHAR; } I don't see any comment arround the readchar header specifying its contract: static int readchar (readcharfun) Lisp_Object readcharfun; { but it seems that it may return -1 in some cases too... -- __Pascal_Bourguignon__ http://www.informatimago.com/ ---------------------------------------------------------------------- Do not adjust your mind, there is a fault in reality.