Discussion:
[clisp-list] How to solve: module 'syscalls' requires package OS
Jean Louis
2017-03-23 15:29:32 UTC
Permalink
Hello,

When I try to make memory image, with that line, then I get problem:

module 'syscalls' requires package OS

How do I solve that?

(defparameter memdir "/run/shm/")
(defparameter tmp-file "rcd-wrs-XXXXXX")
(defparameter tmp-org (format nil "~a~a.org" memdir tmp-file))
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file))
(require "syscalls")

;; (saveinitmem "org2markdown" :quiet nil :init-function 'main :verbose t :norc t :documentation "Converts Org standard input into markdown" :executable t)
(defun main nil
(let ((input (with-open-stream (str *standard-input*)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line)))))
(with-open-file (stream tmp-org :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
(format stream input))
(shell (format nil "emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el \"~a\" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
(format t (with-open-file (stream tmp-md :direction :input)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line))))
(exit)))

;; (main)
Pascal Bourguignon
2017-03-23 20:01:08 UTC
Permalink
Post by Jean Louis
Hello,
module 'syscalls' requires package OS
How do I solve that?
(defparameter memdir "/run/shm/")
(defparameter tmp-file "rcd-wrs-XXXXXX")
(defparameter tmp-org (format nil "~a~a.org" memdir tmp-file))
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file))
(require "syscalls")
;; (saveinitmem "org2markdown" :quiet nil :init-function 'main :verbose t :norc t :documentation "Converts Org standard input into markdown" :executable t)
(defun main nil
(let ((input (with-open-stream (str *standard-input*)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line)))))
(with-open-file (stream tmp-org :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
(format stream input))
(shell (format nil "emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el \"~a\" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
(format t (with-open-file (stream tmp-md :direction :input)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line))))
(exit)))
;; (main)
“OS” is a nickname of the “POSIX” package that is created by the syscalls module, so if you have required syscalls, it must exist, and you cannot get this error.

Works for me, with the following change:

[***@despina :0.0]$ cat o.lisp
(defparameter memdir "/run/shm/")
(defparameter tmp-file "rcd-wrs-XXXXXX")
(defparameter tmp-org (format nil "~a~a.org" memdir tmp-file))
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file))
(require "syscalls")


(defun main nil
(let ((input (with-open-stream (str *standard-input*)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line)))))
(with-open-file (stream tmp-org :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
(format stream input))
(shell (format nil "emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el \"~a\" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
(format t (with-open-file (stream tmp-md :direction :input)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line))))
(exit)))

(saveinitmem "org2markdown" :quiet nil :init-function 'main :verbose t :norc t :documentation "Converts Org standard input into markdown" :executable t)

/tmp
[***@despina :0.0]$ clisp o.lisp

Bytes permanently allocated: 172,224
Bytes currently in use: 3,311,400
Bytes available until next GC: 826,440

/tmp
[***@despina :0.0]$ ls -l org2markdown
-rwxr-xr-x 1 pjb wheel 6215484 Mar 23 20:58 org2markdown*
--
__Pascal J. Bourguignon__
Jean Louis
2017-03-23 20:05:10 UTC
Permalink
Hello,

Thank you.

Yes, now I can save the memory image.

Then I need to work on it that it really works.
Post by Pascal Bourguignon
Post by Jean Louis
Hello,
module 'syscalls' requires package OS
How do I solve that?
(defparameter memdir "/run/shm/")
(defparameter tmp-file "rcd-wrs-XXXXXX")
(defparameter tmp-org (format nil "~a~a.org" memdir tmp-file))
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file))
(require "syscalls")
;; (saveinitmem "org2markdown" :quiet nil :init-function 'main :verbose t :norc t :documentation "Converts Org standard input into markdown" :executable t)
(defun main nil
(let ((input (with-open-stream (str *standard-input*)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line)))))
(with-open-file (stream tmp-org :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
(format stream input))
(shell (format nil "emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el "~a" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
(format t (with-open-file (stream tmp-md :direction :input)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line))))
(exit)))
;; (main)
“OS” is a nickname of the “POSIX” package that is created by the syscalls module, so if you have required syscalls, it must exist, and you cannot get this error.
(defparameter memdir "/run/shm/")
(defparameter tmp-file "rcd-wrs-XXXXXX")
(defparameter tmp-org (format nil "~a~a.org" memdir tmp-file))
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file))
(require "syscalls")
(defun main nil
(let ((input (with-open-stream (str *standard-input*)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line)))))
(with-open-file (stream tmp-org :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
(format stream input))
(shell (format nil "emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el "~a" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
(format t (with-open-file (stream tmp-md :direction :input)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line))))
(exit)))
(saveinitmem "org2markdown" :quiet nil :init-function 'main :verbose t :norc t :documentation "Converts Org standard input into markdown" :executable t)
/tmp
Bytes permanently allocated: 172,224
Bytes currently in use: 3,311,400
Bytes available until next GC: 826,440
/tmp
-rwxr-xr-x 1 pjb wheel 6215484 Mar 23 20:58 org2markdown*
--
__Pascal J. Bourguignon__
J***@t-systems.com
2017-03-24 13:51:21 UTC
Permalink
Post by Jean Louis
module 'syscalls' requires package OS
How do I solve that?
Do not require syscalls. :-)
The code you provided only uses standard Common Lisp and a few CLISP extensions (ext:saveinitmem, ext:shell).
Post by Jean Louis
(let ((input (with-open-stream (str *standard-input*)
Do you realize that WITH-OPEN-STREAM closes the stream upon exit?
Unless you really know what you do, programs are usually advised against closing their stdio handles.
Post by Jean Louis
(defparameter memdir "/run/shm/")
Don't reinvent the wheel. There's a reason people have, for decades, recommended adding namespace decorations to special variables, e.g. use *memdir*.
Post by Jean Louis
(format stream input))
That is as bad as printf(stream, format) in C. This will error out if there happens to be
any #\~ resp. '%' in the input!
In C code, that might be your open door to a security vulnerability.
There's a life beside FORMAT, half a dozen functions in CL begin with PRIN, e.g. PRINC.

(let ((input (with-open-stream (str *standard-input*)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (format t "~A~%" line)))))
(with-open-file (stream tmp-org :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
(format stream input))

Huh? Why store a whole intermediate copy in RAM?
Why not immediately copy *standard-input* to a file-stream?
Think pipes & parallelism & composition, not sequential step after step processing.
Post by Jean Louis
(let ((input (with-open-stream (str *standard-input*)
(loop :for line = (read-line *standard-input* nil nil)
So you create a stream handle but nevertheless call read-line on another stream?
I believe I can guess what you want to achieve, however the above logic is broken. Think about what WITH-OPEN-STREAM returns as values. Think about what values LOOP returns.
Do you want to operate on streams or strings? Do you aim for a functional programming or an imperative programming style?

Regards,
Jörg Höhle
Jean Louis
2017-03-24 20:41:51 UTC
Permalink
Hello Jörg,

Danke, thank you.
Post by J***@t-systems.com
Do not require syscalls. :-)
The code you provided only uses standard Common Lisp and a few CLISP
extensions (ext:saveinitmem, ext:shell).
Now it works without it.
Post by J***@t-systems.com
Post by Jean Louis
(let ((input (with-open-stream (str *standard-input*)
Do you realize that WITH-OPEN-STREAM closes the stream upon exit?
Unless you really know what you do, programs are usually advised
against closing their stdio handles.
On this one I just need to read from *standard-input*, the Org file,
then launch emacs to export to markdown, later I convert markdown to
HTML with the favorite variety.
Post by J***@t-systems.com
Post by Jean Louis
(defparameter memdir "/run/shm/")
Don't reinvent the wheel. There's a reason people have, for decades,
recommended adding namespace decorations to special variables,
e.g. use *memdir*.
OK sure, yet it is very short and not as important.
Post by J***@t-systems.com
Post by Jean Louis
(format stream input))
That is as bad as printf(stream, format) in C. This will error out if there happens to be
any #\~ resp. '%' in the input!
Yes, thank you, I got that. I was thinking I am getting good output,
it wasn't.
Post by J***@t-systems.com
Huh? Why store a whole intermediate copy in RAM?
Why not immediately copy *standard-input* to a file-stream?
Yes, in the first run, maybe it is possible to simply read and
directly put into the file.

And putting it into the file is required for Emacs Org conversion.

Of course functional style is what I like and use now in Lisp. This
one is very short, and just to be used for receiving Org through
*standard-input* and giving back the HTML.

Now, the problem is that in this version it works if I launch it with
lisp (CLISP), yet if I launch it as saved memory image, I get stack
overflow with RESET. Do you know why the saved memory image is giving
me stack overflow?

Jean


(defparameter memdir "/run/shm/")
(defparameter tmp-file "rcd-wrs-XXXXXX")
(defparameter tmp-org (format nil "~a~a.org" memdir tmp-file))
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file))
(load "/home/data1/protected/Programming/git/RCDBusiness/lib/lisp/streamtools.lisp")
;; (require "syscalls")

(defun main ()
(let ((input '())
(output '()))
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (push line input))
(setf input (format nil "~{~a~^~%~}" (reverse input)))
(with-open-file (stream tmp-org :direction :output :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
(princ input stream))
(shell (format nil "emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el \"~a\" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
(with-open-file (stream tmp-md :direction :input :external-format "utf-8")
(loop :for line = (read-line stream nil nil)
:while line
:do (push line output)))
(setf output (format nil "~{~a~^~%~}" (reverse output)))
(setf output (slurp-stream-io-command "/usr/bin/discount_markdown -F 0x4" output))
(princ output))
(exit))

;; (saveinitmem "org2markdown" :quiet t :init-function 'main :verbose nil :norc t :documentation "Converts Org standard input into markdown" :executable t)

(main)
Sam Steingold
2017-03-27 12:20:27 UTC
Permalink
Post by Jean Louis
Now, the problem is that in this version it works if I launch it with
lisp (CLISP), yet if I launch it as saved memory image, I get stack
overflow with RESET. Do you know why the saved memory image is giving
me stack overflow?
I think I already said that this is a known bug
https://sourceforge.net/p/clisp/bugs/695/
with a know work-around (see the bug).
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net
http://www.dhimmitude.org http://www.memritv.org https://ffii.org
If Microsoft wrote poetry, it would have patented dactyl and anapest.
Jean Louis
2017-03-27 12:29:19 UTC
Permalink
Post by Sam Steingold
Post by Jean Louis
Now, the problem is that in this version it works if I launch it with
lisp (CLISP), yet if I launch it as saved memory image, I get stack
overflow with RESET. Do you know why the saved memory image is giving
me stack overflow?
I think I already said that this is a known bug
https://sourceforge.net/p/clisp/bugs/695/
with a know work-around (see the bug).
I am not sure if that is the same bug. Here is the program, and now it
is just working well, it accepts Org file on standard input, and spits
out the HTML.

If I make memory image with this one, it is heating the CPU, and I get
stack overflow. After researching the bug 695, I could not find
pointers and I don't know what can I do to make the work around.

(defparameter memdir "/run/shm/")
(defparameter tmp-file "rcd-wrs-XXXXXX")
(defparameter tmp-org (format nil "~a~a.org" memdir tmp-file))
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file))
(load "/home/data1/protected/Programming/git/RCDBusiness/lib/lisp/streamtools.lisp")
;; (require "syscalls")

(defun main ()
(let ((input '())
(output '()))
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (push line input))
(setf input (format nil "~{~a~^~%~}" (reverse input)))
(with-open-file (stream tmp-org :direction :output :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
(princ input stream))
(shell (format nil "emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el \"~a\" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
(with-open-file (stream tmp-md :direction :input :external-format "utf-8")
(loop :for line = (read-line stream nil nil)
:while line
:do (push line output)))
(setf output (format nil "~{~a~^~%~}" (reverse output)))
(setf output (slurp-stream-io-command "/usr/bin/discount_markdown -F 0x4" output))
(princ output))
(exit))

;; (saveinitmem "org2html" :quiet t :init-function 'main :verbose nil :norc t :documentation "Converts Org standard input into markdown" :executable t)

(main)
Jean Louis
2017-03-27 12:45:42 UTC
Permalink
I have done as following:
clisp -i pipe-from-org-to-markdown.lisp

and then saved memory image, and I was getting problem, and now I have
done with:

clisp -q -norc -i pipe-from-org-to-markdown.lisp

and then saved memory image, and now I don't see a problem happening,
it is just waiting for standard input, without stack overflow. While
my particular case is solved, maybe it is not solved in the CLISP.

Yet, I still don't know what to do to solve:
module 'syscalls' requires package OS
in other program.
Post by Jean Louis
Post by Sam Steingold
Post by Jean Louis
Now, the problem is that in this version it works if I launch it with
lisp (CLISP), yet if I launch it as saved memory image, I get stack
overflow with RESET. Do you know why the saved memory image is giving
me stack overflow?
I think I already said that this is a known bug
https://sourceforge.net/p/clisp/bugs/695/
with a know work-around (see the bug).
I am not sure if that is the same bug. Here is the program, and now it
is just working well, it accepts Org file on standard input, and spits
out the HTML.
If I make memory image with this one, it is heating the CPU, and I get
stack overflow. After researching the bug 695, I could not find
pointers and I don't know what can I do to make the work around.
(defparameter memdir "/run/shm/")
(defparameter tmp-file "rcd-wrs-XXXXXX")
(defparameter tmp-org (format nil "~a~a.org" memdir tmp-file))
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file))
(load "/home/data1/protected/Programming/git/RCDBusiness/lib/lisp/streamtools.lisp")
;; (require "syscalls")
(defun main ()
(let ((input '())
(output '()))
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (push line input))
(setf input (format nil "~{~a~^~%~}" (reverse input)))
(with-open-file (stream tmp-org :direction :output :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
(princ input stream))
(shell (format nil "emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el \"~a\" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
(with-open-file (stream tmp-md :direction :input :external-format "utf-8")
(loop :for line = (read-line stream nil nil)
:while line
:do (push line output)))
(setf output (format nil "~{~a~^~%~}" (reverse output)))
(setf output (slurp-stream-io-command "/usr/bin/discount_markdown -F 0x4" output))
(princ output))
(exit))
;; (saveinitmem "org2html" :quiet t :init-function 'main :verbose nil :norc t :documentation "Converts Org standard input into markdown" :executable t)
(main)
Sam Steingold
2017-03-27 14:07:54 UTC
Permalink
Post by Jean Louis
module 'syscalls' requires package OS
in other program.
Please create a small isolated reproducible test case.
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://www.memritv.org
http://thereligionofpeace.com http://jij.org https://ffii.org http://camera.org
When C++ is your hammer, everything looks like a thumb.
Jean Louis
2017-03-27 14:13:36 UTC
Permalink
Post by Sam Steingold
Post by Jean Louis
module 'syscalls' requires package OS
in other program.
Please create a small isolated reproducible test case.
I guess I know what happened. In SLIME I am using "lisp" memory image
which has some .clisprc and other configuration inside, so that it
loads faster. That is because (ql:quickload takes time.

then I was using within the Emacs:

;; (saveinit "image"... line, and that image would always show the
above problem.

When I used it with
clisp -q -norce -i file.lisp

and then in REPL created memory image, there was no problem.


The reason I need memory image is not for that pipe org2html, but to
upload the CGI to server. I was convinced I can just make lisp image,
and upload.

Yet on server there is no library libncursesw with appropriate
version, there is older one.

So I think I must upload all the lisp files to server first, and make
memory image on server directly.

It is impossible to just make one image that it works on other
computer, right?

I will try with the .fas file instead.

Jean
Sam Steingold
2017-03-27 15:09:17 UTC
Permalink
Post by Jean Louis
So I think I must upload all the lisp files to server first, and make
memory image on server directly.
there is no reason to create an image.
you can use scripting, see below.
Post by Jean Louis
It is impossible to just make one image that it works on other
computer, right?
see http://www.clisp.org/impnotes/image.html,
especially the portability section.
Post by Jean Louis
I will try with the .fas file instead.
see http://www.clisp.org/impnotes/quickstart.html,
especially about concatenating fas files.
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net https://jihadwatch.org
http://www.dhimmitude.org http://americancensorship.org http://no2bds.org
usually: can't pay ==> don't buy. software: can't buy ==> don't pay
Jean Louis
2017-03-27 15:30:37 UTC
Permalink
Post by Sam Steingold
see http://www.clisp.org/impnotes/image.html,
especially the portability section.
Post by Jean Louis
I will try with the .fas file instead.
see http://www.clisp.org/impnotes/quickstart.html,
especially about concatenating fas files.
I have tried .FAS execution and memory image, and image is so much
faster. For this CGI one I will try to make it on server.

Thank you.

Jean

J***@t-systems.com
2017-03-27 14:00:26 UTC
Permalink
Hi,
Post by Jean Louis
Here is the program
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file)) (load >"/home/data1/protected/Programming/git/RCDBusiness/lib/lisp/streamtools.lisp")
So you only show us a snippet, not the whole thing.
Are you sure streamtools does nothing weird?
What does your slurp-stream-io-command do?
Post by Jean Louis
If I make memory image with this one, it is heating the CPU, and I get stack overflow.
That happens for example if you close *standard-input*, as
Post by Jean Louis
... (with-open-stream (str *standard-input*)
After researching the bug 695, I could not find pointers
The work-around suggests wrapping the code using EXIT-ON-ERROR. Try it out.
... :init-function '(lambda() (exit-on-error (main))) ...

Of course, EXIT-ON-ERROR might not help against errors such as the above closing of *standard-input*.

You are asking for help, but there's still something you can do yourself:
Try and narrow down the bug. What if you eliminate parts of your program, e.g.
a) Replace input with a fixed three-liner?
(let ((input '("* Demo" "**Chapter 1"))) ...
b) Replace the call to Emacs with a no-op?
(tmp-md will re-use a previous file named /run/shm/rcd-wrs-XXXXXX.md)
c) Don't call (slurp-stream-io-command "/usr/bin/discount_markdown -F 0x4" output)?
d) Various combinations of the above?

Regards,
Jörg Höhle
Jean Louis
2017-03-27 14:07:14 UTC
Permalink
Post by J***@t-systems.com
Are you sure streamtools does nothing weird?
What does your slurp-stream-io-command do?
(defun slurp-stream-io-command (command string)
"Returns the output of a command to which string has been fed, very
usable for markdown, emacs Org mode processing and similar"
(let* ((stream (make-pipe-io-stream command :external-format "utf-8"))
(in (two-way-stream-input-stream stream))
(out (two-way-stream-output-stream stream))
(result ""))
(princ string out)
(finish-output out)
(close out)
(setf result (format nil "~{~a~^~%~}" (reverse
(let ((my-in '()))
(with-open-stream (str in)
(loop :for line = (read-line str nil nil)
:while line
:do (push line my-in)))
my-in))))
(finish-output in)
(close in)
result))

I think the above is too complicated, yet it is working.
Post by J***@t-systems.com
Try and narrow down the bug. What if you eliminate parts of your program, e.g.
It is working now, I don't get stack overflow. Thank you. Yet,
whatever bug is there, maybe, I don't even know.
Post by J***@t-systems.com
a) Replace input with a fixed three-liner?
(let ((input '("* Demo" "**Chapter 1"))) ...
b) Replace the call to Emacs with a no-op?
(tmp-md will re-use a previous file named /run/shm/rcd-wrs-XXXXXX.md)
c) Don't call (slurp-stream-io-command "/usr/bin/discount_markdown -F 0x4" output)?
d) Various combinations of the above?
Thank you much.

Yes, of course I first tested without anything.

The stack overflow happened on reading of standard input, and now I
cannot repeat it. Yet now it works this way:

(defparameter memdir "/run/shm/")
(defparameter tmp-file "rcd-wrs-XXXXXX")
(defparameter tmp-org (format nil "~a~a.org" memdir tmp-file))
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file))
(load "/home/data1/protected/Programming/git/RCDBusiness/lib/lisp/streamtools.lisp")
;; (require "syscalls")

(defun main ()
(let ((input '())
(output '()))
(with-open-file (out tmp-org :direction :output :external-format "utf-8")
(loop for line = (read-line *standard-input* nil nil)
while line do
(write-line line out)))
(shell (format nil "emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el \"~a\" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
(setf output
(with-open-file (stream tmp-md :direction :input :external-format "utf-8")
(loop for line = (read-line stream nil nil)
while line collect line)))
(setf output (format nil "~{~a~^~%~}" output))
(setf output (slurp-stream-io-command "/usr/bin/discount_markdown -F 0x4" output))
(princ output))
(exit))

;; ;; (saveinitmem "org2html" :quiet t :init-function 'main :verbose nil :norc t :documentation "Converts Org standard input into markdown" :executable t)

;; (main)

saveinitmem "org2html" :quiet t :init-function 'main :verbose nil :norc t :documentation "Converts Org standard input into markdown" :executable t)

Bytes permanently allocated: 165,312
Bytes currently in use: 3,515,616
Bytes available until next GC: 878,904
3515616 ;
878904 ;
165312 ;
1 ;
106864 ;
12000
[2]>
[~/bin/rcd]
admin-> ./org2html
#+TITLE: Something

* section
Some texxt

<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orge68b214">1. section</a></li>
</ul>
</div>
</div>


<p><a id="orge68b214"></a></p>
<h1>section</h1>

<p>Some texxt</p>
Sam Steingold
2017-03-27 14:08:40 UTC
Permalink
Post by Jean Louis
Post by Sam Steingold
Post by Jean Louis
Now, the problem is that in this version it works if I launch it with
lisp (CLISP), yet if I launch it as saved memory image, I get stack
overflow with RESET. Do you know why the saved memory image is giving
me stack overflow?
I think I already said that this is a known bug
https://sourceforge.net/p/clisp/bugs/695/
with a known work-around (see the bug).
I am not sure if that is the same bug.
Great!
Please create a small isolated reproducible test case.

Thanks.
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://honestreporting.com
http://islamexposedonline.com http://jij.org http://think-israel.org
Any programming language is at its best before it is implemented and used.
Jean Louis
2017-03-27 14:21:18 UTC
Permalink
Post by Sam Steingold
Post by Jean Louis
Post by Sam Steingold
I think I already said that this is a known bug
https://sourceforge.net/p/clisp/bugs/695/
with a known work-around (see the bug).
I am not sure if that is the same bug.
Great!
Please create a small isolated reproducible test case.
This one here:

(defun main nil
(let* ((output '())
(input (with-open-stream (str *standard-input*)
(loop :for line = (read-line *standard-input* nil nil)
:while line
:do (push line output)))))
output))
;;(main)


That one works well as lisp.

And if I save memory image, and write two lines and press CTRL-D I get
following

*** - WRITE-CHAR on #<CLOSED IO SYNONYM-STREAM *TERMINAL-IO*> is illegal

*** - WRITE-CHAR on #<CLOSED IO SYNONYM-STREAM *TERMINAL-IO*> is illegal

*** - WRITE-CHAR on #<CLOSED IO SYNONYM-STREAM *TERMINAL-IO*> is illegal

*** - WRITE-CHAR on #<CLOSED IO SYNONYM-STREAM *TERMINAL-IO*> is illegal

*** - WRITE-CHAR on #<CLOSED IO SYNONYM-STREAM *TERMINAL-IO*> is illegal

forever



Jean
Sam Steingold
2017-03-27 15:01:43 UTC
Permalink
Post by Jean Louis
Post by Sam Steingold
Post by Jean Louis
Post by Sam Steingold
I think I already said that this is a known bug
https://sourceforge.net/p/clisp/bugs/695/
with a known work-around (see the bug).
I am not sure if that is the same bug.
Great!
Please create a small isolated reproducible test case.
(input (with-open-stream (str *standard-input*)
I told you that this use of with-open-stream makes no sense.
Joerg told you the same thing.
You just closed your *standard-input* and, of course, you are getting
Post by Jean Louis
*** - WRITE-CHAR on #<CLOSED IO SYNONYM-STREAM *TERMINAL-IO*> is illegal
Jean, this is _your_ error, not a CLISP bug.
You wrote invalid code and now you are being told that the code is
invalid for the 3rd time.

Recommended reading:
http://clisp.org/impnotes/streams-interactive.html#stream-stdio-init
http://clisp.org/impnotes/stream-eltype.html#bin-stdio
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://mideasttruth.com
http://camera.org http://no2bds.org http://honestreporting.com http://jij.org
If money were measured in piles, I would have had a pit of it.
Jean Louis
2017-03-27 15:14:35 UTC
Permalink
Post by Sam Steingold
Post by Jean Louis
Post by Sam Steingold
Post by Jean Louis
Post by Sam Steingold
I think I already said that this is a known bug
https://sourceforge.net/p/clisp/bugs/695/
with a known work-around (see the bug).
I am not sure if that is the same bug.
Great!
Please create a small isolated reproducible test case.
(input (with-open-stream (str *standard-input*)
I told you that this use of with-open-stream makes no sense.
Joerg told you the same thing.
You just closed your *standard-input* and, of course, you are getting
Post by Jean Louis
*** - WRITE-CHAR on #<CLOSED IO SYNONYM-STREAM *TERMINAL-IO*> is illegal
Jean, this is _your_ error, not a CLISP bug.
You wrote invalid code and now you are being told that the code is
invalid for the 3rd time.
Well yes, you are right, then we are just in time shift. As I already
debugged that one, and now got it working, you have seen also the
latest version.

Then again I received your request for isolated incident, and I was
thinking you are looking for something.

Anyway, thanks, and I got it working. Maybe list emails are not
passing through in time, I don't know.


Jean
Loading...