unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* reading "#!"
@ 2003-06-02  5:32 Pascal Bourguignon
  0 siblings, 0 replies; only message in thread
From: Pascal Bourguignon @ 2003-06-02  5:32 UTC (permalink / 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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-06-02  5:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-02  5:32 reading "#!" Pascal Bourguignon

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