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: Sun, 5 May 2002 13:14:26 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.33.0205051300520.1557-300000@salmon.pepperfish.net> (raw)
In-Reply-To: <200205050534.g455Ybb01625@aztec.santafe.edu>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1406 bytes --]

On Sat, 4 May 2002, Richard Stallman wrote:

> I don't really know how to use fifos, so I can't make a test case.
> Can you send a specific test case with which to observe this problem?

The attached perl script, when run, will create a fifo called .sig-dyn,
daemonise, and sit attached to it, emitting a signature each time
.sig-dyn is read from. If ~/sigd/sigfile (I do means "sigd", it's not a
typo) is not present, then it uses fortune(6) as a source.

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.

There is a (possibly architecturally bad) patch on savannah.gnu.org
that restores the old GNU emacs 20 behaviour specifically for fifos,
while leaving all other file types to the new code. The patch is
against the version of GNU emacs 21.1 (21.1-7) shipped with Debian
GNU/Linux (woody) a while ago now - woody ships with 21.2-1 now.

If there are any problems with getting the sigerator working, let me know.
( It should be pretty straightforward, I usually run it from my home
  directory, but it should be Ok anywhere it has write permission ).


[-- Attachment #2: Type: TEXT/PLAIN, Size: 1254 bytes --]

#!/usr/bin/perl

use Fcntl;
use strict;
use vars qw(@sig $sig $lidx);

my $FIFO = '.sig-dyn';
#$SIG{PIPE} = sub { warn("Broken pipe: $!\n") };
$SIG{PIPE} = 'IGNORE';
$SIG{HUP} = \&readsigs;
$SIG{TERM} = sub { exit(0) };

sub readsigs ()
{
    chdir;
    if(sysopen(SIGS, join('/',$ENV{HOME}, qw(sigd sigfile)), O_RDONLY, undef))
    {
	$/ = "--\n";
	chomp(@sig = <SIGS>);
	close(SIGS);
	$sig =
	  sub
	  {
	      my $idx;
	      for($idx = $lidx; $idx == $lidx; $idx = int(rand(@sig))) {}
	      join('', "-- \n", $sig[$lidx = $idx]);
	  };
    }
    else { $sig = sub { "-- \n".`fortune -s` } }

    unless(-p $FIFO)
    {
	rename($FIFO, "$FIFO~");	
	system(mkfifo => $FIFO)
	  && system(mknod => $FIFO, 'p')
	    && die("mk{nod|fifo} failed: $!\n");
    }
}

readsigs();

fork() && exit(0);

SIGLOOP:
{
    my $wi = '';
    my $wo = '';

    while (-p $FIFO)
    {
	my $s = $sig->();
	my $l = length($s);
	sysopen(FIFO, $FIFO, O_WRONLY|O_SYNC, undef)
          || die("sysopen(FH, $FIFO, O_WRONLY|O_SYNC, undef) failed: $!\n");
        syswrite(FIFO, $s, $l, 0);
        close(FIFO);
        select(undef(), undef(), undef(), 0.5);
    }
}

warn("$FIFO is not a pipe: exiting\n");
exit(0);

[-- Attachment #3: Type: TEXT/PLAIN, Size: 6378 bytes --]

fsck -f -b 8193 /dev/cortex
--
Come, Goratrix, we must return to the chantry to prepare for tomorrow night!
What are we gonna do tomorrow night, Tremere?
The same thing we do every night, Goratrix: Try to Take Over The World!
--
No good deed goes unpunished.
--
Death before decaf.
--
If voting could change things, it would be illegal.
--
Just one nuclear family can ruin your whole life.
--
Sysadmin (n): The untrained being underpaid for doing the impossible with
the obsolete
--
I dunno about the Big Bang. The Big Kludge I can believe in.
--
You are in a maze of twisty X resources, all like.
--
If we all work together, we can totally disrupt the system.
--
I'm just a simple-minded vice-president in charge of operations...
--
"He was too young to be taken from us."
             'You were the one who cut him in half with a chainsaw, dude.'
--
Nobody wants constructive criticism.  It's all we can do to put up with
constructive praise.
--
"whip me, beat me, make me administer aix!" -andrew
--
"I don't suffer from insanity, I enjoy every moment of it" - Anon
--
It is easier to get forgiveness than permission.
--
He's been shot through the chest with an arrow.
What about his horse?
I don't think anyone's shot him with that.
--
"Always try to do things in chronological order; it's less confusing
that way."
--
"They're unfriendly, which is fortunate, really.  They'd be difficult
to like."
                -- Avon
--
"Outside of a dog, a book is a man's best friend: and inside a dog,
it's too dark to read."
                -- Groucho Marx
--
Reader, suppose you were an idiot.  And suppose you were a member of
Congress.  But I repeat myself.
                -- Mark Twain
--
My mother loved children - she would have given anything if I had been one.
                -- Groucho Marx
--
I've had a perfectly wonderful evening.  But this wasn't it.
                -- Groucho Marx
--
"Am I missing something else? The same configuration is working fine elsewhere
(albeit with a different OS, computer and network)..."
                                             -- seen on a mailing list
--
When someone says "I want a programming language in which I need only
say what I wish done," give him a lollipop.
--
"I like work ... I can sit and watch it for hours."
--
By doing just a little every day, you can gradually let the task
completely overwhelm you.
--
Everyone would _like_ a first. By the time you get to the third year,
you become more fatalistic, until you get to the point when a kippered
herring with a Warwick crest on it would be as welcome as a degree.
                                                    - Stephen Williams
--
"I don't want to go to the movies to be horrified and depressed."
"No, I suppose you've got real life to do that."
--
It is by caffeine alone I set my mind in motion,
It is by the beans of Java that thoughts acquire speed,
The hands acquire a shaking, the shaking becomes a warning,
It is by caffeine alone I set my mind in motion
--
You go insane if you go without sleep for too long.
And not in a good way, either.
--
Sleep, where is thy sting, 
Bed, where is thy victory...
                   -- Insomnia? Me?
--
Manual? We've just been pushing buttons til it works...
--
There's an old proverb that says just about whatever you want it to.
--
Putt knot yore trussed inn spell chequers
--
What's the plural of mongoose? Mongooses? Mongeese? Polygoose?
--
I am worthless. I struggle with the simple things. It seems so easy for 
everyone else. One armed blind people climb mountains and teenagers get
Ph.D's. I have trouble getting out of bed.
                                          -TMCM
--
That which doesn't kill you will make you bitter and cynical.
                                                            -TMEG
--
"Aren't you ashamed of yourself?"
"No, I have people to do that for me."
--
Stupid, _stupid_ rat creatures...
--
Lusers. Can't live with 'em, can't run 'em over in the car park and make
it look like an accident...
--
The time you enjoy wasting is not wasted time. 
                                           -- Bertrand Russell
--
"It is two days later and I am still at the office. I did not go and chase
coots. There is too much work to do. I want to die." 
                                                    -- Jamie Zawinski
--
Q: Why did the tachyon cross the road? 
A: Because it was on the other side. 
--
To err is human, To purr feline. -- Robert Byrne
--
To err is human, To moo bovine.
--
I think my memory is implemented as a dissociative array...
--
"A distributed system is one in which I cannot get something done
because a machine I've never heard of is down"   
                                                --Leslie Lamport
--
"As you point out, EFAULT situations are `undefined' which means the
machine is entitled to grow wings an launch itself towards the sun..."
 -- Chris Wedgwood on the linux-kernel mailing list
--
"... I've seen Sun monitors on fire off the side of the multimedia lab.
I've seen NTU lights glitter in the dark near the Mail Gate.  All these
things will be lost in time, like the root partition last week.  Time
to die..." - Peter Gutmann - a.s.r
--
I'm an apatheist. The question is no longer interesting, 
and the answer no longer matters. - petro - a.s.r
--
In German "invent-a-new-word-where-a-perfectly-good-one-already-exists" 
is probably a word. - Peter da Silva - a.s.r
--
I must be sad when I have cause, and smile at no  man's jests; 
eat when I have stomach, and wait for no man's leisure; 
sleep when I am drowsy, and tend on no man's business; 
laugh when I am merry, and claw no man in his humour.
--
What they don't know can't hurt them.
That's not really true of Air Traffic Control, now, is it?
--
        "Do you think there's a God?"
        "Well, SOMEbody's out to get me!"
                -- Calvin and Hobbs
--
Either I'm dead or my watch has stopped.
                -- Groucho Marx's last words
--
The time for action is past!  Now is the time for senseless bickering.
--
I understand your language perfectly.
Je parle français comme une vache espagnole.
Hablo español como un gringo borracho.
Ich sprechen deutsch wie italienisch Fussballtrainer.


  reply	other threads:[~2002-05-05 12:14 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 [this message]
2002-05-06  6:24     ` Richard Stallman
2002-05-06 15:26       ` Vivek
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.0205051300520.1557-300000@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.