Re: docker for pil21

2024-01-26 Thread Dmitry Non
Heya!
Interestingly, I wrote a dockerfile for myself too at the end of Dec.My 
versions should be lighter due to the lack of build dependencies in the final 
image:

FROM alpine:3.19 AS build

RUN apk add --no-cache readline-dev libffi-dev libressl-dev binutils make clang 
llvm llvm-dev pkgconf
RUN sh -c ' \
wget https://software-lab.de/picoLisp-23.12.tgz; \
tar xfz picoLisp-23.12.tgz; \
cd pil21/src; \
make \
'

FROM alpine:3.19
RUN apk add --no-cache readline-dev libffi-dev libressl-dev
COPY --from=build /pil21 /usr/lib/picolisp

# RUN ln -s /pil21 /usr/lib/picolisp
RUN ln -s /usr/lib/picolisp/bin/picolisp /usr/bin
RUN ln -s /usr/lib/picolisp/bin/pil /usr/bin

ENTRYPOINT ["pil"]

It's availalbe at https://hub.docker.com/r/dmitrynon/picolisp
but I didn't intend it for public consumption so you're better off using your 
own dockerfile with some additions from mine

> On 24 Jan 2024, at 18:47, picolisp@software-lab.de wrote:
> 
> hi all,
> 
> I have created a docker file for pil21 you can play with.
> Comments are welcome.
> 
> https://git.envs.net/mpech/pil21-docker
> 
> (mike)
> 
> -- 
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



Re: Bye from forks sends signals?

2024-01-09 Thread Dmitry Non
Hey.

That's awesome. Thank you very much, Alex!

> On 6 Jan 2024, at 06:48, Alexander Burger  wrote:
> 
> Hi Dmitry,
> 
>> Is this newsletter alive?:)
> 
> Yes, just not so noisy :)
> 
> 
>> I'm playing around with `native` and ZeroMQ and found a curious behaviour.  
>> 
>>(unless (fork)
>>  (wait 2000)
>>  (bye))
>> 
>>(setq Context (native "libzmq.so" "zmq_ctx_new" 'P))
>>(setq ZMQ_REP 4)
>>(setq Socket (native "libzmq.so" "zmq_socket" 'P Context ZMQ_REP))
>>(native "libzmq.so" "zmq_bind" 'I Socket "tcp://*:")
>> 
>>(buf
>> Buffer 10
>> (prinl "Waiting for messages")
>> (when (= -1 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
>>   (prinl (pack "Error: " (errno)
> 
> This looks good.
> 
> 
>> The `errno` is 4 (which is signal interrupt as i understand).
> 
> Yes. EINTR is 4 on most systems. You can see it with
> 
>   : (sysdefs "errno")
>   -> EACCES
>   : EINTR
>   -> 4
> 
> or (vi "@lib/sysdefs").
> 
> 
>> My assumption here is that `bye` throws some signal? Why else would it affect
>> zeromq in the parent process?
>> Actually, while writing this I found out about SIGCHLD which is apparently
>> sent to parent on child's exit so I guess zmq_recv gets interrupted by that
>> for some reason?
> 
> Absolutely correct. The child sends a SIGCHLD signal, which must be handled or
> ignored.
> 
> I don't have libzmq at the moment and cannot test it, but I think it should be
> something like
> 
>   (while (lt0 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
>  (unless (== EINTR (errno))
> (quit (errno) "Signal") ) )
> 
> 
>> P.S. completely offtopic but since I'm here. I just noticed that semicolons
>> aren't treated as comments. Why?
> 
> Comments in PicoLisp are # or #{...}#.
> 
> 
>> Can it be enabled? Otherwise my Emacs' lisp-mode comment/uncomment function 
>> is
>> useless and no comment highlight either.
> 
> There is no built-in way to change it. There are some Emacs libs for PicoLisp,
> but I don't use Emacs and cannot be helpful here.
> 
> ☺/ A!ex
> 
> -- 
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Bye from forks sends signals?

2024-01-05 Thread Dmitry Non
Hey!

Is this newsletter alive?:)

Disclaimer: I'm not very familiar with system programming and POSIX


I'm playing around with `native` and ZeroMQ and found a curious behaviour.  

(unless (fork)
  (wait 2000)
  (bye))

(setq Context (native "libzmq.so" "zmq_ctx_new" 'P))
(setq ZMQ_REP 4)
(setq Socket (native "libzmq.so" "zmq_socket" 'P Context ZMQ_REP))
(native "libzmq.so" "zmq_bind" 'I Socket "tcp://*:")

(buf
 Buffer 10
 (prinl "Waiting for messages")
 (when (= -1 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
   (prinl (pack "Error: " (errno)


Basically, the main process sets up a server and waiting for a message and the 
child process simply waits for a bit and exits with `bye`.

The `errno` is 4 (which is signal interrupt as i understand).
The waiting in the child process is important because if it exits before zeromq 
code, everything's fine and the server is patiently waiting.

My assumption here is that `bye` throws some signal? Why else would it affect 
zeromq in the parent process?

Just looking for some explanation. Maybe even the proper way to resolve this.


Actually, while writing this I found out about SIGCHLD which is apparently sent 
to parent on child's exit so I guess zmq_recv gets interrupted by that for some 
reason? Weird. Can anyone confirm that's what I'm seeing?

P.S. completely offtopic but since I'm here. I just noticed that semicolons 
aren't treated as comments. Why? Can it be enabled? Otherwise my Emacs' 
lisp-mode comment/uncomment function is useless and no comment highlight either.


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Bye from forks sends signals?

2024-01-05 Thread Dmitry Non
Hey!

Is this newsletter alive?:)

Disclaimer: I'm not very familiar with system programming and POSIX


I'm playing around with `native` and ZeroMQ and found a curious behaviour.  

(unless (fork)
  (wait 2000)
  (bye))

(setq Context (native "libzmq.so" "zmq_ctx_new" 'P))
(setq ZMQ_REP 4)
(setq Socket (native "libzmq.so" "zmq_socket" 'P Context ZMQ_REP))
(native "libzmq.so" "zmq_bind" 'I Socket "tcp://*:")

(buf
 Buffer 10
 (prinl "Waiting for messages")
 (when (= -1 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
   (prinl (pack "Error: " (errno)


Basically, the main process sets up a server and waiting for a message and the 
child process simply waits for a bit and exits with `bye`.

The `errno` is 4 (which is signal interrupt as i understand).
The waiting in the child process is important because if it exits before zeromq 
code, everything's fine and the server is patiently waiting.

My assumption here is that `bye` throws some signal? Why else would it affect 
zeromq in the parent process?

Just looking for some explanation. Maybe even the proper way to resolve this.


Actually, while writing this I found out about SIGCHLD which is apparently sent 
to parent on child's exit so I guess zmq_recv gets interrupted by that for some 
reason? Weird. Can anyone confirm that's what I'm seeing?

P.S. completely offtopic but since I'm here. I just noticed that semicolons 
aren't treated as comments. Why? Can it be enabled? Otherwise my Emacs' 
lisp-mode comment/uncomment function is useless and no comment highlight either.


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Subscribe

2024-01-04 Thread Dmitry Non
Hello Dmitry Non  :-)
You are now subscribed


Hello world

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe