chicken-janitors
[Top][All Lists]
Advanced

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

[Chicken-janitors] #939: simple-directory-handler: error 500 on listing


From: Chicken Trac
Subject: [Chicken-janitors] #939: simple-directory-handler: error 500 on listing a directory with a link foo -> foo
Date: Wed, 24 Oct 2012 19:55:51 -0000

#939: simple-directory-handler: error 500 on listing a directory with a link foo
-> foo
----------------------------------------------+-----------------------------
 Reporter:  mario                             |       Owner:  sjamaan
     Type:  defect                            |      Status:  new    
 Priority:  minor                             |   Milestone:  someday
Component:  extensions                        |     Version:  4.8.x  
 Keywords:  spiffy, simple-directory-handler  |  
----------------------------------------------+-----------------------------
 Here are the steps to reproduce the problem:

 {{{
 $ cat server.scm
 (use spiffy simple-directory-handler)

 (handle-directory simple-directory-handler)

 (start-server)

 $ mkdir web
 $ cd web
 $ ln -s foo foo
 $ cd ..
 $ csi -s server.scm &
 [1] 6379

 $ wget http://localhost:8080
 --2012-10-24 17:32:45--  http://localhost:8080/
 Resolving localhost... ::1, 127.0.0.1
 Connecting to localhost|::1|:8080... failed: Connection refused.
 Connecting to localhost|127.0.0.1|:8080... connected.
 HTTP request sent, awaiting response... [Wed Oct 24 17:32:45 2012] "GET
 http://localhost:8080/ HTTP/1.0" Error: (file-exists?)
 system error while trying to access file
 "./web//foo"

         Call history:

         display
         spiffy#root-path
         make-pathname
         simple-directory-handler#simple-directory-dotfiles?
         directory
         sort
         fold
         spiffy#root-path
         make-pathname
         make-pathname
         directory?
         file-exists?
         k695701
         g699700
         spiffy#handle-exception
         with-output-to-string           <--


 500 Internal Server Error
 2012-10-24 17:32:45 ERROR 500: Internal Server Error.
 }}}

 The problem seems to be in simple-directory-handler's {{{simple-directory-
 handler}}} procedure, when it calls {{{file-exists?}}} in the {{{fold}}}
 body (around line 82).

 The call to {{{file-exists?}}} seems to be due to the fact that
 {{{(simple-directory-display-file)}}} calls {{{file-size}}} and {{{file-
 modification-time}}} on the given file.  That's actually subject to race
 conditions, so maybe it would be better to just handle exceptions in
 {{{(simple-directory-display-file)}}} when attempting those operations.

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/939>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]