Article View: gnu.emacs.bug
Article #98340open-dribble-file never closes a dribble file.
From: Per Cederqvist
Date: Sun, 18 Aug 1991 23:38
Date: Sun, 18 Aug 1991 23:38
60 lines
2523 bytes
2523 bytes
GNU Emacs 18.57.4 of Sun Jun 9 1991 on ruben (berkeley-unix)
Emacs never closes the file that is created with open-dribble-file. If
you call open-dribble-file too many times all file descriptors are
used up and no file operations work. The info file clearly states that
it is possible to close a dribble file:
> * Command: open-dribble-file FILENAME
>
> This function opens a "dribble file" named FILENAME. When a
> dribble file is open, Emacs copies all keyboard input characters
> to that file. (The contents of keyboard macros are not typed on
> the keyboard so they are not copied to the dribble file.)
>
> You close the dribble file by calling this function with an
> argument of `""'. The function always returns `nil'.
Reading the code, in keyboard.c, it is obvious that the file is never
closed:
>DEFUN ("open-dribble-file", Fopen_dribble_file, Sopen_dribble_file, 1, 1,
> "FOpen dribble file: ",
> "Start writing all keyboard characters to FILE.")
> (file)
> Lisp_Object file;
>{
> file = Fexpand_file_name (file, Qnil);
> dribble = fopen (XSTRING (file)->data, "w");
> return Qnil;
>}
It should be changed to something like this (untested code)
{
file = Fexpand_file_name (file, Qnil);
if (dribble)
fclose (dribble);
if (*XSTRING (file)->data != '\0') /* Don't try to open a file named "" */
{
dribble = fopen (XSTRING (file)->data, "w");
if (!dribble)
{
/* signal an error(); */
}
}
else
dribble = 0;
return Qnil;
}
By the way, open-termscript seems to work ok, but the info file does
not mention that (open-termscript nil) closes the termscript. The
online documentation mentions it.
---
Per Cederqvist, Lysator Computer Club, University of Linkoping, Sweden
Email: ceder@lysator.liu.se
Phone: +46 13 26 09 17 "CVS - Check It Out!"
Technical Details
Message-ID:
<9108181938.AA25813@robert.lysator.liu.se>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cis.ohio-state.edu!lysator.liu.se!cederShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,e77340b51e8c69d3,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1991-08-18 23:29:32 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cis.ohio-state.edu!lysator.liu.se!ceder From: ceder@lysator.liu.se (Per Cederqvist) Newsgroups: gnu.emacs.bug Subject: open-dribble-file never closes a dribble file. Message-ID: <9108181938.AA25813@robert.lysator.liu.se> Date: 18 Aug 91 23:38:42 GMT Sender: gnulists@ai.mit.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 60 Approved: bug-gnu-emacs@prep.ai.mit.edu