newlisp wiki setup / error

Q&A's, tips, howto's

newlisp wiki setup / error

Postby newland » Thu Sep 11, 2014 9:48 am

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
newland
 
Posts: 8
Joined: Thu Sep 11, 2014 9:30 am

Re: newlisp wiki setup / error

Postby ralph.ronnquist » Thu Sep 11, 2014 12:40 pm

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.
ralph.ronnquist
 
Posts: 202
Joined: Mon Jun 02, 2014 1:40 am
Location: Melbourne, Australia

Re: newlisp wiki setup / error

Postby Lutz » Thu Sep 11, 2014 1:49 pm

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.
Lutz
 
Posts: 5276
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: newlisp wiki setup / error

Postby newland » Fri Sep 12, 2014 8:37 am

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=Ho ... d_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
newland
 
Posts: 8
Joined: Thu Sep 11, 2014 9:30 am

Re: newlisp wiki setup / error

Postby newland » Fri Sep 12, 2014 10:35 am

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=Ho ... d_Features without getting an error in all versions of newlisp.

What version of newlisp is running newlisp.org?

thanks,
newland
newland
 
Posts: 8
Joined: Thu Sep 11, 2014 9:30 am

Re: newlisp wiki setup / error

Postby ralph.ronnquist » Sat Sep 13, 2014 8:47 am

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.
Code: Select all
% 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:
Code: Select all
(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.
ralph.ronnquist
 
Posts: 202
Joined: Mon Jun 02, 2014 1:40 am
Location: Melbourne, Australia

Re: newlisp wiki setup / error

Postby Lutz » Sat Sep 13, 2014 3:02 pm

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
Lutz
 
Posts: 5276
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: newlisp wiki setup / error

Postby newland » Mon Sep 15, 2014 8:18 pm

Hi Lutz,

thanks very much! The wiki now works. I'm experimenting to see how it exactly works.

newland
newland
 
Posts: 8
Joined: Thu Sep 11, 2014 9:30 am


Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 1 guest

cron