All of lore.kernel.org
 help / color / mirror / Atom feed
From: John M Collins <jmc@xisl.com>
To: ML-linux-kernel <linux-kernel@vger.kernel.org>
Cc: William Stearns <wstearns@pobox.com>
Subject: Re: Program-invoking Symbolic Links?
Date: Thu, 5 Aug 2004 16:08:39 +0100	[thread overview]
Message-ID: <200408051608.39183.jmc@xisl.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0408051027090.3293@sparrow>

Please CC to jmc @ xisl.com

On Thursday 05 Aug 2004 15:34, William Stearns wrote:
> Good morning, John,
> 	(My apologies for floating offtopic for kernel programming.  I
> wanted to provide a quick example for John and others interested in doing
> this so they could see this can be done outside of the kernel.)
>
> On Thu, 5 Aug 2004, John M Collins wrote:
> > (Please CC any reply to jmc AT xisl.com as I'm not subbed - thanks).
> >
> > I wondered if anyone had ever thought of implementing an alternative form
> > of symbolic link which was in fact an invocation of a program?
> >
> > Such a symbolic link would "do all the necessary" to fork off a new
> > process running the specified program with input or output from or to a
> > pipe depending on whether the link was opened for writing or reading
> > respectively. RW access would probably have to be banned and the link
> > would usually be read-only or write-only.
> >
> > What I originally wanted was symbolic links (with "=>" as a possible
> > notation).
> >
> > latest_version.tar => "tar cf - /latest/and/greatest"
> > latest_version.tgz => "gzip -c latest_version"
> >
> > and the like, which I could link on a website so I didn't have to run
> > around updating tar files/zip files/gzipped tar files etc each time I fix
> > a bug in some package.
>
> 	Is there any reason this couldn't be done in userspace by using
> named pipes instead of a new form of symlink?
>
> #!/bin/bash
>
> if [ ! -e livepipe ]; then
> 	echo Making livepipe >&2
> 	mkfifo livepipe
> fi
>
> while : ; do
> 	echo -n . >&2
> 	( date ) >livepipe
> 	sleep 1
> done

That wouldn't do what I want. Besides which, I've tried it on Apache and it 
doesn't work. Apache isn't fooled by fifos called something.html Nor are most 
browsers either.

1. The "other end" of the named pipe would be run under the identity of 
whoever kicked off that daemon process not the user who wanted to access it.

2. The environment etc would be that which the "other end" was kicked off 
with, not what you might want it to be when the thing is accessed. In your 
example the stuff up to the "(date) >livepipe" will all get run, and then 
things will get suspended until there is a reader for "livepipe" by which 
time all the work you've done up to that point might be invalidated.

3. There would be no way of getting at the invoking environment, supposing for 
example you wanted to give a different response to different users?

4. In the example I quoted where you want to have a "give me a tarball of the 
latest version of package X" link you'd have to have one continually-running 
process to serve package X, one for package Y, one for package Z and so 
forth.

-- 
John Collins Xi Software Ltd www.xisl.com

  reply	other threads:[~2004-08-05 15:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 14:04 Program-invoking Symbolic Links? John M Collins
2004-08-05 14:34 ` William Stearns
2004-08-05 15:08   ` John M Collins [this message]
2004-08-05 16:45 ` viro
2004-08-05 17:34   ` Måns Rullgård
2004-08-05 17:57     ` viro
2004-08-05 18:30       ` Måns Rullgård
2004-08-07 12:26       ` V13
2004-08-05 18:02 ` Rik van Riel
2004-08-07 16:17 ` Eric Lammerts
2004-08-12 21:02   ` Pavel Machek

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=200408051608.39183.jmc@xisl.com \
    --to=jmc@xisl.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wstearns@pobox.com \
    /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.
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.