emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: insert-file-contents and fifos


From: Vivek
Subject: Re: insert-file-contents and fifos
Date: Mon, 6 May 2002 16:26:35 +0100 (BST)

On Mon, 6 May 2002, Richard Stallman wrote:

>     GNU emacs 20 was capable of reading from this, 21 is not. The change
>     appears to be the introduction of the new read_non_regular function
>     in fileio.c : a strace shows emacs fetching the data from the file
>     ( you can see the data being read ), and then aborting. Presumably
>     the state of a fifo is sufficiently different from a non-regular file
>     that read_non_regular reacts as if an error has occurred.
>
> Could you step through it and see why this happens?
> The code looks straightforward, so I don't see why it would fail.

Maybe I'm being dense, or just don't understand what the code is meant to
do, but:

`read_non_regular' _always_ calls

  Fsignal (Qquit, Qnil);

just after `emacs_read' (which succeeds, afaict)

and the call to `read_non_regular' in `insert-file-contents' is wrapped
in an `internal_condition_case_1' call: so is it _ever_ possible for
a read of a non regular file to succeed, since:

val = internal_condition_case_1 ( read_non_regular, Qnil, Qerror,
                                  read_non_regular_quit );

if (NILP (val))
  {
    read_quit = 1;
    break;
  }

So, according to my (albeit limited) understanding, we're calling
internal_condition_case_1, which calls read_non_regular, which
will _always_ signal '(quit . nil), which will therefore always
result in a 'nil return from internal_condition_case_1 : can
insert-file-contents read any non regular files at all? I tried
with both ~/.sig-dyn and /dev/fd0 and both resulted in the same
behaviour: a successful read(2) of the available data (or the first
65536 bytes in thcase of /dev/fd0) followed by a bailout.

I'm confused... for the record, here's the read_non_regular that I have:

static Lisp_Object
read_non_regular ()
{
  int nbytes;

  immediate_quit = 1;
  QUIT;

  nbytes = emacs_read (non_regular_fd,
                       BEG_ADDR + PT_BYTE - 1 + non_regular_inserted,
                       non_regular_nbytes);

  Fsignal (Qquit, Qnil);
  immediate_quit = 0;

  return make_number (nbytes);
}






reply via email to

[Prev in Thread] Current Thread [Next in Thread]