all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vivek <vivek@etla.org>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: insert-file-contents and fifos
Date: Mon, 6 May 2002 16:26:35 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.33.0205061613110.10872-100000@salmon.pepperfish.net> (raw)
In-Reply-To: <200205060624.g466OTZ01973@aztec.santafe.edu>

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	other threads:[~2002-05-06 15:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-01 14:15 insert-file-contents and fifos Vivek Dasmohapatra
2002-05-05  5:34 ` Richard Stallman
2002-05-05 12:14   ` Vivek
2002-05-06  6:24     ` Richard Stallman
2002-05-06 15:26       ` Vivek [this message]
2002-05-07  4:58         ` Richard Stallman
2002-05-07 16:51           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33.0205061613110.10872-100000@salmon.pepperfish.net \
    --to=vivek@etla.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.