9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] string to list?
@ 2001-06-11  1:45 presotto
  0 siblings, 0 replies; 19+ messages in thread
From: presotto @ 2001-06-11  1:45 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

Turning off the ability to use pipes and the environment means you
pretty much can't run any programs.  Turning of the ability to
open /dev/fd doesn't really save anything since you can always
dup.

The only ones that are really a problem are devproc and devcons.  They
are used for access to notes and to console i/o.  They were left
on since devcons protects itself, only the host owner can do anything
important, and devproc needs to be linked in anyways so that stuff
like notes works.  Access to devproc needs to be rethought.  I'm not sure the
right semantics though.

[-- Attachment #2: Type: message/rfc822, Size: 1528 bytes --]

From: Scott Schwartz <schwartz@bio.cse.psu.edu>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] string to list?
Date: Sun, 10 Jun 2001 19:35:27 -0400
Message-ID: <20010610233528.26933.qmail@g.bio.cse.psu.edu>

| You can turn off access to all '#' devices except #{|decp}.  Look
| at RFNOMNT on rfork.  I believe 'rfork m' in rc does an rfork(RFNOMNT).

The manpage doesn't mention those exceptions.  Why can't you turn off
access to them too?  

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-11 10:18 ` Laura Creighton
@ 2001-06-11 10:38   ` Matt
  0 siblings, 0 replies; 19+ messages in thread
From: Matt @ 2001-06-11 10:38 UTC (permalink / raw)
  To: 9fans

I'm the python guy in my office of perlies.

but at the moment the RC shell is where it's at for me

I think it would be nice if there were a plan9 specific python a like or
some sort of higher level scripting language.
The shell seems almost complete enough for now. I want to try and stick to
the 'loads of little utilities & file servers' model rather than general
purpose applications.

While I'm wishing though when I first came to plan9 of course I wanted to
bring my python hammer with me. Implementing a file server in a scripting
language sounds groovy. In the end though I'm glad it wasn't there because
it's making me learn the OS rather then live in python. Hopefully I'll
eventually know enough about it to either add the functionality to python
myself or simply not care.

M



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 22:36 Jonathan Sergent
  2001-06-11  0:15 ` Matt
@ 2001-06-11 10:18 ` Laura Creighton
  2001-06-11 10:38   ` Matt
  1 sibling, 1 reply; 19+ messages in thread
From: Laura Creighton @ 2001-06-11 10:18 UTC (permalink / raw)
  To: 9fans; +Cc: lac

Python has a restricted eval that runs in a restricted environment.  You
can still mount a denial of service attack through that eval as far as
I know however.  Go ask in comp.lang.python where you can also get a
python tutor if you wish.

Laura
.


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 22:36 Jonathan Sergent
@ 2001-06-11  0:15 ` Matt
  2001-06-11 10:18 ` Laura Creighton
  1 sibling, 0 replies; 19+ messages in thread
From: Matt @ 2001-06-11  0:15 UTC (permalink / raw)
  To: 9fans


----- Original Message ----- 
From: "Jonathan Sergent" <sergent@IO.COM>

> What's wrong with words=(`{echo $line}) and then switch($words(1))?

that is the answer I was looking for originally, thanks



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 23:22 presotto
@ 2001-06-10 23:35 ` Scott Schwartz
  0 siblings, 0 replies; 19+ messages in thread
From: Scott Schwartz @ 2001-06-10 23:35 UTC (permalink / raw)
  To: 9fans

| You can turn off access to all '#' devices except #{|decp}.  Look
| at RFNOMNT on rfork.  I believe 'rfork m' in rc does an rfork(RFNOMNT).

The manpage doesn't mention those exceptions.  Why can't you turn off
access to them too?  



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
@ 2001-06-10 23:22 presotto
  2001-06-10 23:35 ` Scott Schwartz
  0 siblings, 1 reply; 19+ messages in thread
From: presotto @ 2001-06-10 23:22 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 140 bytes --]

You can turn off access to all '#' devices except #{|decp}.  Look
at RFNOMNT on rfork.  I believe 'rfork m' in rc does an rfork(RFNOMNT).

[-- Attachment #2: Type: message/rfc822, Size: 3991 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 172 bytes --]

Doesn't the availability of '#s' (i.e.  '#s'/boot) break this (unless
you are in group noworld)?

What's wrong with words=(`{echo $line}) and then switch($words(1))?


[-- Attachment #2.1.2: Type: message/rfc822, Size: 2337 bytes --]

From: "Matt" <matt@proweb.co.uk>
To: <9fans@cse.psu.edu>
Subject: Re: [9fans] string to list?
Date: Sun, 10 Jun 2001 22:48:51 +0100
Message-ID: <002501c0f1f7$235fa220$6401a8c0@freeze2k>


----- Original Message -----
From: "Scott Schwartz" <schwartz@bio.cse.psu.edu>


> | I plan to have it do eval `{$msg} and do whatever it's
> | namespace will let it.
>
> I really wouldn't do that.  It's just too unpredictable and dangerous.
> eval considered harmful.

being as I've not implemented it my understanding is weak but I thought that
I could dictate the namespace that a process sees. If the total namespace
the ircbot process sees is

/
/bin/opme
/bin/cat
/bin/ls
/bin/eval
/bin/echo
/slashdotheadlines

then all ircbot can do is  combinations like
echo eval 'ls /bin'
echo eval 'opme'
echo eval 'cat /slashdotheadlines'

but because it can't bind new files in or import them it can't manipulate
it's namespace via the eval







^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
@ 2001-06-10 22:36 Jonathan Sergent
  2001-06-11  0:15 ` Matt
  2001-06-11 10:18 ` Laura Creighton
  0 siblings, 2 replies; 19+ messages in thread
From: Jonathan Sergent @ 2001-06-10 22:36 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 172 bytes --]

Doesn't the availability of '#s' (i.e.  '#s'/boot) break this (unless
you are in group noworld)?

What's wrong with words=(`{echo $line}) and then switch($words(1))?


[-- Attachment #2: Type: message/rfc822, Size: 2337 bytes --]

From: "Matt" <matt@proweb.co.uk>
To: <9fans@cse.psu.edu>
Subject: Re: [9fans] string to list?
Date: Sun, 10 Jun 2001 22:48:51 +0100
Message-ID: <002501c0f1f7$235fa220$6401a8c0@freeze2k>


----- Original Message -----
From: "Scott Schwartz" <schwartz@bio.cse.psu.edu>


> | I plan to have it do eval `{$msg} and do whatever it's
> | namespace will let it.
>
> I really wouldn't do that.  It's just too unpredictable and dangerous.
> eval considered harmful.

being as I've not implemented it my understanding is weak but I thought that
I could dictate the namespace that a process sees. If the total namespace
the ircbot process sees is

/
/bin/opme
/bin/cat
/bin/ls
/bin/eval
/bin/echo
/slashdotheadlines

then all ircbot can do is  combinations like
echo eval 'ls /bin'
echo eval 'opme'
echo eval 'cat /slashdotheadlines'

but because it can't bind new files in or import them it can't manipulate
it's namespace via the eval







^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 22:24       ` Scott Schwartz
@ 2001-06-10 22:30         ` Boyd Roberts
  0 siblings, 0 replies; 19+ messages in thread
From: Boyd Roberts @ 2001-06-10 22:30 UTC (permalink / raw)
  To: 9fans

> which you probably don't want.

s/probably/definitely/




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 21:48     ` Matt
@ 2001-06-10 22:24       ` Scott Schwartz
  2001-06-10 22:30         ` Boyd Roberts
  0 siblings, 1 reply; 19+ messages in thread
From: Scott Schwartz @ 2001-06-10 22:24 UTC (permalink / raw)
  To: 9fans

| ...I thought that I could dictate the namespace that a process sees.

Yes, unless you someone makes a mistake.  But there's more to it
than that.  eval gives the bad guys unrestricted access to the shell,
which you probably don't want.



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 18:03   ` Scott Schwartz
@ 2001-06-10 21:48     ` Matt
  2001-06-10 22:24       ` Scott Schwartz
  0 siblings, 1 reply; 19+ messages in thread
From: Matt @ 2001-06-10 21:48 UTC (permalink / raw)
  To: 9fans


----- Original Message -----
From: "Scott Schwartz" <schwartz@bio.cse.psu.edu>


> | I plan to have it do eval `{$msg} and do whatever it's
> | namespace will let it.
>
> I really wouldn't do that.  It's just too unpredictable and dangerous.
> eval considered harmful.

being as I've not implemented it my understanding is weak but I thought that
I could dictate the namespace that a process sees. If the total namespace
the ircbot process sees is

/
/bin/opme
/bin/cat
/bin/ls
/bin/eval
/bin/echo
/slashdotheadlines

then all ircbot can do is  combinations like
echo eval 'ls /bin'
echo eval 'opme'
echo eval 'cat /slashdotheadlines'

but because it can't bind new files in or import them it can't manipulate
it's namespace via the eval









^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 21:01   ` Matt
@ 2001-06-10 21:09     ` Boyd Roberts
  0 siblings, 0 replies; 19+ messages in thread
From: Boyd Roberts @ 2001-06-10 21:09 UTC (permalink / raw)
  To: 9fans

> thanks for pushing me through the door marked awk
> a journey well worth taking

just be careful with that eval, eugene.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 14:46 ` Boyd Roberts
@ 2001-06-10 21:01   ` Matt
  2001-06-10 21:09     ` Boyd Roberts
  0 siblings, 1 reply; 19+ messages in thread
From: Matt @ 2001-06-10 21:01 UTC (permalink / raw)
  To: 9fans


----- Original Message ----- 
From: "Boyd Roberts" <boyd@fr.inter.net>
> > :Matt!~matt@hostname.com PRIVMSG #[s.i.s.] :some text
> > 
> > I want to turn it into
> > 
> > $nick $host $msgtype $channel $msg
> 
> eval `{echo $irctext | awk '{ ... }'}

thanks for pushing me through the door marked awk
a journey well worth taking


---
AVG Scanned for viruses
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.261 / Virus Database: 131 - Release Date: 06/06/2001



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 17:32 ` vikki
  2001-06-10 17:47   ` Boyd Roberts
  2001-06-10 17:55   ` Boyd Roberts
@ 2001-06-10 18:03   ` Scott Schwartz
  2001-06-10 21:48     ` Matt
  2 siblings, 1 reply; 19+ messages in thread
From: Scott Schwartz @ 2001-06-10 18:03 UTC (permalink / raw)
  To: 9fans

| I plan to have it do eval `{$msg} and do whatever it's
| namespace will let it.

I really wouldn't do that.  It's just too unpredictable and dangerous.
eval considered harmful.

cmd=`{echo $msg}
if (fgrep -f okcmdlist $cmd(1)) {
	$cmd
} 



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 17:32 ` vikki
  2001-06-10 17:47   ` Boyd Roberts
@ 2001-06-10 17:55   ` Boyd Roberts
  2001-06-10 18:03   ` Scott Schwartz
  2 siblings, 0 replies; 19+ messages in thread
From: Boyd Roberts @ 2001-06-10 17:55 UTC (permalink / raw)
  To: 9fans

>  yeah that's a good idea. I didn't fancy spawning awk for every line of irc.

how about gross ifs/fn/`{...} trickery?




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 17:32 ` vikki
@ 2001-06-10 17:47   ` Boyd Roberts
  2001-06-10 17:55   ` Boyd Roberts
  2001-06-10 18:03   ` Scott Schwartz
  2 siblings, 0 replies; 19+ messages in thread
From: Boyd Roberts @ 2001-06-10 17:47 UTC (permalink / raw)
  To: 9fans

> They've got their monolithic perl bot running.

that's kinda funny, in a 'finally got it to run' sense.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
@ 2001-06-10 17:32 ` vikki
  2001-06-10 17:47   ` Boyd Roberts
                     ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: vikki @ 2001-06-10 17:32 UTC (permalink / raw)
  To: 9fans



>rc irc client? sounds reasonable :)
>i wish i could find my 80-line C irc client i wrote last year for p9 (it
was
>my first project :).. come to think of it though, rc is a much better idea
>and a funnier one to implement :) wish i had a working p9 installation, i
>could've helped!

We're having a bit of a competition at work. They've got their monolithic
perl bot running. I'm trying to impress them with the plan9 version as a
learning exercise. I plan to have it do eval `{$msg} and do whatever it's
namespace will let it. They keep adding code to the perl bot and getting
deeper and deeper. Already they've had to split it in half (on my suggestion
:-) to separate information gathering and display.

>how about awk? daemonize an awk program if RC does not five you the
>utility to do it :)

 yeah that's a good idea. I didn't fancy spawning awk for every line of irc.

I did wonder one day why plan9 has any command line utilities at all apart
from bind, mount, import, unmount , cd, echo and cat.






^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 11:14 Matt
  2001-06-10 14:46 ` Boyd Roberts
@ 2001-06-10 15:20 ` andrey mirtchovski
  1 sibling, 0 replies; 19+ messages in thread
From: andrey mirtchovski @ 2001-06-10 15:20 UTC (permalink / raw)
  To: 9fans

rc irc client? sounds reasonable :)
i wish i could find my 80-line C irc client i wrote last year for p9 (it was
my first project :).. come to think of it though, rc is a much better idea
and a funnier one to implement :) wish i had a working p9 installation, i
could've helped!

On Sun, 10 Jun 2001, Matt wrote:

> specifically I'm want to parse IRC messages with RC
> 
> given
> :Matt!~matt@hostname.com PRIVMSG #[s.i.s.] :some text
> 
> I want to turn it into
> 
> $nick $host $msgtype $channel $msg
> 
> can someone bash me with the cluestick please.
> 

how about awk? daemonize an awk program if RC does not five you the
utility to do it :) 



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9fans] string to list?
  2001-06-10 11:14 Matt
@ 2001-06-10 14:46 ` Boyd Roberts
  2001-06-10 21:01   ` Matt
  2001-06-10 15:20 ` andrey mirtchovski
  1 sibling, 1 reply; 19+ messages in thread
From: Boyd Roberts @ 2001-06-10 14:46 UTC (permalink / raw)
  To: 9fans

> :Matt!~matt@hostname.com PRIVMSG #[s.i.s.] :some text
> 
> I want to turn it into
> 
> $nick $host $msgtype $channel $msg

eval `{echo $irctext | awk '{ ... }'}

where the awk spits:

    nick='...'

etc





^ permalink raw reply	[flat|nested] 19+ messages in thread

* [9fans] string to list?
@ 2001-06-10 11:14 Matt
  2001-06-10 14:46 ` Boyd Roberts
  2001-06-10 15:20 ` andrey mirtchovski
  0 siblings, 2 replies; 19+ messages in thread
From: Matt @ 2001-06-10 11:14 UTC (permalink / raw)
  To: 9fans

Hi,

list to string is documented :
list=(How now brown cow)
string=$"list

but how do I go the other way?

specifically I'm want to parse IRC messages with RC

given
:Matt!~matt@hostname.com PRIVMSG #[s.i.s.] :some text

I want to turn it into

$nick $host $msgtype $channel $msg

can someone bash me with the cluestick please.

Matt


---
AVG Scanned for viruses
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.261 / Virus Database: 131 - Release Date: 07/06/2001



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2001-06-11 10:38 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-11  1:45 [9fans] string to list? presotto
  -- strict thread matches above, loose matches on Subject: below --
2001-06-10 23:22 presotto
2001-06-10 23:35 ` Scott Schwartz
2001-06-10 22:36 Jonathan Sergent
2001-06-11  0:15 ` Matt
2001-06-11 10:18 ` Laura Creighton
2001-06-11 10:38   ` Matt
     [not found] <vikki@proweb.co.uk>
2001-06-10 17:32 ` vikki
2001-06-10 17:47   ` Boyd Roberts
2001-06-10 17:55   ` Boyd Roberts
2001-06-10 18:03   ` Scott Schwartz
2001-06-10 21:48     ` Matt
2001-06-10 22:24       ` Scott Schwartz
2001-06-10 22:30         ` Boyd Roberts
2001-06-10 11:14 Matt
2001-06-10 14:46 ` Boyd Roberts
2001-06-10 21:01   ` Matt
2001-06-10 21:09     ` Boyd Roberts
2001-06-10 15:20 ` andrey mirtchovski

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 NNTP newsgroup(s).