unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pascal Bourguignon <spam@thalassa.informatimago.com>
Subject: reading "#!"
Date: 02 Jun 2003 07:32:20 +0200	[thread overview]
Message-ID: <877k85rqmz.fsf@thalassa.informatimago.com> (raw)


$ 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.

                 reply	other threads:[~2003-06-02  5:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=877k85rqmz.fsf@thalassa.informatimago.com \
    --to=spam@thalassa.informatimago.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).