GNU bug report logs - #4616
23.1.50; empty script files

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Markus Rost <rost@HIDDEN>; dated Fri, 2 Oct 2009 14:10:06 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 4616@HIDDEN:


Received: (at 4616) by emacsbugs.donarmstrong.com; 8 Oct 2009 17:43:43 +0000
From rost@HIDDEN Thu Oct  8 10:43:42 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-2.2 required=4.0 tests=AWL,HAS_BUG_NUMBER,
	MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Received: from mail2.math.uni-bielefeld.de (mail2.math.uni-bielefeld.de [129.70.14.10])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n98HhfpE028944
	for <4616@HIDDEN>; Thu, 8 Oct 2009 10:43:42 -0700
Received: from sonic02.math.uni-bielefeld.de (sonic02.math.uni-bielefeld.de [129.70.14.134])
	by mail2.math.uni-bielefeld.de (Postfix) with ESMTP id A42B57304B;
	Thu,  8 Oct 2009 19:43:35 +0200 (CEST)
Received: by sonic02.math.uni-bielefeld.de (Postfix, from userid 3710)
	id 11AC9EFE6B; Thu,  8 Oct 2009 19:43:33 +0200 (CEST)
From: Markus Rost <rost@HIDDEN>
To: 4616 <at> debbugs.gnu.org
Subject: bug#4616: 23.1.50; empty script files
X-GNU-Emacs-Mailer: GNU Emacs 22.3
X-Home-Page: http://www.math.uni-bielefeld.de/~rost
Message-Id: <20091008174333.11AC9EFE6B@HIDDEN>
Date: Thu,  8 Oct 2009 19:43:32 +0200 (CEST)

What is the best way to implement --script?  Let me discuss some
possibilities:

1. The current implementation.  It consists of the lines

      if (c == '!')
	{
	  /* #! appears at the beginning of an executable file.
	     Skip the first line.  */
	  while (c != '\n' && c >= 0)
	    c = READCHAR;
	  goto retry;
	}

   in function read1 in lread.c.  This is appealing by its brevity.
   However it has the disadvantage that the basic read function has a
   *general* feature in order to get --script and the "#!"-syntax
   working.  Further it leads to the bug originally posted:  Execution
   of an empty script file like

   ===File ~/x.el==============================================
   #!/home/rost/build/cvs/emacs/src/emacs --script
   ============================================================

   yields an "End of file during parsing" error and returns with positive
   exit status.

2. One may think of handling --script by first removing a first
   #!-line before passing the file to load.  This seems to be very
   hard to implement because the load routine is complicated
   (switching back and forth between C and Elisp functions).  Besides
   this practical problem, there is the following disadvantage:  In
   some circumstances one may want to load a script file directly, as
   in

   emacs -batch ... -l ~/x.el ...

   Moreover, when editing the file one may want to test it with
   eval-buffer.

3. This leaves the possibility to handle #!-lines when running
   eval-region.  It should skip a #!-line at the beginning of the
   region.  It could skip any #!-line in the region, which is what
   read1 does right now, but I see no necessity for that.  This would
   be implemented by my two previous patches

   <URL:http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-10/msg00082.html>
   <URL:http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-10/msg00124.html>

   Of course making a change in readevalloop/read1 needs a careful
   check, maybe by several people.  However, the patch is a very
   "local" one around the variable unread_char and there are only a
   few places where unread_char appears, so checking the patch is not
   too much work.  Moreover, if something would be wrong with the
   change, very likely emacs would not even compile as many files are
   loaded during the build process.



Acknowledgement sent to Markus Rost <rost@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.

Message received at 4616@HIDDEN:


Received: (at 4616) by emacsbugs.donarmstrong.com; 6 Oct 2009 15:19:56 +0000
From rost@HIDDEN Tue Oct  6 08:19:56 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-2.0 required=4.0 tests=AWL,HAS_BUG_NUMBER
	autolearn=unavailable version=3.2.5-bugs.debian.org_2005_01_02
Received: from mail1.math.uni-bielefeld.de (mail1.math.uni-bielefeld.de [129.70.14.32])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n96FJsqP018052
	for <4616@HIDDEN>; Tue, 6 Oct 2009 08:19:56 -0700
Received: from sonic02.math.uni-bielefeld.de (sonic02.math.uni-bielefeld.de [129.70.14.134])
	by mail1.math.uni-bielefeld.de (Postfix) with ESMTP id 2EEA7959A8;
	Tue,  6 Oct 2009 17:19:49 +0200 (CEST)
Received: by sonic02.math.uni-bielefeld.de (Postfix, from userid 3710)
	id EB62AEFE6F; Tue,  6 Oct 2009 17:19:48 +0200 (CEST)
From: Markus Rost <rost@HIDDEN>
To: Andreas Schwab <schwab@HIDDEN>
CC: 4616 <at> debbugs.gnu.org, emacs-pretest-bug@HIDDEN
In-reply-to: <m2k4zbmvao.fsf@HIDDEN> (message from Andreas Schwab on
	Sun, 04 Oct 2009 10:13:03 +0200)
Subject: Re: bug#4616: 23.1.50; empty script files
X-GNU-Emacs-Mailer: GNU Emacs 22.3
X-Home-Page: http://www.math.uni-bielefeld.de/~rost
References: <20091002140131.2998D2865C20@HIDDEN> <m2k4zbmvao.fsf@HIDDEN>
Message-Id: <20091006151948.EB62AEFE6F@HIDDEN>
Date: Tue,  6 Oct 2009 17:19:48 +0200 (CEST)

One more thing about unread_char in lread.c.  That variable should
start with value -1 rather than value 0.  The current initial value 0
means that the character 0 is added in front of loadup.el when
building emacs.  Now since loadup.el isn't empty, this doesn't cause
a read error, the additional character will be just skipped and the
value of unread_char is set to -1 after loading loadup.el.

So one doesn't notice the wrong initial value.  But maybe one changes
that for clarity.


*** lread.c	06 Oct 2009 14:22:15 +0200	1.414
--- lread.c	06 Oct 2009 17:01:06 +0200	
***************
*** 270,276 ****
     Qlambda, or a cons, we use this to keep an unread character because
     a file stream can't handle multibyte-char unreading.  The value -1
     means that there's no unread character. */
! static int unread_char;
  
  static int
  readchar (readcharfun, multibyte)
--- 270,276 ----
     Qlambda, or a cons, we use this to keep an unread character because
     a file stream can't handle multibyte-char unreading.  The value -1
     means that there's no unread character. */
! static int unread_char = -1;
  
  static int
  readchar (readcharfun, multibyte)



Acknowledgement sent to Markus Rost <rost@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.

Message received at submit@HIDDEN:


Received: (at submit) by emacsbugs.donarmstrong.com; 6 Oct 2009 15:19:55 +0000
From rost@HIDDEN Tue Oct  6 08:19:55 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-2.0 required=4.0 tests=AWL,HAS_BUG_NUMBER
	autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n96FJstc018060
	for <submit@HIDDEN>; Tue, 6 Oct 2009 08:19:55 -0700
Received: from mx10.gnu.org ([199.232.76.166]:59996)
	by fencepost.gnu.org with esmtp (Exim 4.67)
	(envelope-from <rost@HIDDEN>)
	id 1MvBpR-0002vb-Ho
	for emacs-pretest-bug@HIDDEN; Tue, 06 Oct 2009 11:19:53 -0400
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60)
	(envelope-from <rost@HIDDEN>)
	id 1MvBpP-0003P6-23
	for emacs-pretest-bug@HIDDEN; Tue, 06 Oct 2009 11:19:53 -0400
Received: from mail1.math.uni-bielefeld.de ([129.70.14.32]:65448)
	by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60)
	(envelope-from <rost@HIDDEN>)
	id 1MvBpO-0003Oq-Id
	for emacs-pretest-bug@HIDDEN; Tue, 06 Oct 2009 11:19:50 -0400
Received: from sonic02.math.uni-bielefeld.de (sonic02.math.uni-bielefeld.de [129.70.14.134])
	by mail1.math.uni-bielefeld.de (Postfix) with ESMTP id 2EEA7959A8;
	Tue,  6 Oct 2009 17:19:49 +0200 (CEST)
Received: by sonic02.math.uni-bielefeld.de (Postfix, from userid 3710)
	id EB62AEFE6F; Tue,  6 Oct 2009 17:19:48 +0200 (CEST)
From: Markus Rost <rost@HIDDEN>
To: Andreas Schwab <schwab@HIDDEN>
CC: 4616 <at> debbugs.gnu.org, emacs-pretest-bug@HIDDEN
In-reply-to: <m2k4zbmvao.fsf@HIDDEN> (message from Andreas Schwab on
	Sun, 04 Oct 2009 10:13:03 +0200)
Subject: Re: bug#4616: 23.1.50; empty script files
X-GNU-Emacs-Mailer: GNU Emacs 22.3
X-Home-Page: http://www.math.uni-bielefeld.de/~rost
References: <20091002140131.2998D2865C20@HIDDEN> <m2k4zbmvao.fsf@HIDDEN>
Message-Id: <20091006151948.EB62AEFE6F@HIDDEN>
Date: Tue,  6 Oct 2009 17:19:48 +0200 (CEST)
X-detected-operating-system: by monty-python.gnu.org: FreeBSD 5.3-5.4

One more thing about unread_char in lread.c.  That variable should
start with value -1 rather than value 0.  The current initial value 0
means that the character 0 is added in front of loadup.el when
building emacs.  Now since loadup.el isn't empty, this doesn't cause
a read error, the additional character will be just skipped and the
value of unread_char is set to -1 after loading loadup.el.

So one doesn't notice the wrong initial value.  But maybe one changes
that for clarity.


*** lread.c	06 Oct 2009 14:22:15 +0200	1.414
--- lread.c	06 Oct 2009 17:01:06 +0200	
***************
*** 270,276 ****
     Qlambda, or a cons, we use this to keep an unread character because
     a file stream can't handle multibyte-char unreading.  The value -1
     means that there's no unread character. */
! static int unread_char;
  
  static int
  readchar (readcharfun, multibyte)
--- 270,276 ----
     Qlambda, or a cons, we use this to keep an unread character because
     a file stream can't handle multibyte-char unreading.  The value -1
     means that there's no unread character. */
! static int unread_char = -1;
  
  static int
  readchar (readcharfun, multibyte)



Acknowledgement sent to Markus Rost <rost@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.

Message received at 4616@HIDDEN:


Received: (at 4616) by emacsbugs.donarmstrong.com; 5 Oct 2009 03:11:44 +0000
From rost@HIDDEN Sun Oct  4 20:11:44 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-1.7 required=4.0 tests=AWL,FOURLA,HAS_BUG_NUMBER,
	MURPHY_DRUGS_REL8 autolearn=unavailable
	version=3.2.5-bugs.debian.org_2005_01_02
Received: from xen16.math.uni-bielefeld.de (xen16.math.uni-bielefeld.de [129.70.14.14])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n953Bg5Y023467
	for <4616@HIDDEN>; Sun, 4 Oct 2009 20:11:44 -0700
Received: from sonic02.math.uni-bielefeld.de (sonic02.math.uni-bielefeld.de [129.70.14.134])
	by xen16.math.uni-bielefeld.de (Postfix) with ESMTP id E8F8F30072BE;
	Mon,  5 Oct 2009 05:11:36 +0200 (CEST)
Received: by sonic02.math.uni-bielefeld.de (Postfix, from userid 3710)
	id CD61EEFB40; Mon,  5 Oct 2009 05:11:36 +0200 (CEST)
From: Markus Rost <rost@HIDDEN>
To: Andreas Schwab <schwab@HIDDEN>
CC: 4616 <at> debbugs.gnu.org, emacs-pretest-bug@HIDDEN
In-reply-to: <m2k4zbmvao.fsf@HIDDEN> (message from Andreas Schwab on
	Sun, 04 Oct 2009 10:13:03 +0200)
Subject: Re: bug#4616: 23.1.50; empty script files
X-GNU-Emacs-Mailer: GNU Emacs 22.3
X-Home-Page: http://www.math.uni-bielefeld.de/~rost
References: <20091002140131.2998D2865C20@HIDDEN> <m2k4zbmvao.fsf@HIDDEN>
Message-Id: <20091005031136.CD61EEFB40@HIDDEN>
Date: Mon,  5 Oct 2009 05:11:36 +0200 (CEST)
X-CrossAssassin-Score: 2

What about the following tentative patch?

It moves the handling of '#!' from read1 up to readevalloop, which
then would skip the first line if it starts with '#!'.

To achieve this, the patch allows the readchar/unreadchar mechanism to
look 2 characters ahead, instead of just 1.

Omitting ' && first_sexp' in the patch would skip '#!' + rest of line
anywhere as before.

Be aware that I just made some guesses after glancing briefly over
lread.c (and I am not a C-programmer).


*** /home/rost/build/cvs/emacs/src/lread.c.~1.414~	2009-10-05 01:38:28.000000000 +0200
--- /home/rost/build/cvs/emacs/src/lread.c	2009-10-05 04:31:51.000000000 +0200
***************
*** 271,276 ****
--- 271,277 ----
     a file stream can't handle multibyte-char unreading.  The value -1
     means that there's no unread character. */
  static int unread_char;
+ static int unread_char1;
  
  static int
  readchar (readcharfun, multibyte)
***************
*** 410,415 ****
--- 411,422 ----
    return XINT (tem);
  
   read_multibyte:
+   if (unread_char1 >= 0)
+     {
+       c = unread_char1;
+       unread_char1 = -1;
+       return c;
+     }
    if (unread_char >= 0)
      {
        c = unread_char;
***************
*** 489,499 ****
      }
    else if (CONSP (readcharfun))
      {
!       unread_char = c;
      }
    else if (EQ (readcharfun, Qlambda))
      {
!       unread_char = c;
      }
    else if (EQ (readcharfun, Qget_file_char)
  	   || EQ (readcharfun, Qget_emacs_mule_file_char))
--- 496,512 ----
      }
    else if (CONSP (readcharfun))
      {
!       if (unread_char >= 0)
! 	unread_char1 = c;
!       else
! 	unread_char = c;
      }
    else if (EQ (readcharfun, Qlambda))
      {
!       if (unread_char >= 0)
! 	unread_char1 = c;
!       else
! 	unread_char = c;
      }
    else if (EQ (readcharfun, Qget_file_char)
  	   || EQ (readcharfun, Qget_emacs_mule_file_char))
***************
*** 505,511 ****
  	  UNBLOCK_INPUT;
  	}
        else
! 	unread_char = c;
      }
    else
      call1 (readcharfun, make_number (c));
--- 518,527 ----
  	  UNBLOCK_INPUT;
  	}
        else
! 	if (unread_char >= 0)
! 	  unread_char1 = c;
! 	else
! 	  unread_char = c;
      }
    else
      call1 (readcharfun, make_number (c));
***************
*** 1658,1663 ****
--- 1674,1680 ----
       Lisp_Object start, end;
  {
    register int c;
+   register int c1;
    register Lisp_Object val;
    int count = SPECPDL_INDEX ();
    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
***************
*** 1747,1752 ****
--- 1764,1782 ----
  	  unbind_to (count1, Qnil);
  	  break;
  	}
+       if (c == '#' && first_sexp)
+ 	{
+ 	  c1 = READCHAR;
+ 	  if (c1 == '!')
+ 	    {
+ 	      /* #! appears at the beginning of an executable file.
+ 		 Skip the first line.  */
+ 	      while ((c1 = READCHAR) != '\n' && c1 != -1);
+ 	      goto read_next;
+ 	    }
+ 	  else
+ 	    UNREAD (c1);
+ 	}
  
        /* Ignore whitespace here, so we can detect eof.  */
        if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r'
***************
*** 2607,2620 ****
  	  load_each_byte = 0;
  	  goto retry;
  	}
-       if (c == '!')
- 	{
- 	  /* #! appears at the beginning of an executable file.
- 	     Skip the first line.  */
- 	  while (c != '\n' && c >= 0)
- 	    c = READCHAR;
- 	  goto retry;
- 	}
        if (c == '$')
  	return Vload_file_name;
        if (c == '\'')
--- 2637,2642 ----




Acknowledgement sent to Markus Rost <rost@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.

Message received at submit@HIDDEN:


Received: (at submit) by emacsbugs.donarmstrong.com; 5 Oct 2009 03:11:44 +0000
From rost@HIDDEN Sun Oct  4 20:11:44 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-1.5 required=4.0 tests=AWL,FOURLA,HAS_BUG_NUMBER,
	MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n953BgI7023471
	for <submit@HIDDEN>; Sun, 4 Oct 2009 20:11:44 -0700
Received: from mail.gnu.org ([199.232.76.166]:35812 helo=mx10.gnu.org)
	by fencepost.gnu.org with esmtp (Exim 4.67)
	(envelope-from <rost@HIDDEN>)
	id 1MudzB-0001cQ-M5
	for emacs-pretest-bug@HIDDEN; Sun, 04 Oct 2009 23:11:41 -0400
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60)
	(envelope-from <rost@HIDDEN>)
	id 1Mudz9-0002ha-F4
	for emacs-pretest-bug@HIDDEN; Sun, 04 Oct 2009 23:11:41 -0400
Received: from xen16.math.uni-bielefeld.de ([129.70.14.14]:42391)
	by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60)
	(envelope-from <rost@HIDDEN>)
	id 1Mudz8-0002gw-Rp
	for emacs-pretest-bug@HIDDEN; Sun, 04 Oct 2009 23:11:39 -0400
Received: from sonic02.math.uni-bielefeld.de (sonic02.math.uni-bielefeld.de [129.70.14.134])
	by xen16.math.uni-bielefeld.de (Postfix) with ESMTP id E8F8F30072BE;
	Mon,  5 Oct 2009 05:11:36 +0200 (CEST)
Received: by sonic02.math.uni-bielefeld.de (Postfix, from userid 3710)
	id CD61EEFB40; Mon,  5 Oct 2009 05:11:36 +0200 (CEST)
From: Markus Rost <rost@HIDDEN>
To: Andreas Schwab <schwab@HIDDEN>
CC: 4616 <at> debbugs.gnu.org, emacs-pretest-bug@HIDDEN
In-reply-to: <m2k4zbmvao.fsf@HIDDEN> (message from Andreas Schwab on
	Sun, 04 Oct 2009 10:13:03 +0200)
Subject: Re: bug#4616: 23.1.50; empty script files
X-GNU-Emacs-Mailer: GNU Emacs 22.3
X-Home-Page: http://www.math.uni-bielefeld.de/~rost
References: <20091002140131.2998D2865C20@HIDDEN> <m2k4zbmvao.fsf@HIDDEN>
Message-Id: <20091005031136.CD61EEFB40@HIDDEN>
Date: Mon,  5 Oct 2009 05:11:36 +0200 (CEST)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)

What about the following tentative patch?

It moves the handling of '#!' from read1 up to readevalloop, which
then would skip the first line if it starts with '#!'.

To achieve this, the patch allows the readchar/unreadchar mechanism to
look 2 characters ahead, instead of just 1.

Omitting ' && first_sexp' in the patch would skip '#!' + rest of line
anywhere as before.

Be aware that I just made some guesses after glancing briefly over
lread.c (and I am not a C-programmer).


*** /home/rost/build/cvs/emacs/src/lread.c.~1.414~	2009-10-05 01:38:28.000000000 +0200
--- /home/rost/build/cvs/emacs/src/lread.c	2009-10-05 04:31:51.000000000 +0200
***************
*** 271,276 ****
--- 271,277 ----
     a file stream can't handle multibyte-char unreading.  The value -1
     means that there's no unread character. */
  static int unread_char;
+ static int unread_char1;
  
  static int
  readchar (readcharfun, multibyte)
***************
*** 410,415 ****
--- 411,422 ----
    return XINT (tem);
  
   read_multibyte:
+   if (unread_char1 >= 0)
+     {
+       c = unread_char1;
+       unread_char1 = -1;
+       return c;
+     }
    if (unread_char >= 0)
      {
        c = unread_char;
***************
*** 489,499 ****
      }
    else if (CONSP (readcharfun))
      {
!       unread_char = c;
      }
    else if (EQ (readcharfun, Qlambda))
      {
!       unread_char = c;
      }
    else if (EQ (readcharfun, Qget_file_char)
  	   || EQ (readcharfun, Qget_emacs_mule_file_char))
--- 496,512 ----
      }
    else if (CONSP (readcharfun))
      {
!       if (unread_char >= 0)
! 	unread_char1 = c;
!       else
! 	unread_char = c;
      }
    else if (EQ (readcharfun, Qlambda))
      {
!       if (unread_char >= 0)
! 	unread_char1 = c;
!       else
! 	unread_char = c;
      }
    else if (EQ (readcharfun, Qget_file_char)
  	   || EQ (readcharfun, Qget_emacs_mule_file_char))
***************
*** 505,511 ****
  	  UNBLOCK_INPUT;
  	}
        else
! 	unread_char = c;
      }
    else
      call1 (readcharfun, make_number (c));
--- 518,527 ----
  	  UNBLOCK_INPUT;
  	}
        else
! 	if (unread_char >= 0)
! 	  unread_char1 = c;
! 	else
! 	  unread_char = c;
      }
    else
      call1 (readcharfun, make_number (c));
***************
*** 1658,1663 ****
--- 1674,1680 ----
       Lisp_Object start, end;
  {
    register int c;
+   register int c1;
    register Lisp_Object val;
    int count = SPECPDL_INDEX ();
    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
***************
*** 1747,1752 ****
--- 1764,1782 ----
  	  unbind_to (count1, Qnil);
  	  break;
  	}
+       if (c == '#' && first_sexp)
+ 	{
+ 	  c1 = READCHAR;
+ 	  if (c1 == '!')
+ 	    {
+ 	      /* #! appears at the beginning of an executable file.
+ 		 Skip the first line.  */
+ 	      while ((c1 = READCHAR) != '\n' && c1 != -1);
+ 	      goto read_next;
+ 	    }
+ 	  else
+ 	    UNREAD (c1);
+ 	}
  
        /* Ignore whitespace here, so we can detect eof.  */
        if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r'
***************
*** 2607,2620 ****
  	  load_each_byte = 0;
  	  goto retry;
  	}
-       if (c == '!')
- 	{
- 	  /* #! appears at the beginning of an executable file.
- 	     Skip the first line.  */
- 	  while (c != '\n' && c >= 0)
- 	    c = READCHAR;
- 	  goto retry;
- 	}
        if (c == '$')
  	return Vload_file_name;
        if (c == '\'')
--- 2637,2642 ----




Acknowledgement sent to Markus Rost <rost@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.

Message received at 4616@HIDDEN:


Received: (at 4616) by emacsbugs.donarmstrong.com; 4 Oct 2009 15:06:25 +0000
From rost@HIDDEN Sun Oct  4 08:06:24 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-1.0 required=4.0 tests=AWL,HAS_BUG_NUMBER,
	MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Received: from xen16.math.uni-bielefeld.de (xen16.math.uni-bielefeld.de [129.70.14.14])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n94F6MSK013953
	for <4616@HIDDEN>; Sun, 4 Oct 2009 08:06:24 -0700
Received: from sonic02.math.uni-bielefeld.de (sonic02.math.uni-bielefeld.de [129.70.14.134])
	by xen16.math.uni-bielefeld.de (Postfix) with ESMTP id 4637530072BF;
	Sun,  4 Oct 2009 17:06:17 +0200 (CEST)
Received: by sonic02.math.uni-bielefeld.de (Postfix, from userid 3710)
	id 5367DEFB40; Sun,  4 Oct 2009 17:06:17 +0200 (CEST)
From: Markus Rost <rost@HIDDEN>
To: Andreas Schwab <schwab@HIDDEN>
CC: 4616 <at> debbugs.gnu.org, emacs-pretest-bug@HIDDEN
In-reply-to: <m2k4zbmvao.fsf@HIDDEN> (message from Andreas Schwab on
	Sun, 04 Oct 2009 10:13:03 +0200)
Subject: Re: bug#4616: 23.1.50; empty script files
X-GNU-Emacs-Mailer: GNU Emacs 22.3
X-Home-Page: http://www.math.uni-bielefeld.de/~rost
References: <20091002140131.2998D2865C20@HIDDEN> <m2k4zbmvao.fsf@HIDDEN>
Message-Id: <20091004150617.5367DEFB40@HIDDEN>
Date: Sun,  4 Oct 2009 17:06:17 +0200 (CEST)

> The Emacs Lisp reader always requires at least one sexp in the input.
> This is independent of the source of the input.

Oh yes.  My patch would violate this.  But the Emacs Lisp "loader"
doesn't require any input.

I think, somebody without knowledge of Emacs internals will be
surprised that

===File ~/x.el==============================================
#!/home/rost/build/cvs/emacs/src/emacs --script
;; (some-valid-elisp-expression)
============================================================

yields an "End of file during parsing" error and returns with positive
exit status.

And I think, somebody executing pure elisp will be surprised that

(read "#!\n(foo)")

does not yield an "Invalid read syntax" error.

It seems that the basic read function has a *general* feature in order
to get --script and the "#!"-syntax working.

What about my questions posted here:
<URL:http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-10/msg00055.html>



Acknowledgement sent to Markus Rost <rost@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.

Message received at submit@HIDDEN:


Received: (at submit) by emacsbugs.donarmstrong.com; 4 Oct 2009 15:06:28 +0000
From rost@HIDDEN Sun Oct  4 08:06:27 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-1.4 required=4.0 tests=AWL,HAS_BUG_NUMBER,
	MURPHY_DRUGS_REL8 autolearn=unavailable
	version=3.2.5-bugs.debian.org_2005_01_02
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n94F6QVl013964
	for <submit@HIDDEN>; Sun, 4 Oct 2009 08:06:27 -0700
Received: from mx10.gnu.org ([199.232.76.166]:43891)
	by fencepost.gnu.org with esmtp (Exim 4.67)
	(envelope-from <rost@HIDDEN>)
	id 1MuSfJ-0006Kn-O3
	for emacs-pretest-bug@HIDDEN; Sun, 04 Oct 2009 11:06:25 -0400
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60)
	(envelope-from <rost@HIDDEN>)
	id 1MuSfI-0004gM-1Y
	for emacs-pretest-bug@HIDDEN; Sun, 04 Oct 2009 11:06:25 -0400
Received: from mx20.gnu.org ([199.232.41.8]:30528)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60)
	(envelope-from <rost@HIDDEN>)
	id 1MuSfH-0004fK-HH
	for emacs-pretest-bug@HIDDEN; Sun, 04 Oct 2009 11:06:23 -0400
Received: from xen16.math.uni-bielefeld.de ([129.70.14.14])
	by mx20.gnu.org with esmtp (Exim 4.60)
	(envelope-from <rost@HIDDEN>)
	id 1MuSfF-0001RJ-6w
	for emacs-pretest-bug@HIDDEN; Sun, 04 Oct 2009 11:06:21 -0400
Received: from sonic02.math.uni-bielefeld.de (sonic02.math.uni-bielefeld.de [129.70.14.134])
	by xen16.math.uni-bielefeld.de (Postfix) with ESMTP id 4637530072BF;
	Sun,  4 Oct 2009 17:06:17 +0200 (CEST)
Received: by sonic02.math.uni-bielefeld.de (Postfix, from userid 3710)
	id 5367DEFB40; Sun,  4 Oct 2009 17:06:17 +0200 (CEST)
From: Markus Rost <rost@HIDDEN>
To: Andreas Schwab <schwab@HIDDEN>
CC: 4616 <at> debbugs.gnu.org, emacs-pretest-bug@HIDDEN
In-reply-to: <m2k4zbmvao.fsf@HIDDEN> (message from Andreas Schwab on
	Sun, 04 Oct 2009 10:13:03 +0200)
Subject: Re: bug#4616: 23.1.50; empty script files
X-GNU-Emacs-Mailer: GNU Emacs 22.3
X-Home-Page: http://www.math.uni-bielefeld.de/~rost
References: <20091002140131.2998D2865C20@HIDDEN> <m2k4zbmvao.fsf@HIDDEN>
Message-Id: <20091004150617.5367DEFB40@HIDDEN>
Date: Sun,  4 Oct 2009 17:06:17 +0200 (CEST)
X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6 (newer, 2)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4)
X-CrossAssassin-Score: 2

> The Emacs Lisp reader always requires at least one sexp in the input.
> This is independent of the source of the input.

Oh yes.  My patch would violate this.  But the Emacs Lisp "loader"
doesn't require any input.

I think, somebody without knowledge of Emacs internals will be
surprised that

===File ~/x.el==============================================
#!/home/rost/build/cvs/emacs/src/emacs --script
;; (some-valid-elisp-expression)
============================================================

yields an "End of file during parsing" error and returns with positive
exit status.

And I think, somebody executing pure elisp will be surprised that

(read "#!\n(foo)")

does not yield an "Invalid read syntax" error.

It seems that the basic read function has a *general* feature in order
to get --script and the "#!"-syntax working.

What about my questions posted here:
<URL:http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-10/msg00055.html>



Acknowledgement sent to Markus Rost <rost@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.

Message received at 4616@HIDDEN:


Received: (at 4616) by emacsbugs.donarmstrong.com; 4 Oct 2009 08:12:59 +0000
From whitebox@HIDDEN Sun Oct  4 01:12:59 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-2.8 required=4.0 tests=AWL,HAS_BUG_NUMBER
	autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n948CvrU011314
	for <4616@HIDDEN>; Sun, 4 Oct 2009 01:12:59 -0700
Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149])
	by mail-out.m-online.net (Postfix) with ESMTP id 72BA81C153BE;
	Sun,  4 Oct 2009 10:12:51 +0200 (CEST)
X-Auth-Info: FoZ+QqxDrj4vfJkRliMTvnkTFC/YkYCwmRKlcuWLKKI=
Received: from whitebox.home (DSL01.83.171.152.53.ip-pool.NEFkom.net [83.171.152.53])
	by mail.mnet-online.de (Postfix) with ESMTP id BC2629021C;
	Sun,  4 Oct 2009 10:12:50 +0200 (CEST)
Received: by whitebox.home (Postfix, from userid 501)
	id 5C02D1E536D; Sun,  4 Oct 2009 10:13:03 +0200 (CEST)
From: Andreas Schwab <schwab@HIDDEN>
To: Markus Rost <rost@HIDDEN>
Cc: 4616 <at> debbugs.gnu.org, emacs-pretest-bug@HIDDEN
Subject: Re: bug#4616: 23.1.50; empty script files
References: <20091002140131.2998D2865C20@HIDDEN>
X-Yow: My CODE of ETHICS is vacationing at famed SCHROON LAKE
 in upstate New York!!
Date: Sun, 04 Oct 2009 10:13:03 +0200
In-Reply-To: <20091002140131.2998D2865C20@HIDDEN> (Markus
	Rost's message of "Fri, 2 Oct 2009 16:01:31 +0200 (CEST)")
Message-ID: <m2k4zbmvao.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

Markus Rost <rost@HIDDEN> writes:

> Execute an Emacs script file with no actual lisp code in it, like this:
>
> ===File ~/x.el==============================================
> #!/home/rost/build/cvs/emacs/src/emacs --script
>
> ============================================================
>
> One gets an error:
>
> End of file during parsing: /home/rost/x.el
>
> Same problem if the file has some additional ";"-commented lines in it.

The Emacs Lisp reader always requires at least one sexp in the input.
This is independent of the source of the input.

Andreas.

-- 
Andreas Schwab, schwab@HIDDEN
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Acknowledgement sent to Andreas Schwab <schwab@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.

Message received at submit@HIDDEN:


Received: (at submit) by emacsbugs.donarmstrong.com; 4 Oct 2009 08:12:59 +0000
From whitebox@HIDDEN Sun Oct  4 01:12:59 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-2.8 required=4.0 tests=AWL,HAS_BUG_NUMBER
	autolearn=unavailable version=3.2.5-bugs.debian.org_2005_01_02
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n948CvfY011319
	for <submit@HIDDEN>; Sun, 4 Oct 2009 01:12:59 -0700
Received: from mail.gnu.org ([199.232.76.166]:58163 helo=mx10.gnu.org)
	by fencepost.gnu.org with esmtp (Exim 4.67)
	(envelope-from <whitebox@HIDDEN>)
	id 1MuMDA-0001xT-V5
	for emacs-pretest-bug@HIDDEN; Sun, 04 Oct 2009 04:12:57 -0400
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60)
	(envelope-from <whitebox@HIDDEN>)
	id 1MuMD8-0007Fl-Sx
	for emacs-pretest-bug@HIDDEN; Sun, 04 Oct 2009 04:12:56 -0400
Received: from mail-out.m-online.net ([212.18.0.9]:57627)
	by monty-python.gnu.org with esmtp (Exim 4.60)
	(envelope-from <whitebox@HIDDEN>)
	id 1MuMD8-0007FT-IW
	for emacs-pretest-bug@HIDDEN; Sun, 04 Oct 2009 04:12:54 -0400
Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149])
	by mail-out.m-online.net (Postfix) with ESMTP id 72BA81C153BE;
	Sun,  4 Oct 2009 10:12:51 +0200 (CEST)
X-Auth-Info: FoZ+QqxDrj4vfJkRliMTvnkTFC/YkYCwmRKlcuWLKKI=
Received: from whitebox.home (DSL01.83.171.152.53.ip-pool.NEFkom.net [83.171.152.53])
	by mail.mnet-online.de (Postfix) with ESMTP id BC2629021C;
	Sun,  4 Oct 2009 10:12:50 +0200 (CEST)
Received: by whitebox.home (Postfix, from userid 501)
	id 5C02D1E536D; Sun,  4 Oct 2009 10:13:03 +0200 (CEST)
From: Andreas Schwab <schwab@HIDDEN>
To: Markus Rost <rost@HIDDEN>
Cc: 4616 <at> debbugs.gnu.org, emacs-pretest-bug@HIDDEN
Subject: Re: bug#4616: 23.1.50; empty script files
References: <20091002140131.2998D2865C20@HIDDEN>
X-Yow: My CODE of ETHICS is vacationing at famed SCHROON LAKE
 in upstate New York!!
Date: Sun, 04 Oct 2009 10:13:03 +0200
In-Reply-To: <20091002140131.2998D2865C20@HIDDEN> (Markus
	Rost's message of "Fri, 2 Oct 2009 16:01:31 +0200 (CEST)")
Message-ID: <m2k4zbmvao.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4)
X-CrossAssassin-Score: 2

Markus Rost <rost@HIDDEN> writes:

> Execute an Emacs script file with no actual lisp code in it, like this:
>
> ===File ~/x.el==============================================
> #!/home/rost/build/cvs/emacs/src/emacs --script
>
> ============================================================
>
> One gets an error:
>
> End of file during parsing: /home/rost/x.el
>
> Same problem if the file has some additional ";"-commented lines in it.

The Emacs Lisp reader always requires at least one sexp in the input.
This is independent of the source of the input.

Andreas.

-- 
Andreas Schwab, schwab@HIDDEN
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Acknowledgement sent to Andreas Schwab <schwab@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.

Message received at 4616@HIDDEN:


Received: (at 4616) by emacsbugs.donarmstrong.com; 3 Oct 2009 16:11:55 +0000
From rost@HIDDEN Sat Oct  3 09:11:54 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=0.3 required=4.0 tests=AWL autolearn=ham
	version=3.2.5-bugs.debian.org_2005_01_02
Received: from mail2.math.uni-bielefeld.de (mail2.math.uni-bielefeld.de [129.70.14.10])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n93GBqD2016365
	for <4616@HIDDEN>; Sat, 3 Oct 2009 09:11:54 -0700
Received: from xen12.math.uni-bielefeld.de (xen12.math.uni-bielefeld.de [129.70.14.133])
	by mail2.math.uni-bielefeld.de (Postfix) with ESMTP id 2920173020;
	Sat,  3 Oct 2009 18:11:47 +0200 (CEST)
Received: by xen12.math.uni-bielefeld.de (Postfix, from userid 3710)
	id 22632288A0AB; Sat,  3 Oct 2009 18:11:47 +0200 (CEST)
From: Markus Rost <rost@HIDDEN>
To: 4616 <at> debbugs.gnu.org
Subject: Follow-up: handling #!
X-GNU-Emacs-Mailer: GNU Emacs 22.3
X-Home-Page: http://www.math.uni-bielefeld.de/~rost
Message-Id: <20091003161147.22632288A0AB@HIDDEN>
Date: Sat,  3 Oct 2009 18:11:47 +0200 (CEST)

It appears that read1 in lread.c handles "#!" like a comment line
starting with ";".

Well, except if the "#!"-line is at the *end* of the buffer, then
eval-buffer or eval-region will yield an "End of file during parsing"
error, similarly as reported in the previous mail.

Besides this bug, is it intended to have "#!" as additional comment
syntax?

I would expect a special handling of "#!" only with --script (cf.
-scriptload in startup.el) and only if it appears at the beginning of
a file.

Normally eval-region should not handle "#!" specially, I guess.



Acknowledgement sent to Markus Rost <rost@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.
Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm@HIDDEN> to control@HIDDEN. Full text available.

Message received at submit@HIDDEN:


Received: (at submit) by emacsbugs.donarmstrong.com; 2 Oct 2009 14:01:40 +0000
From rost@HIDDEN Fri Oct  2 07:01:40 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=0.1 required=4.0 tests=FOURLA,MURPHY_DRUGS_REL8
	autolearn=no version=3.2.5-bugs.debian.org_2005_01_02
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n92E1bgV028846
	for <submit@HIDDEN>; Fri, 2 Oct 2009 07:01:40 -0700
Received: from mail.gnu.org ([199.232.76.166]:37571 helo=mx10.gnu.org)
	by fencepost.gnu.org with esmtp (Exim 4.67)
	(envelope-from <rost@HIDDEN>)
	id 1MtihV-00077O-7Q
	for emacs-pretest-bug@HIDDEN; Fri, 02 Oct 2009 10:01:37 -0400
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60)
	(envelope-from <rost@HIDDEN>)
	id 1MtihS-0002bT-Nr
	for emacs-pretest-bug@HIDDEN; Fri, 02 Oct 2009 10:01:36 -0400
Received: from mail1.math.uni-bielefeld.de ([129.70.14.32]:57792)
	by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60)
	(envelope-from <rost@HIDDEN>)
	id 1MtihS-0002bB-DJ
	for emacs-pretest-bug@HIDDEN; Fri, 02 Oct 2009 10:01:34 -0400
Received: from xen12.math.uni-bielefeld.de (xen12.math.uni-bielefeld.de [129.70.14.133])
	by mail1.math.uni-bielefeld.de (Postfix) with ESMTP id 46D0895A95;
	Fri,  2 Oct 2009 16:01:31 +0200 (CEST)
Received: by xen12.math.uni-bielefeld.de (Postfix, from userid 3710)
	id 2998D2865C20; Fri,  2 Oct 2009 16:01:31 +0200 (CEST)
To: emacs-pretest-bug@HIDDEN
Subject: 23.1.50; empty script files
From: Markus Rost <rost@HIDDEN>
Message-Id: <20091002140131.2998D2865C20@HIDDEN>
Date: Fri,  2 Oct 2009 16:01:31 +0200 (CEST)
X-detected-operating-system: by monty-python.gnu.org: FreeBSD 5.3-5.4


Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the emacs-pretest-bug@HIDDEN mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:


Execute an Emacs script file with no actual lisp code in it, like this:

===File ~/x.el==============================================
#!/home/rost/build/cvs/emacs/src/emacs --script

============================================================

One gets an error:

End of file during parsing: /home/rost/x.el

Same problem if the file has some additional ";"-commented lines in it.
No problem if there is a single not commented lisp expression in it,
like "()".

This patch fixes the problem for me:

*** lread.c	02 Oct 2009 14:05:54 +0200	1.414
--- lread.c	02 Oct 2009 14:11:36 +0200	
***************
*** 2613,2619 ****
  	     Skip the first line.  */
  	  while (c != '\n' && c >= 0)
  	    c = READCHAR;
! 	  goto retry;
  	}
        if (c == '$')
  	return Vload_file_name;
--- 2613,2619 ----
  	     Skip the first line.  */
  	  while (c != '\n' && c >= 0)
  	    c = READCHAR;
! 	  return Qnil;
  	}
        if (c == '$')
  	return Vload_file_name;


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/home/rost/build/cvs/emacs/etc/DEBUG for instructions.


In GNU Emacs 23.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.16.1)
 of 2009-10-02 on laptop
Windowing system distributor `The X.Org Foundation', version 11.0.10600000
configured using `configure  '--prefix=/home/rost/local/cvs''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-1> M-x r e p SPC o r SPC e m SPC SPC SPC <r
eturn>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...

Load-path shadows:
None found.



Acknowledgement sent to Markus Rost <rost@HIDDEN>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Report forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4616; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.