How do I use (require :PACKAGE) in clisp under Ubuntu Hardy? - linux

I am trying to evaluate the answer provided here, and am getting the error: "A file with name ASDF-INSTALL does not exist" when using clisp:
dsm#localhost:~$ clisp -q
[1]> (require :asdf-install)
*** - LOAD: A file with name ASDF-INSTALL does not exist
The following restarts are available:
ABORT :R1 ABORT
Break 1 [2]> :r1
[3]> (quit)
dsm#localhost:~$
cmucl throws a similar error:
dsm#localhost:~$ cmucl -q
Warning: #<Command Line Switch "q"> is an illegal switch
CMU Common Lisp CVS release-19a 19a-release-20040728 + minimal debian patches, running on crap-pile
With core: /usr/lib/cmucl/lisp.core
Dumped on: Sat, 2008-09-20 20:11:54+02:00 on localhost
For support see http://www.cons.org/cmucl/support.html Send bug reports to the debian BTS.
or to pvaneynd#debian.org
type (help) for help, (quit) to exit, and (demo) to see the demos
Loaded subsystems:
Python 1.1, target Intel x86
CLOS based on Gerd's PCL 2004/04/14 03:32:47
* (require :asdf-install)
Error in function REQUIRE: Don't know how to load ASDF-INSTALL
[Condition of type SIMPLE-ERROR]
Restarts:
0: [ABORT] Return to Top-Level.
Debug (type H for help)
(REQUIRE :ASDF-INSTALL NIL)
Source:
; File: target:code/module.lisp
(ERROR "Don't know how to load ~A" MODULE-NAME)
0] (quit)
dsm#localhost:~$
But sbcl works perfectly:
dsm#localhost:~$ sbcl -q
This is SBCL 1.0.11.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (require :asdf-install)
; loading system definition from
; /usr/lib/sbcl/sb-bsd-sockets/sb-bsd-sockets.asd into #<PACKAGE "ASDF0">
; registering #<SYSTEM SB-BSD-SOCKETS {AB01A89}> as SB-BSD-SOCKETS
; registering #<SYSTEM SB-BSD-SOCKETS-TESTS {AC67181}> as SB-BSD-SOCKETS-TESTS
("SB-BSD-SOCKETS" "ASDF-INSTALL")
* (quit)
Any ideas on how to fix this? I found this post on the internet, but using that didn't work either.

The instructions you got mentioned SBCL explicitely, so it's expected that they'll work better using SBCL, I suppose. Some other Lisps don't come with ASDF or don't hook it up to CL:REQUIRE. In the former case, you'll have load ASDF yourself beforehand. In the latter case, you'll need to call (asdf:oos 'asdf:load-op ) instead of (require ).

wget http://cclan.cvs.sourceforge.net/checkout/cclan/asdf/asdf.lisp
It worth checking out clbuild. http://common-lisp.net/project/clbuild/
To get a lisp webserver up and running. You only need:
darcs get http://common-lisp.net/project/clbuild/clbuild
cd clbuild
chmod +x ./clbuild
./clbuild check
./clbuild build slime hunchentoot
./clbuild preloaded
Now a lisp repl will start. There you write:
* (hunchentoot:start-server :port 8080)
Testing that the server answer:
wget -O - http://localhost:8080/
<html><head><title>Hunchentoot</title></head>
<body><h2>Hunchentoot Default Page</h2>
<p>This is the Hunchentoot default page....

try this before anything else:
(require :asdf)
you can steal some ideas from the environment we use. it's available at: darcsweb
see environment.lisp that loads and sets up asdf for us. (sbcl has asdf already loaded)

use clc:clc-require in clisp. Refer to 'man common-lisp-controller'. I had the same error in clisp and resolved it by using clc:clc-require. sbcl works fine with just require though.

Related

.exe has stopped working when use thread module

I just copy the code from the example on nim's offical documentation:
import std/locks
var
thr: array[0..4, Thread[tuple[a,b: int]]]
L: Lock
proc threadFunc(interval: tuple[a,b: int]) {.thread.} =
for i in interval.a..interval.b:
acquire(L) # lock stdout
echo i
release(L)
initLock(L)
for i in 0..high(thr):
createThread(thr[i], threadFunc, (i*10, i*10+5))
joinThreads(thr)
deinitLock(L)
$ nimble build --threads:on
Verifying dependencies for thread#0.1.0
Building thread/thread.exe using c backend
$ .\thread
then thread.exe crashed...
thread.exe
0.0.0.0
630c5e83
libwinpthread-1.dll
6.3.9600.20512
62cdfc6e
c0000135
00000000000ed1b0
1fc8
01d8bb71e28918ba
F:\MyProjects\Nim\thread\thread.exe
libwinpthread-1.dll
2044d161-2765-11ed-827a-6c86063c07b4
I have no ideas about it...Can anybody help me? Thanks a lot.
Gave it a try in Windows 8.1, it does fail.
Apparently is a recent regression in nim you can make it work if you compile it with --threads:on --tlsEmulation:on (or make sure mingw binaries is on your PATH).

'SB-KERNEL:UNKNOWN-PARSE-TYPE' when connecting Vim to SBCL using Vlime

I have Vim 8.0.1365 with Vlime plugin (065b95f) installed and an SBCL (1.2.11) session with the start-vlime.lisp loaded, running on macOS 10.14.6 (18G87).
When I connect from Vim using \cc, the SBCL session shows vlime-sbcl - New connection from #<AIO-SBCL:AIO-FD {10048DFD63} (so the connection works) but then the debugger is invoked with an SB-KERNEL:PARSE-UNKNOWN-TYPE condition signalled.
The debugger restarts are:
0: [REMOVE-FD-HANDLER] Remove #<SB-IMPL::HANDLER INPUT on descriptor 6: #<FUNCTION AIO-SBCL::SOCKET-INPUT-CB>>
1: [ABORT ] Exit debugger, returning to top level.
(VLIME-SBCL::SOCKET-ERROR-CB #<unavailable argument> #<SB-KERNEL:PARSE-UNKNOWN-TYPE {1004BE9B23}>)
I've tried both restart options. Removing the handler gives no response, and aborting returns SBCL to the * prompt.
The connection appears to exist in Vim (though there is no success message) and can be selected when using the \ss command (I tested on (+ 3 3)).
The SWANK window just displays a -- for each use of \ss and an error message below shows:
Error detected while processing function vlime#plugin#SendToREPL[100]..vlime#ui#input#MaybeInput[33]..<SNR>42_CheckInputValidity[2]..<SNR>32_SendToREPLInputComplete:
line 2:
E716: Key not present in Dictionary: ListenerEval, [a:content, function('s:OnListenerEvalComplete')]))
E116: Invalid arguments for function(a:conn.ListenerEval, [a:content, function('s:OnListenerEvalComplete')]))
E116: Invalid arguments for function vlime#WithThread
I don't have much experience with SBCL or Lisp - this is basically a hurdle at the starting line.
What does the first restart option mean?
The PARSE-UNKNOWN-TYPE condition seems uncommon from a Google search, and not at all in relation to Vlime. What are some next steps I can take to work this out?
(Posting the comment as an answer)
A common source of error when dealing with client/server protocols is a mismatch in versions for the different parts involved. The gihub page for vlime lists dependencies and supported implementations, I'd start from there.
Also, try starting sbcl in a standalone terminal (first install quicklisp, use "rlwrap sbcl" for readline support) and then load Swank manually:
(ql:quickload :swank)
Create a server
(swank:create-server :port 4005)
And connect to it, so you can still debug errors from the terminal if there are problems with the client/server interface.

Invalid Escape Sequence in Nmap NSE Lua Script "\."

I recently had a need for a Drupal fingerprint NSE script for an engagement. Through some research I stumbled upon a promising NSE Lua script to get the job done. Unfortunately, it seems like the author ceased the support for this script and the script was never officially incorporated into the Nmap NSE library. I decided to try and use the script anyways.
Upon attempting to run the script via the Nmap engine, I encountered an "invalid escape sequence" error. Not possessing any Lua programming experience, this error stopped me dead in my tracks. I am hoping someone with Lua experience would be able to help troubleshoot what looks like may be a pretty simple fix to the problem.
The error code is as follows:
root#kali:~# nmap --script=http-drupal-fingerprint.nse --script-args http-drupal-fingerprint.base-url=/ www.placeholder.com
Starting Nmap 7.70 ( https://nmap.org ) at 2018-09-26 12:33 EDT
NSE: failed to initialize the script engine:
/usr/bin/../share/nmap/nse_main.lua:259: /usr/bin/../share/nmap/scripts/http-drupal-fingerprint.nse:47: invalid escape sequence near '"Drupal [4-7].'
stack traceback:
[C]: in function 'assert'
/usr/bin/../share/nmap/nse_main.lua:259: in upvalue 'loadscript'
/usr/bin/../share/nmap/nse_main.lua:601: in field 'new'
/usr/bin/../share/nmap/nse_main.lua:828: in local 'get_chosen_scripts'
/usr/bin/../share/nmap/nse_main.lua:1315: in main chunk
[C]: in ?
QUITTING!
The script was imported into the NSE library as so:
curl -ksL https://raw.githubusercontent.com/r3dh4nds/NSE-Drupal-Fingerprint/master/http-drupal-fingerprint.nse >> /usr/share/nmap/scripts/http-drupal-fingerprint.nse && chmod 0644 /usr/share/nmap/scripts/http-drupal-fingerprint.nse
I am including the original source of the script from SecLists:
https://seclists.org/nmap-dev/2011/q2/490
Any help much appreciated! (Sorry if this question is somehow not formatted correctly, first post)
Drupal detection in Nmap is now done with the http-enum script. You can add --script-args http-enum.category=cms to limit the number of enumeration probes sent to only those which would detect Drupal. You may also be interested in the http-drupal-enum and http-drupal-enum-users scripts, as well as http-form-brute which can brute-force Drupal authentication.
As I suspected it was a simple fix. Removed the invalid escape sequences at:
local expression = "Drupal [4-7]\.[0-9][0-9]?\.?[0-9], "
to
local expression = "Drupal [4-7].[0-9][0-9]?.?[0-9], "
and got rid of that error.

Clojurescript + Node.js 0.12.7 issue (error "process.binding('evals') No such module: evals")

I'm trying to use Node.js + ClojureScript, and I found an article for it.
http://www.mase.io/code/clojure/node/2015/01/24/getting-started-with-clojurecript-and-node/
Following the instruction to find this error:
process.binding('evals').NodeScript.runInThisContext.call(
^
Error: No such module: evals
at Error (native)
The issue seems that I need to use old version of node: https://groups.google.com/forum/#!topic/clojurescript/VneLWVpwe6o and https://github.com/kanso/kanso/issues/422
Mine is 0.12.7
pow> node --version
v0.12.7
In this case, I may need to use old version of node, but better yet, is there a way to bypass this issue? If none exists, how to use the old version of node.js in Mac OS X?
Edit
Following https://github.com/creationix/nvm, I could install 0.10.32 version of node.js.
pow> nvm install 0.10.32
pow> node --version
v0.10.32
However, it gives me another error message:
pow> node entrypoint.js
Hello world!
/Users/smcho/Desktop/clojurescript/pow/out/server/cljs/core.js:12133
var fixed_arity = f.cljs$lang$maxFixedArity;
^
TypeError: Cannot read property 'cljs$lang$maxFixedArity' of null
Edit2
The error was because I forgot to update the core.cljs module to include ((set! *main-cli-fn* -main). It's mentioned in the original article, together with https://groups.google.com/forum/#!topic/clojurescript/DYpsiCmsyIs and https://github.com/clojure/clojurescript/wiki/Quick-Start#running-clojurescript-on-nodejs.
From the post, there are two ways to make it working, with Mac OSX, the two approaches require different version of node.js, and this is not clearly explained in the post.
The version that works with old node.js
_project.clj
(defproject pow "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/clojurescript "0.0-2725"]]
:node-dependencies [[source-map-support "0.2.8"]]
:plugins [[lein-cljsbuild "1.0.4"]
[lein-npm "0.4.0"]]
:source-paths ["src" "target/classes"]
:clean-targets ["out/server/pow" "out/server/pow.js"]
:cljsbuild {
:builds [{:id "server"
:source-paths ["src/server"]
:compiler {
:main pow.core
:output-to "out/server/pow.js"
:output-dir "out/server"
:optimizations :none
:target :nodejs
:cache-analysis true
:source-map true}}
]})
entry.js
// entrypoint.js
require("./out/server/goog/bootstrap/nodejs");
require("./out/server/pow");
require("./out/server/pow/core");
Run the script that executes the old node.js
#!/bin/bash
lein new mies pow
cd pow
cp ../_project.clj project.clj
mkdir src/server
mv src/pow src/server/
lein cljsbuild once
cp ../entrypoint.js .
/Users/smcho/.nvm/v0.10.32/bin/node entrypoint.js
The version that works with new node.js
Modify the _project.clj
:optimizations :simple <-
:source-map "out/server/pow.js.map" <-
Run first part of runme.sh
lein new mies pow
cd pow
cp ../_project.clj project.clj
mkdir src/server
mv src/pow src/server/
MOdify core.clj
(ns pow.core
(:require
[clojure.browser.repl :as repl]))
(enable-console-print!)
(defn -main []
(println "Hello world!"))
(set! *main-cli-fn* -main)
Then the second part of shell script
cd pow
lein cljsbuild once
node out/server/pow.js
One more note
I wanted to use ClojureScript/Node.js in order to test clojureScript code without using web browsers. I found LightTable, and
a good tutorial about it. All I need to is open the LightTable, connect to LightTable UI as an output, then execute the script. So, I have much less reason to use ClojureScript/Node.js as of now.
I fixed this with two steps:
1) Declaring a main function
(ns testproj.core
(:require
[clojure.browser.repl :as repl]))
(enable-console-print!)
(defn -main []
(println "Hello world!"))
(set! *main-cli-fn* -main)
2) Setting optimizations: simple in my project.clj, as noted at the very bottom of this blog post. For reasons unknown to me, optimizations: none breaks things.

erlang zip:unzip/1 {error, bad_central_directory} and {error, bad_eocd}

I have always used erlang stdlib library zip:unzip/1 successfully. Last night i hit a bar with this error:
E:\WimaxStatsParser-1.1>erl
Eshell V5.9.2 (abort with ^G)
1> zip:unzip("e:/WimaxStatsParser-1.1/in/SomeZipFile.zip").
{error,bad_central_directory}
2>
Some one help explain the cause for this ? and how i get around it ?
ADDITIONS
I got some other error on another file: {error,bad_eocd}. Please explain this as well.
I am not able to reproduce your problem with the information you give. There are 2 functions that may send this error:
get_cd_loop/5 and get_name_extra_comment/4 in stdlib-1.18.2/src/zip.erl .
it should be easy to debug
copy the file zip.erl, zip.hrl, file.hrl in a working directory,
compile with debug_info option, you will get the error message "Can't load module that resides in sticky dir", leave the VM
copy zip.beam in the stdlib.../ebin
restart the VM in the working directory, you can now add breakpoint in the zip.erl source.
BR
Pascal.

Resources