Hi,
I'm trying to use the newlisp wiki on localhost, started with the following command line:
./newlisp -http -d 8080 -w $PWD/
It works for some pages and page creation, but i run into problems with string functions used in the index.cgi script.
For example, if i try to view
or http://localhost:8080/index.cgi?files
I get the following error
ERR: list or string expected in function find : nil called from user defined function get-flags called from user defined function files-table
There are also similar errors, e.g. ERR: list or string expected in function replace : nil .
So I suspect it has to do with string functions. Help would be greatly appreciated.
thanks,
newland
I might well be far off the mark, but perhaps this is due to that the 'get-pages' function seemingly implements the assumption that a directory listing always starts with "." and "..", rather than filtering them explicitly, as is done with ".htaccess" and "setup.lsp".
Perhaps sometimes the "." and ".." entries are elsewhere in the "directory" list, which here would lead to the attempt to read a directory entry as if it was a content file, yielding nil and the eventual consequence of the "find" function aborting.
Thus, I'd suggest you try changing "get-pages", replacing the brute force "slice" with "replace" clauses for "." and "..", and see how that goes.
Seems to be a permissions or other error when trying to read one of the files.
Probably read-file called from get-content called from get-flags fails nil and then get-content returns nil on which the find command fails in get-flags.
Hi Lutz and Ralph,
thanks for the suggestions. I tried the wiki also on a server with apache, next to my local setup. I still get the same errors. The strange thing is, when I request most pages, it works, e.g.
http://localhost:8080/index.cgi?page=Changes
But when I request the page http://localhost:8080/index.cgi?page=How_To_Use_Advanced_Features
I get:
ERR: list or string expected in function replace : nil called from user defined function search-content-table called from user defined function display-page
The errors come when using the wiki out of the archive unmodified. I checked, but all pages have the same permissions. I'm somewhat lost at what to try to solve the problem. Maybe it helps, I'm using
newLISP v.10.6.0 64-bit on Linux IPv4/6 UTF-8 libffi
thanks,
newland
Hi,
as a followup to my previous post, I also tried with newlisp 10.5 and 10.4. Strangely they work better, as they allow to use the links at the bottom:
Files | Index | Changes | References
These links don't work in my setup in 10.6
But still I can't visit http://localhost:8080/index.cgi?page=How_To_Use_Advanced_Features without getting an error in all versions of newlisp.
What version of newlisp is running newlisp.org?
thanks,
newland
I get the same problem from a fresh untar and install, and tracked it down to in fact be, that the pages directory listing indeed presents "." and ".." in the middle of the list, and not as the two first elements.
% newlisp -e '(directory "wiki/pages/" )'
("Home" "._FeatureComments" "Copyright_Text" "Contacts" "setup.lsp" "News" "._How_To_Edit_Text" "._setup.lsp" "Default_Style" "._Bottom_Bar" "FeatureComments" "._Home" "Wiki_Link" "._Changes" "How_To_Customize" "._Wiki_Link" "." "._How_To_Customize" "._News" "How_To_Edit_Text" "Bottom_Bar" ".." "._Default_Style" ".htaccess" "._Contacts" "._Title_Text" "Browser_Title" "Title_Text" "How_To_Use_Advanced_Features" "Changes" "._Browser_Title" "._.htaccess" "._Copyright_Text" "._How_To_Use_Advanced_Features")
Changing get-pages (in index.cgi) to be as follows makes it work:
(define (get-pages , files)
(set 'files (directory "pages/"))
(replace "." files)
(replace ".." files)
(replace ".htaccess" files)
(replace "setup.lsp" files))
The same directory list assumption is used in two other places, in the functions "refcount" and "get-backup", which presuambly need similar corrections.
Thanks Ralph for analyzing this bug. Files starting with a "." dot in there name are now reliably filtered out, where needed:
http://www.newlisp.org/downloads/newlisp-wiki-4.7.tgz
Hi Lutz,
thanks very much! The wiki now works. I'm experimenting to see how it exactly works.
newland