MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: FUP ate my db (and I did RTFM)



At 05:58 AM 5/27/96 PDT, dg@dcs.st-and.ac.uk wrote:
>Yes, yes, I know, I'm doing all this. The reason why I want it as a single 
>string is so that I can handle the *entire* pathname from within the db rather 
>than splitting it up into parts. I think the reason why it's actually crashing 

You have two options.  Store it has a two element list, then splice it in to
the args to the file function, or accept it as a single string and then
explode it. I guess my question is why are you trying to work around the system?

>is that while Unix systems will let you open a directory as a file, reads and 
>writes don't do the obvious. I think the EOF marker is definately dodgy, which 
>explains why fileread() appeared to just keep reading data until it ran out of 
>memory.

Reads and writes read and write bytes respectively.  They assume nothing
about the underlying structure of the byte stream they are connected to.
Attempting to place order into this is futile -- it's UNIX.  Admittedly,
this is definately a bug in FUP allowing you to fileread directories, not
much you can do about it besides fixing the code.

>>Note, tostr(E_INVIND) will tell you waht E_INVIND is.  And it doesn't 
>>really make sense to raise that, but what do I know.
>
>I know it's an `invalid indirection'... whatever that is. What does it mean?

In terms of FUP or in terms of when that error is raised normally?

>>Why are you trying to remove files with filermdir?
>
>Because I'm writing a generic FUP wrapper class, supposed to be proteected 
>enough so that ordinary programmers use it, and there's no *telling* what 
>they're going to do.

So don't let them do just anything.  Check to make sure that a file exists
using fileexists before calling file{read,write,append,delete,...}.  Use
filelist to determine if it's a directory or a file and only them them do
operations that are directory operations on directories and file operations
on files.  If you want some semblence of security, don't just pass the
arguments they pass you onto the builtins blindly.

Andy.




Follow-Ups:

Home | Subject Index | Thread Index