unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: 22096@debbugs.gnu.org
Subject: bug#22096: 25.0.50; reading from fifo breaks display
Date: Sat, 05 Dec 2015 10:58:38 -0500	[thread overview]
Message-ID: <87oae4opjl.fsf@udel.edu> (raw)
In-Reply-To: <83oae5fgtn.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 05 Dec 2015 10:19:32 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Mark Oteiza <mvoteiza@udel.edu>
>> Date: Fri, 04 Dec 2015 12:40:38 -0500
>>
>> I suppose this is two issues, really. I am trying to read from a FIFO,
>> specifically one written to by mpd, configured in mpd.conf with
>>
>> audio_output {
>>   type "fifo"
>>   name "FIFO"
>>   path "/tmp/mpd.fifo"
>>   format "44100:16:2"
>> }
>>
>> With mpd running I can see that the FIFO is there and I can read from it
>> with other tools/mpd clients.
>>
>> (info "(elisp) Reading from Files") suggests I should be able to read
>> from a FIFO.
>
> I guess you mean this part:
>
>      It is possible to read a special file (such as a FIFO or an I/O
>      device) with `insert-file-contents', as long as REPLACE and VISIT
>      are `nil'.
>
> It seems this is no longer true, and we have to fix the manual to that
> effect.  I hope Paul (CC'ed) will be able to take a look.

Well, darn.

>> From emacs -Q, insert the following into the scratch buffer:
>>
>> (insert-file-contents "/tmp/mpd.fifo" nil 0 10 nil)
>>
>> First issue: evaluating this yields
>>
>> (file-error "not a regular file" "/tmp/mpd.fifo")
>>
>> Second issue: changing the VISIT argument to t and evaluating:
>>
>> (insert-file-contents "/tmp/mpd.fifo" t 0 10 nil)
>>
>> breaks the display engine. "nil)" becomes invisible, the last "r" in the
>> scratch buffer message becomes fontified as a matching paren, and
>> hitting C-a at the end of the form takes me to the aforementioned "r".
>> I have attached an image.
>
> Can you tell what were the 10 bytes inserted by the above?  Then it
> should be possible to reproduce the display issue without having
> access to your system.

No. I can't tell that anything from the fifo is ever inserted. Sometimes
it seems the multibyte flag of the buffer gets flipped off. Sometimes I
actually get the "not a regular file" error. What consistently seems to
happen is "nil)" is deleted.

If I do insert-file-contents{,-literally} with just FILENAME and no
other arguments, it appears to read the fifo just fine, just that I have
to C-g to make it stop, of course. The buffer will be stuffed with
binary data, but nothing breaks as far as I can tell.

> Anyway, you are reading a binary byte stream from an audio daemon, so
> I think you cannot expect it to be displayed in any human-readable
> way, let alone hope that the major mode in effect in *scratch will be
> able to fontify it in some reasonable way.  You should use
> insert-file-contents-literally instead, I think.  (And I very much
> doubt that "visiting" a non-regular file makes sense, but maybe I'm
> missing something.)

Right, I didn't expect VISIT=t to make sense, but the resulting breakage
is unexpected.





  parent reply	other threads:[~2015-12-05 15:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 17:40 bug#22096: 25.0.50; reading from fifo breaks display Mark Oteiza
2015-12-05  8:19 ` Eli Zaretskii
2015-12-05  8:59   ` Eli Zaretskii
2015-12-05 16:06     ` Mark Oteiza
2015-12-05 16:49       ` Eli Zaretskii
2015-12-05 15:58   ` Mark Oteiza [this message]
2015-12-05 16:45     ` Eli Zaretskii
2015-12-05 17:09       ` Mark Oteiza
2015-12-05 17:18         ` Eli Zaretskii
2015-12-05 17:35           ` Mark Oteiza
2015-12-05 18:29 ` Mark Oteiza
2015-12-05 19:38   ` Eli Zaretskii
2015-12-05 20:58     ` Mark Oteiza
2020-08-31  2:11       ` Stefan Kangas

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87oae4opjl.fsf@udel.edu \
    --to=mvoteiza@udel.edu \
    --cc=22096@debbugs.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).