Re: [Chicken-users] pressed Ctrl-\ and got segmentation fault

2013-06-21 Thread Moritz Wilhelmy
Hello,

On Tue, Jun 18, 2013 at 09:36:43 +0200, Peter Bex wrote:
 On Tue, Jun 18, 2013 at 12:02:56AM -0500, Daniel Ajoy wrote:
  
  This is my .csirc
  
  (use readline irregex)
  (current-input-port (make-gnu-readline-port))
  (gnu-readline-parse-and-bind set editing-mode vi)
  (gnu-history-install-file-manager
   (string-append (or (get-environment-variable HOME) .) 
   /.chicken_history)
   )
  
  csi
  
  CHICKEN
  (c) 2008-2013, The Chicken Team
  (c) 2000-2007, Felix L. Winkelmann
  Version 4.8.0.3 (stability/4.8.0) (rev 091c3d9)
  windows-cygwin-x86 [ manyargs dload ptables ]
  compiled 2013-03-12 on aeryn.xorinia.dim (Darwin)
  
  I press Ctrl-\
  
  and I get
  
  #;1 ^\Segmentation fault (core dumped)
  
  why?
 
 Probably because readline is flaky.  Try with parley, which is
 more native and supports threading better anyway..

I can confirm that it happens without any readline-ish extensions (and in fact
no ~/.csirc at all). This chicken 4.7.0 is on FreeBSD/amd64 9.1-RELEASE.

It should be noted that ^\ sends SIGQUIT, similar to the way ^C sends SIGINT,
and in fact csi segfaults if I kill -QUIT it as well.


Best regards,

Moritz

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] pressed Ctrl-\ and got segmentation fault

2013-06-21 Thread Christian Kellermann
* Moritz Wilhelmy mw+chic...@wzff.de [130621 11:30]:
 Hello,
  
  Probably because readline is flaky.  Try with parley, which is
  more native and supports threading better anyway..
 
 I can confirm that it happens without any readline-ish extensions (and in fact
 no ~/.csirc at all). This chicken 4.7.0 is on FreeBSD/amd64 9.1-RELEASE.
 
 It should be noted that ^\ sends SIGQUIT, similar to the way ^C sends SIGINT,
 and in fact csi segfaults if I kill -QUIT it as well.

Good hint! I can confirm this with a master build on 64bit linux as well.
I will open up a bug.

Thanks,

Christian

-- 
In the world, there is nothing more submissive and weak than
water. Yet for attacking that which is hard and strong, nothing can
surpass it. --- Lao Tzu

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] pressed Ctrl-\ and got segmentation fault

2013-06-21 Thread Christian Kellermann
Hi Daniel and Moritz,

* Daniel Ajoy da.a...@gmail.com [130618 07:03]:
 
 I press Ctrl-\
 
 and I get
 
 #;1 ^\Segmentation fault (core dumped)
 
 why?

This looks like a bug, I have opened ticket 1018 for it. You can
see progress of that issue in the bugtracker at
https://bugs.call-cc.org/ticket/1018.

Thanks for your report!

Christian

-- 
In the world, there is nothing more submissive and weak than
water. Yet for attacking that which is hard and strong, nothing can
surpass it. --- Lao Tzu

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] pressed Ctrl-\ and got segmentation fault

2013-06-21 Thread Moritz Wilhelmy
Hello Daniel,

On Fri, Jun 21, 2013 at 10:54:53 +0200, Moritz Wilhelmy wrote:
 I can confirm that it happens without any readline-ish extensions (and in fact
 no ~/.csirc at all). This chicken 4.7.0 is on FreeBSD/amd64 9.1-RELEASE.
 
 It should be noted that ^\ sends SIGQUIT, similar to the way ^C sends SIGINT,
 and in fact csi segfaults if I kill -QUIT it as well.

I misread the problem as dumps core rather than segfaults.
Sorry for the confusion, it exits because of SIGQUIT for me, and dumps core. It
does however not exit because of SIGSEGV.

(It really shouldn't segfault. I'm guessing sjamaan is right and this is one of
the things from your csirc causing the invalid handling of ^\ and readline being
a likely cause.)


Best regards,

Moritz

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] pressed Ctrl-\ and got segmentation fault

2013-06-21 Thread John Cowan
Moritz Wilhelmy scripsit:

 I misread the problem as dumps core rather than segfaults.
 Sorry for the confusion, it exits because of SIGQUIT for me, and dumps
 core. It does however not exit because of SIGSEGV.

I can confirm that on 32-bit Linux.  On Cygwin, however, typing ^\ does
trigger a SIGSEGV with dumped core (except that it doesn't actually dump
core because the Windows kernel can't do that).  Both systems are running
version 4.8.2 (rev ea02c9a), and there is no .csirc file.  Readline is
not involved: the config line says manyargs dload ptables only.

-- 
A: Spiro conjectures Ex-Lax.  John Cowan
Q: What does Pat Nixon frost her cakes with?  co...@ccil.org
  --Jeopardy for generative semanticists  http://www.ccil.org/~cowan

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] how to declare foreign variably size structs?

2013-06-21 Thread db05

   

One possible solution read a whole object into predefined record

(define-record inotify wd mask cookie len name)

; this function make record and pass it into hepler function
(define (read-event fd)
 (c-read-event (make-inotify) fd))

; map inotify fields to record fields using lowlevel function
C_block_item
(define c-read-event
 (foreign-safe-lambda* void ((scheme-object res) (int
fd))
 "struct inotify_event* e;
 char buffer[sizeof(*e) + MAX_PATH];
 if (read(fd,buffer,sizeof(buffer))  0)
  C_return(C_SCHEME_FALSE);
 C_word* ptr = C_alloc(C_SIZEOF_STRING(e-len));
 C_block_item(res,1) = C_fix(e-wd);
 C_block_item(res,2) = C_fix(e-mask);
 C_block_item(res,3) = C_fix(e-cookie);
 C_block_item(res,4) = C_fix(e-len);
 C_block_item(res,5) =
C_string(ptr,e-name,numbytes);
 C_return(res);"))

this should work but i worry that uint32 didnt't fit into the fixnum (C_fix
stuff)

;; or something like this

(match (file-read fd 1000)
 ((data size)
  (make-inotify wd: (read-uint32 data)

 
 mask: (read-uint32 data)
 
 cookie: (read-uint32 data)
   
  len: (read-uint32 data)
   
  name: (read-string data


o_O


06/20/13 23:58:52, Geoffrey lordgeoff...@optusnet.com.au:

  

  
  
Hi I am trying to declare of variably sized c struct as a
  foreign declaration. 

The one i am after is:
struct inotify_event
{
  int wd;/* Watch descriptor. 
*/
  uint32_t mask;/* Watch mask.  */
  uint32_t cookie;/* Cookie to synchronize
two events.  */
  uint32_t len;/* Length (including
NULs) of name.  */
  char name __flexarr;/* Name.  */
};
Note that name field is variably sized. I believe in C you would allocate a
larger block of memory and then cast it to 
(inotify_event*). 
By the skills of copy and paste i can do fixed size,and i can do a blob.
But not a variable struct.
Some help would be appreciated.
Thanks

  
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users



___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users