Subject: bug#4616: 23.1.50; empty script files

From: Markus Rost <[email-masked]>
Date: Fri, 2 Oct 2009 16:01:31 +0200 (CEST)

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 [email-masked] 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.