On Tue, 2008-08-19 at 13:00 -0700, John Caruso wrote:
> On Monday 05:53 PM 8/18/2008, Jeff Rogers wrote:
> >russell muetzelfeldt wrote:
> >>fastpath is making assumptions about what means something is the "same 
> >>file", and those assumptions are not consistent with unix filesystem 
> >>semantics - how is this not a bug?
> >
> >It's not a bug because no one ever said that it *was* strictly following 
> >unix filesystem semantics, which isn't even a single thing (ufs is 
> >slightly different than nfs, is slightly different than ext2 -noatime, is 
> >slightly different than afs, etc.)  It is following a particular 
> >definition: if the file still exists and has the same 
> >dev/inode/mtime/size as it did when you last checked, then it is the same 
> >file.   This of it as a if-modified-since or if-none-match conditional 
> >GET.
> Actually that's not analogous, for the same reason that the analogies to 
> caching of attributes in NFS, rsync or tar not noticing content changes if 
> attributes stay the same, etc, don't apply: because this bug can happen 
> *even with two files that have completely different names or 
> paths*.  Again, in this example...:

There is no bug in ns_returnfile. 

It is possible that you can modify your program (something like):

set tempfile myfile.txt
set tfd [open $tempfile w+]
file delete $tempfile
exec /some/external/program >@ $tfd
set tlen [tell $tfd]
seek $tfd 0
ns_returnfp 200 text/plain $tfd $flen
close $tfd

Tclsh Example:

[EMAIL PROTECTED]:~/Software/tcl/fd$ tclsh
% set filename hi.txt
% set tfd [open $filename w+]
% ls
% file delete $filename
% ls
% exec echo "hi there" >@ $tfd
% tell $tfd
% seek $tfd 0
% gets $tfd
hi there
% gets $tfd
% tell $tfd
% seek $tfd 
wrong # args: should be "seek channelId offset ?origin?"
% seek $tfd 0
% gets $tfd
hi there
% ls
% close $tfd
% exit

Working AOLserver example:

set directory [file dirname [info script]]
set filename [file join $directory tmp.txt]

set tfd [open $filename w+]

file delete $filename

exec echo "hi there" >@ $tfd

set flen [tell $tfd]

seek $tfd 0

ns_returnfp 200 text/plain $tfd $flen

close $tfd

## Trying this via telnet:

[EMAIL PROTECTED]:~/Software/tcl/fd$ telnet rmadilo.com 80
Connected to rmadilo.com.
Escape character is '^]'.
GET /bugs/ns_returnfile.tcl HTTP/1.1
Host: rmadilo.com

HTTP/1.1 200 OK
Set-Cookie: SessionID = "C9C1F5F33E1B4FC8A462C794F994A7180A65E906" ;
Max-Age = 832044870 ; Path=/
Set-Cookie2: SessionID = "C9C1F5F33E1B4FC8A462C794F994A7180A65E906" ;
Max-Age = 832044870 ; Path=/ ; Version = 1
MIME-Version: 1.0
Date: Tue, 19 Aug 2008 21:25:30 GMT
Server: AOLserver/4.5.0
Content-Type: text/plain; charset=UTF-8
Content-Length: 9
Connection: close

hi there
Connection closed by foreign host.

tom jackson

AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to