From DKICK1 at motorola.com Tue Mar 9 17:48:29 2004 From: DKICK1 at motorola.com (Kick Damien-DKICK1) Date: Tue, 9 Mar 2004 11:48:29 -0600 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 Message-ID: <8F37768D4D9CD71192CF00065BF2598B076EA5D6@il27exm02.cig.mot.com> I have been using CMUCL to reimplement some functionality that one would find in Don Libes' Expect , using CL-PPCRE for the regular expression engine. Thank you all for providing this excellent library to the CL community. I've especially enjoyed being able to use a sexp notation for regexes. However, I think I've found a regexp that breaks CL-PPCRE. Perhaps I've given CL-PPCRE an ill formed regexp or corrupted the Lisp image with some bad code? I've tried to par down the code that caused my original problem, though I'm afraid it is not nearly as concise as it could be. Please feel free to yell at me if I should spend more time trimming the irrelevant code out of the example and I'll post a leaner version. Using CL-PPCRE 0.7.4 "out of the box", I was seeing my CMUCL process handling a SIGSEGV. Because of this, I recompiled the CL-PPCRE code after removing all of the "(declare (optimize speed ...))" statements. The following is an edited transcript (to remove machine address, logins (urk! not a word), and passwords) of the results of using the unoptimized CL-PPCRE (again, using the optimized CL-PPCRE was giving me a SIGSEGV at the same point of error). Please let me know what you think; i.e. is this a CL-PPCRE bug or have I done something wrong? % cmucl ; Loading #p".../.cmucl-init.sparcf". ;; Loading #p".../src/clocc-20040206/clocc.sparcf". ;; Loading #p".../src/clocc-20040206/src/defsystem-3.x/defsystem.sparcf". CMU Common Lisp 18e, running on gsdapp04 With core: .../sparc-sun-solaris2.6/lib/cmucl/lib/lisp.core Dumped on: Tue, 2003-04-08 13:23:10-05:00 on achat See for support information. Loaded subsystems: Python 1.1, target SPARCstation/Solaris 2 CLOS 18e (based on PCL September 16 92 PCL (f)) * (load "break-cl-ppcre") ; Loading #p".../lti/break-cl-ppcre.sparcf". Type-error in COMMON-LISP::PACKAGE-OR-LOSE: "CL-PPCRE" is not of type PACKAGE Restarts: 0: [CONTINUE] Make this package. 1: Return NIL from load of "break-cl-ppcre". 2: [ABORT ] Return to Top-Level. Debug (type H for help) (COMMON-LISP::PACKAGE-OR-LOSE "CL-PPCRE") Source: Error finding source: Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM: Source file no longer exists: target:code/package.lisp. 0] 0 T * (load "cl-ppcre-0.7.4/load") ; Loading #p".../lti/cl-ppcre-0.7.4/load.lisp". ;; Loading #p".../lti/cl-ppcre-0.7.4/packages.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/specials.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/util.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/errors.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/lexer.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/parser.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/regex-class.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/convert.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/optimize.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/closures.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/repetition-closures.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/scanner.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/api.sparcf". ;; Loading #p".../lti/cl-ppcre-0.7.4/ppcre-tests.sparcf". T * (load "break-cl-ppcre") ; Loading #p".../lti/break-cl-ppcre.sparcf". T * (setf break-cl-ppcre::*test-expect-login* #| ... |#) #| ... |# * (setf break-cl-ppcre::*test-expect-password* #| ... |#) #| ... |# * (break-cl-ppcre::test-telnet #| ... |#) Trying #| ... |#... Connected to #| ... |#. Escape character is '^]'. SunOS 5.6 login: #| ... |# Password: Last login: Fri Mar 5 04:44:33 from 10.17.193.24 Sun Microsystems Inc. SunOS 5.6 Generic August 1997 tekelec:[/tekelec/users/#| ... |#] 1 % ls SEdisplaylJ_1N_ log mgts_cit_csh auto.sh mgts.Xdefaults mgts_cit_env auto_datafiles.tar mgts.cshrc mgts_gsr6.tar datafile.6.0.1.0.4.tar mgts.login mgts_run datafiles mgts.profile mgts_umt_csh datafiles.bak mgts.xinitrc set_mgts_env install.errors mgts.xsession tekelec:[/tekelec/users/#| ... |#] 2 % T * (break-cl-ppcre::test-telnet #| ... |# :prompt break-cl-ppcre::+default-mgts-server-prompt--break-cl-ppcre+) Trying #| ... |#... Connected to #| ... |#. Escape character is '^]'. SunOS 5.6 login: #| ... |# Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER: -1 is not of type (MOD 536870911) Restarts: 0: [ABORT] Return to Top-Level. Debug (type H for help) ("DEFUN CREATE-BMH-MATCHER" -2) Source: ; File: .../lti/cl-ppcre-0.7.4/scanner.lisp (BMH-MATCHER-AUX) 0] (debugger) ; ; Warning: This function is undefined: ; DEBUGGER ; Error in KERNEL:%COERCE-TO-FUNCTION: the function DEBUGGER is undefined. Error flushed ... 0] (break) Break Restarts: 0: [CONTINUE] Return from BREAK. 1: [ABORT ] Return to debug level 1. 2: Return to Top-Level. Debug (type H for help) (DEBUG::DEBUG-EVAL-PRINT (BREAK)) Source: Error finding source: Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM: Source file no longer exists: target:code/debug.lisp. 0]] backtrace 0: (DEBUG::DEBUG-EVAL-PRINT (BREAK)) 1: (DEBUG::DEBUG-LOOP) 2: (DEBUG:INTERNAL-DEBUG) 3: (DEBUG::INVOKE-TTY-DEBUGGER #) 4: (DEBUG::REAL-INVOKE-DEBUGGER #) 5: (INVOKE-DEBUGGER #) 6: (ERROR TYPE-ERROR :FUNCTION-NAME "DEFUN CREATE-BMH-MATCHER" :DATUM ...) 7: (KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER "DEFUN CREATE-BMH-MATCHER" #.(SYSTEM:INT-SAP #x38000308) # (429 526)) 8: (KERNEL::INTERNAL-ERROR #.(SYSTEM:INT-SAP #xFFBEDEC0) #) 9: ("Foreign function call land") 10: ("DEFUN CREATE-BMH-MATCHER" -2) 11: ("DEFUN CREATE-SCANNER-AUX" " " 0 1) 12: ("DEFMETHOD EXPECT (FUNCTION STREAM)" # # # # ...) 13: (BREAK-CL-PPCRE::TEST-TELNET #| ... |# :LOGIN NIL :PASSWORD ...) 14: (INTERACTIVE-EVAL (BREAK-CL-PPCRE::TEST-TELNET #| ... |# :PROMPT BREAK-CL-PPCRE::+DEFAULT-MGTS-SERVER-PROMPT--BREAK-CL-PPCRE+)) 15: (COMMON-LISP::%TOP-LEVEL) 16: (COMMON-LISP::RESTART-LISP) 0]] (ext:quit) Password: % cat break-cl-ppcre.lisp (defpackage #:break-cl-ppcre (:use #:common-lisp #:extensions #:cl-ppcre)) (in-package #:break-cl-ppcre) ;; I believe that the following regular expression is causing CL-PPCRE ;; to choke. (defconstant +default-mgts-server-prompt--break-cl-ppcre+ `(:sequence #\Newline "tekelec:[" (:greedy-repetition 0 nil :everything) "] " (:greedy-repetition 1 nil :digit-class) " % " :end-anchor)) (defvar *test-expect-login* nil) (defvar *test-expect-password* nil) (declaim (inline string-cat)) (defun string-cat (&rest args) (apply #'concatenate 'string args)) (defmacro with-default-spawn ((default-spawn) &body code) `(flet ((expect (expected &optional (spawn ,default-spawn) &key (echo *standard-output*)) (expect expected spawn :echo echo)) (send (message &optional (spawn ,default-spawn)) (send message spawn))) (macrolet ((send1 (&rest message-parts) `(send* ,',default-spawn , at message-parts))) , at code))) (defmacro with-spawn-process ((id exec-name &optional exec-args &key without-default-spawn) &body code) (let ((exec-args-value (gensym "EXEC-ARGS-VALUE-"))) `(let* ((,exec-args-value ,exec-args) (,id (spawn ,exec-name ,exec-args-value))) (unwind-protect ,(if without-default-spawn `(progn , at code) `(with-default-spawn (,id) , at code)) (process-close ,id))))) (defmacro with-spawn-stream ((stream exec-name &optional exec-args &key without-default-spawn) &body code) (let ((exec-args-value (gensym "EXEC-ARGS-VALUE-")) (id (gensym "SPAWN-PROCESS-"))) `(let ((,exec-args-value ,exec-args)) (with-spawn-process (,id ,exec-name ,exec-args-value :without-default-spawn t) (let ((,stream (process-pty ,id))) ,(if without-default-spawn `(progn , at code) `(with-default-spawn (,stream) , at code))))))) (defgeneric expect (expected spawn &key echo) (:documentation "ARGS: EXPECTED SPAWN &KEY ECHO This is a CMU CL version of Don Libes' expect. EXPECTED is what one expects to find on SPAWN, created by the function SPAWN.")) (defgeneric send (message spawn) (:documentation "ARGS: MESSAGE SPAWN A CMU CL version of Don Libe's send. Send MESSAGE to SPAWN, created by the function SPAWN.")) (defun send* (spawn &rest messages) (send (apply #'concatenate 'string (mapcar #'string messages)) spawn)) (defun spawn (program &optional args) "ARGS: PROGRAM &OPTIONAL ARGS A CMU CL version of Don Libes' spawn. PROGRAM is the name of the program to be exec'd in a pseudo-terminal." (run-program program args :wait nil :pty t :input t :output t :error t)) (defmethod expect ((expected string) (spawn extensions::process) &key (echo *standard-output*) regexp case-insensitive-mode multi-line-mode single-line-mode extended-mode) (expect (create-scanner (if regexp expected (quote-meta-chars expected)) :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode) (process-pty spawn) :echo echo)) (defmethod expect ((expected string) (spawn stream) &key (echo *standard-output*) regexp case-insensitive-mode multi-line-mode single-line-mode extended-mode) (expect (create-scanner (if regexp expected (quote-meta-chars expected)) :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode) spawn :echo echo)) ;; expected is a parse-tree (defmethod expect ((expected t) (spawn extensions::process) &key (echo *standard-output*) case-insensitive-mode multi-line-mode single-line-mode extended-mode destructive) (expect (create-scanner expected :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode :destructive destructive) (process-pty spawn) :echo echo)) ;; expected is a parse-tree (defmethod expect ((expected t) (spawn stream) &key (echo *standard-output*) case-insensitive-mode multi-line-mode single-line-mode extended-mode destructive) (expect (create-scanner expected :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode :destructive destructive) spawn :echo echo)) ;; expected is a scanner (defmethod expect ((expected function) (spawn extensions::process) &key (echo *standard-output*)) (expect expected (process-pty spawn) :echo echo)) ;; expected is a scanner (defmethod expect ((expected function) (spawn stream) &key (echo *standard-output*)) (let ((buffer (make-array '(0) :element-type 'base-char :fill-pointer 0 :adjustable t))) (with-output-to-string (match buffer) (let ((io (make-echo-stream spawn (if echo (make-broadcast-stream match echo) match)))) ;; I know that this is going to be a horribly inefficient ;; algorithm; i.e. reading a single character at a time ;; and re-scanning the BUFFER every time a new character ;; is added. I'll work on fixing this later. For know, I ;; just want to get something working. -- Damien Kick (loop (read-char io) (multiple-value-bind (match-start match-end reg-starts reg-ends) (scan expected buffer) (when match-start (return (values buffer match-start match-end reg-starts reg-ends))))))))) (defmethod send ((message string) (spawn extensions::process)) (send message (process-pty spawn))) (defmethod send ((message string) (spawn stream)) (write-string message spawn) (force-output spawn) message) (defun test-telnet (address &key (login *test-expect-login*) (password *test-expect-password*) (prompt '(:sequence "tekelec:[" (:greedy-repetition 0 nil :everything) #\] (:greedy-repetition 1 nil #\Space) (:greedy-repetition 1 nil (:char-class (:range #\0 #\9))) (:greedy-repetition 1 nil #\Space) #\%))) (with-spawn-stream (stream "telnet" (list address)) (expect "login:") (send (string-cat (string login) (string #\Newline))) (expect "assword:") (send (string-cat (string password) (string #\Newline))) (expect prompt) (send (string-cat "ls" (string #\Newline))) (expect prompt) t)) % From edi at agharta.de Wed Mar 10 23:50:12 2004 From: edi at agharta.de (Edi Weitz) Date: Thu, 11 Mar 2004 00:50:12 +0100 Subject: [cl-ppcre-devel] Re: cl-ppcre question In-Reply-To: <4042BDDE.2030603@austin.rr.com> (Arthur Gold's message of "Sun, 29 Feb 2004 22:36:46 -0600") References: <4042BDDE.2030603@austin.rr.com> Message-ID: Hi Arthur! Sorry for the late reply, I was on vacation. On Sun, 29 Feb 2004 22:36:46 -0600, Arthur Gold wrote: > A quick question from and old (out of work) programmer who has > suddenly had a little Common Lisp work fall in his lap (yea!): I've > been starting to work with cl-ppcre for a project, and the following > result confuses me -- > > (ppcre::scan "(\w)*" "A_B_C") > > returns NIL > > Shouldn't "(\w)*" match any sequence of letters or underscores? > > Many thanks for your time. Try (PPCRE::SCAN "(\\w)*" "A_B_C") instead. The first backslash is necessary because of CL's string syntax, the second backslash is the one that's actually "sent" to CL-PPCRE. * (princ "\w") w "w" * (princ "\\w") \w "\\w" If you think you're using too much backslashes you might want to check CL-INTERPOL. Cheers, Edi. PS: Please use the CL-PPCRE mailing list if possible. From edi at agharta.de Thu Mar 11 09:39:32 2004 From: edi at agharta.de (Edi Weitz) Date: Thu, 11 Mar 2004 10:39:32 +0100 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 In-Reply-To: <8F37768D4D9CD71192CF00065BF2598B076EA5D6@il27exm02.cig.mot.com> (Kick Damien-DKICK's message of "Tue, 9 Mar 2004 11:48:29 -0600") References: <8F37768D4D9CD71192CF00065BF2598B076EA5D6@il27exm02.cig.mot.com> Message-ID: Hi Damien! Sorry for the late reply - I was on vacation. I didn't try your whole example but the regex that you mentioned seems to be OK to me. From your backtrace it looks like the error occurs when CL-PPCRE is trying to create the scanner (at the moment when it creates the Boyer-Moore matcher). Some ideas: 1. Your methods for the generic function EXPECT don't have congruent lambda lists: > ;; expected is a parse-tree > (defmethod expect ((expected t) (spawn stream) > &key (echo *standard-output*) > case-insensitive-mode > multi-line-mode > single-line-mode > extended-mode > destructive) > (expect (create-scanner expected > :case-insensitive-mode case-insensitive-mode > :multi-line-mode multi-line-mode > :single-line-mode single-line-mode > :extended-mode extended-mode > :destructive destructive) > spawn :echo echo)) > > ;; expected is a scanner > (defmethod expect ((expected function) (spawn extensions::process) > &key (echo *standard-output*)) > (expect expected (process-pty spawn) :echo echo)) This can lead to incosistent behaviour of all sorts, so you should change that first and see if it makes a difference. 2. If that doesn't help you might want to try the whole thing again with CL-PPCRE:*USE-BMH-MATCHERS* set to NIL globally. Do you still get an error? Is it different? 3. Your regular expression is constant and therefore may not be modified. However, it /will/ be modified if CL-PPCRE:CREATE-SCANNER is called with a true keyword argument for DESTRUCTIVE. This could happen due to the incongruent lambda lists mentioned above or due to a bug in CL-PPCRE. Try to make sure to always call CREATE-SCANNER with DESTRUCTIVE set to NIL or to always provide a fresh parse tree. Let me know if this helps or if you need further assistance with this problem. Thanks for your report, Edi. From DKICK1 at motorola.com Thu Mar 11 15:09:58 2004 From: DKICK1 at motorola.com (Kick Damien-DKICK1) Date: Thu, 11 Mar 2004 09:09:58 -0600 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 Message-ID: <8F37768D4D9CD71192CF00065BF2598B076EA5E6@il27exm02.cig.mot.com> Edi Weitz [edi at agharta.de] wrote: Thanks for the reply. I'll try the things you mentioned but I just wanted to get to one thing, first. > Some ideas: > > 1. Your methods for the generic function EXPECT don't have congruent > lambda lists: > > > ;; expected is a parse-tree > > (defmethod expect ((expected t) (spawn stream) > > &key (echo *standard-output*) > > case-insensitive-mode > > multi-line-mode > > single-line-mode > > extended-mode > > destructive) > > #| ... |#) > > > > ;; expected is a scanner > > (defmethod expect ((expected function) (spawn extensions::process) > > &key (echo *standard-output*)) > > #| ... |#) > > This can lead to incosistent behaviour of all sorts, so you should > change that first and see if it makes a difference. When you write that the lambda lists are not congruent, I assume you mean that they have different keywords and are, therefore, not congruent. Consider the CLHS section 7.6.4 : 4. If the generic function lambda list mentions &key, each method must accept all of the keyword names mentioned after &key, either by accepting them explicitly, by specifying &allow-other-keys, or by specifying &rest but not &key. Each method can accept additional keyword arguments of its own. [...] I believe that that all of the EXPECT methods are congruent by that definition. Or did you have something other than keyword argument equivalence in mind whne you wrote about the lambda lists not being congruent? From edi at agharta.de Thu Mar 11 15:34:29 2004 From: edi at agharta.de (Edi Weitz) Date: Thu, 11 Mar 2004 16:34:29 +0100 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 In-Reply-To: <8F37768D4D9CD71192CF00065BF2598B076EA5E6@il27exm02.cig.mot.com> (Kick Damien-DKICK's message of "Thu, 11 Mar 2004 09:09:58 -0600") References: <8F37768D4D9CD71192CF00065BF2598B076EA5E6@il27exm02.cig.mot.com> Message-ID: On Thu, 11 Mar 2004 09:09:58 -0600, Kick Damien-DKICK1 wrote: > When you write that the lambda lists are not congruent, I assume you > mean that they have different keywords and are, therefore, not > congruent. Yes, that was what I meant. > Consider the CLHS section 7.6.4 > > [...] > > I believe that that all of the EXPECT methods are congruent by that > definition. You're right. My fault, sorry. Cheers, Edi. From DKICK1 at motorola.com Thu Mar 11 19:23:57 2004 From: DKICK1 at motorola.com (Kick Damien-DKICK1) Date: Thu, 11 Mar 2004 13:23:57 -0600 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 Message-ID: <8F37768D4D9CD71192CF00065BF2598B076EA5ED@il27exm02.cig.mot.com> Edi Weitz [edi at agharta.de] wrote: > 2. If that doesn't help you might want to try the whole thing again > with CL-PPCRE:*USE-BMH-MATCHERS* set to NIL globally. Do you > still get an error? Is it different? I just tried and I got the same error. Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER: -2 is not of type (MOD 536870911) Restarts: 0: [ABORT] Return to Top-Level. Debug (type H for help) (SEARCH " % " " " :FROM-END NIL ...) Source: Error finding source: Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM: Source file no longer exists: target:code/seq.lisp. 0] cl-ppcre:*use-bmh-matchers* NIL 0] (break) Break Restarts: 0: [CONTINUE] Return from BREAK. 1: [ABORT ] Return to debug level 1. 2: Return to Top-Level. Debug (type H for help) (DEBUG::DEBUG-EVAL-PRINT (BREAK)) Source: Error finding source: Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM: Source file no longer exists: target:code/debug.lisp. 0]] backtrace 0: (DEBUG::DEBUG-EVAL-PRINT (BREAK)) 1: (DEBUG::DEBUG-LOOP) 2: (DEBUG:INTERNAL-DEBUG) 3: (DEBUG::INVOKE-TTY-DEBUGGER #) 4: (DEBUG::REAL-INVOKE-DEBUGGER #) 5: (INVOKE-DEBUGGER #) 6: (ERROR TYPE-ERROR :FUNCTION-NAME SEARCH :DATUM ...) 7: (KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER SEARCH #.(SYSTEM:INT-SAP #x38000308) # (269 526)) 8: (KERNEL::INTERNAL-ERROR #.(SYSTEM:INT-SAP #xFFBEDE78) #) 9: ("Foreign function call land") 10: (SEARCH " % " " " :FROM-END NIL ...) 11: ("DEFUN CREATE-SCANNER-AUX" #) 12: ("DEFMETHOD EXPECT (FUNCTION STREAM)" # # # # ...) 13: (TEST-TELNET-ARGSMMGTS5--CASE-2 "argsmmgts5" :LOGIN NIL :PASSWORD ...) 14: (INTERACTIVE-EVAL (TEST-TELNET-ARGSMMGTS5--CASE-2 "argsmmgts5" :PROMPT +DEFAULT-MGTS-SERVER-PROMPT--BREAK-CL-PPCRE+)) 15: (COMMON-LISP::%TOP-LEVEL) 16: (COMMON-LISP::RESTART-LISP) 0]] From edi at agharta.de Thu Mar 11 22:21:59 2004 From: edi at agharta.de (Edi Weitz) Date: Thu, 11 Mar 2004 23:21:59 +0100 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 In-Reply-To: <8F37768D4D9CD71192CF00065BF2598B076EA5ED@il27exm02.cig.mot.com> (Kick Damien-DKICK's message of "Thu, 11 Mar 2004 13:23:57 -0600") References: <8F37768D4D9CD71192CF00065BF2598B076EA5ED@il27exm02.cig.mot.com> Message-ID: So I've tried to reproduce the error you get and I didn't succeed. I've temporarily enabled telnet on a local Linux machine and set the bash PS1 prompt to be 'tekelec:[\w] \! % ' to be as close to your example as possible. The whole transcript is below with only the password removed. I had to change "Login" to "ogin" and "ls" to "ls --color=never" but everything else is unchanged. CL-PPCRE is 0.7.4 compiled without modifications, CMUCL is 18e on a Linux (SuSE 9.0) system. Hmmm..... Edi. edi at bird:/tmp > cat expect.lisp (defpackage #:break-cl-ppcre (:use #:common-lisp #:extensions #:cl-ppcre)) (in-package #:break-cl-ppcre) ;; I believe that the following regular expression is causing CL-PPCRE ;; to choke. (defconstant +default-mgts-server-prompt--break-cl-ppcre+ `(:sequence #\Newline "tekelec:[" (:greedy-repetition 0 nil :everything) "] " (:greedy-repetition 1 nil :digit-class) " % " :end-anchor)) (defvar *test-expect-login* nil) (defvar *test-expect-password* nil) (declaim (inline string-cat)) (defun string-cat (&rest args) (apply #'concatenate 'string args)) (defmacro with-default-spawn ((default-spawn) &body code) `(flet ((expect (expected &optional (spawn ,default-spawn) &key (echo *standard-output*)) (expect expected spawn :echo echo)) (send (message &optional (spawn ,default-spawn)) (send message spawn))) (macrolet ((send1 (&rest message-parts) `(send* ,',default-spawn , at message-parts))) , at code))) (defmacro with-spawn-process ((id exec-name &optional exec-args &key without-default-spawn) &body code) (let ((exec-args-value (gensym "EXEC-ARGS-VALUE-"))) `(let* ((,exec-args-value ,exec-args) (,id (spawn ,exec-name ,exec-args-value))) (unwind-protect ,(if without-default-spawn `(progn , at code) `(with-default-spawn (,id) , at code)) (process-close ,id))))) (defmacro with-spawn-stream ((stream exec-name &optional exec-args &key without-default-spawn) &body code) (let ((exec-args-value (gensym "EXEC-ARGS-VALUE-")) (id (gensym "SPAWN-PROCESS-"))) `(let ((,exec-args-value ,exec-args)) (with-spawn-process (,id ,exec-name ,exec-args-value :without-default-spawn t) (let ((,stream (process-pty ,id))) ,(if without-default-spawn `(progn , at code) `(with-default-spawn (,stream) , at code))))))) (defgeneric expect (expected spawn &key echo) (:documentation "ARGS: EXPECTED SPAWN &KEY ECHO This is a CMU CL version of Don Libes' expect. EXPECTED is what one expects to find on SPAWN, created by the function SPAWN.")) (defgeneric send (message spawn) (:documentation "ARGS: MESSAGE SPAWN A CMU CL version of Don Libe's send. Send MESSAGE to SPAWN, created by the function SPAWN.")) (defun send* (spawn &rest messages) (send (apply #'concatenate 'string (mapcar #'string messages)) spawn)) (defun spawn (program &optional args) "ARGS: PROGRAM &OPTIONAL ARGS A CMU CL version of Don Libes' spawn. PROGRAM is the name of the program to be exec'd in a pseudo-terminal." (run-program program args :wait nil :pty t :input t :output t :error t)) (defmethod expect ((expected string) (spawn extensions::process) &key (echo *standard-output*) regexp case-insensitive-mode multi-line-mode single-line-mode extended-mode) (expect (create-scanner (if regexp expected (quote-meta-chars expected)) :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode) (process-pty spawn) :echo echo)) (defmethod expect ((expected string) (spawn stream) &key (echo *standard-output*) regexp case-insensitive-mode multi-line-mode single-line-mode extended-mode) (expect (create-scanner (if regexp expected (quote-meta-chars expected)) :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode) spawn :echo echo)) ;; expected is a parse-tree (defmethod expect ((expected t) (spawn extensions::process) &key (echo *standard-output*) case-insensitive-mode multi-line-mode single-line-mode extended-mode destructive) (expect (create-scanner expected :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode :destructive destructive) (process-pty spawn) :echo echo)) ;; expected is a parse-tree (defmethod expect ((expected t) (spawn stream) &key (echo *standard-output*) case-insensitive-mode multi-line-mode single-line-mode extended-mode destructive) (expect (create-scanner expected :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode :destructive destructive) spawn :echo echo)) ;; expected is a scanner (defmethod expect ((expected function) (spawn extensions::process) &key (echo *standard-output*)) (expect expected (process-pty spawn) :echo echo)) ;; expected is a scanner (defmethod expect ((expected function) (spawn stream) &key (echo *standard-output*)) (let ((buffer (make-array '(0) :element-type 'base-char :fill-pointer 0 :adjustable t))) (with-output-to-string (match buffer) (let ((io (make-echo-stream spawn (if echo (make-broadcast-stream match echo) match)))) ;; I know that this is going to be a horribly inefficient ;; algorithm; i.e. reading a single character at a time ;; and re-scanning the BUFFER every time a new character ;; is added. I'll work on fixing this later. For know, I ;; just want to get something working. -- Damien Kick (loop (read-char io) (multiple-value-bind (match-start match-end reg-starts reg-ends) (scan expected buffer) (when match-start (return (values buffer match-start match-end reg-starts reg-ends))))))))) (defmethod send ((message string) (spawn extensions::process)) (send message (process-pty spawn))) (defmethod send ((message string) (spawn stream)) (write-string message spawn) (force-output spawn) message) (defun test-telnet (address &key (login *test-expect-login*) (password *test-expect-password*) (prompt '(:sequence "tekelec:[" (:greedy-repetition 0 nil :everything) #\] (:greedy-repetition 1 nil #\Space) (:greedy-repetition 1 nil (:char-class (:range #\0 #\9))) (:greedy-repetition 1 nil #\Space) #\%))) (with-spawn-stream (stream "telnet" (list address)) (expect "ogin:") (send (string-cat (string login) (string #\Newline))) (expect "assword:") (send (string-cat (string password) (string #\Newline))) (expect prompt) (send (string-cat "ls --color=never" (string #\Newline))) (expect prompt) t)) edi at bird:/tmp > cmucl ; Loading #p"/home/edi/.cmucl-init". ; loading system definition from /usr/local/lisp/Registry/asdf-install.asd into ; # ; registering # as ASDF-INSTALL CMU Common Lisp 18e, running on bird With core: /usr/local/lib/cmucl/lib/lisp.core Dumped on: Thu, 2003-04-03 15:47:12+02:00 on orion See for support information. Loaded subsystems: Python 1.1, target Intel x86 CLOS 18e (based on PCL September 16 92 PCL (f)) * (mk:load-system :cl-ppcre) ; Loading #p"/usr/local/lisp/source/cl-ppcre/packages.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/specials.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/util.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/errors.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/lexer.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/parser.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/regex-class.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/convert.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/optimize.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/closures.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/repetition-closures.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/scanner.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/api.x86f". (# # # # # # # # # # # # #) * (load (compile-file "expect.lisp")) ; Python version 1.1, VM version Intel x86 on 11 MAR 04 11:11:39 pm. ; Compiling: /tmp/expect.lisp 11 MAR 04 11:09:42 pm ; Byte Compiling Top-Level Form: ; Converted STRING-CAT. ; Compiling DEFUN STRING-CAT: ; Converted WITH-DEFAULT-SPAWN. ; Compiling DEFMACRO WITH-DEFAULT-SPAWN: ; Converted WITH-SPAWN-PROCESS. ; Compiling DEFMACRO WITH-SPAWN-PROCESS: ; Converted WITH-SPAWN-STREAM. ; Compiling DEFMACRO WITH-SPAWN-STREAM: ; Byte Compiling Top-Level Form: ; Converted SEND*. ; Compiling DEFUN SEND*: ; Converted SPAWN. ; Compiling DEFUN SPAWN: ; Compiling DEFMETHOD EXPECT (STRING EXTENSIONS::PROCESS): ; Compiling DEFMETHOD EXPECT (STRING STREAM): ; Compiling DEFMETHOD EXPECT (T EXTENSIONS::PROCESS): ; Byte Compiling Top-Level Form: ; Compiling DEFMETHOD EXPECT (T STREAM): ; Compiling DEFMETHOD EXPECT (FUNCTION EXTENSIONS::PROCESS): ; Compiling DEFMETHOD EXPECT (FUNCTION STREAM): ; Compiling DEFMETHOD SEND (STRING EXTENSIONS::PROCESS): ; Compiling DEFMETHOD SEND (STRING STREAM): ; Converted TEST-TELNET. ; Compiling DEFUN TEST-TELNET: ; Byte Compiling Top-Level Form: ; expect.x86f written. ; Compilation finished in 0:00:00. T * (in-package :break-cl-ppcre) # * (setf *test-expect-login* "edi") "edi" * (setf *test-expect-password* "********") "********" * (test-telnet "miles") Trying 62.159.208.81... Connected to miles. Escape character is '^]'. Welcome to SuSE Linux 7.1 (i386) - Kernel 2.4.0-4GB (5). miles login: edi Password: Last login: Thu Mar 11 23:09:28 from trane.agharta.de Have a lot of fun... tekelec:[/tmp/foo] 501 % ls --color=never 08_zappa.mp3 genera-handbook.pdf fpga-technology_charts.pdf my-exchange-file-changed-functions.el tekelec:[/tmp/foo] 502 % T * (test-telnet "miles" :prompt +default-mgts-server-prompt--break-cl-ppcre+) Trying 62.159.208.81... Connected to miles. Escape character is '^]'. Welcome to SuSE Linux 7.1 (i386) - Kernel 2.4.0-4GB (5). miles login: edi Password: Last login: Thu Mar 11 23:12:44 from trane.agharta.de Have a lot of fun... tekelec:[/tmp/foo] 501 % ls --color=never 08_zappa.mp3 genera-handbook.pdf fpga-technology_charts.pdf my-exchange-file-changed-functions.el tekelec:[/tmp/foo] 501 % T * (quit) edi at bird:/tmp > From edi at agharta.de Thu Mar 11 22:29:55 2004 From: edi at agharta.de (Edi Weitz) Date: Thu, 11 Mar 2004 23:29:55 +0100 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 In-Reply-To: <8F37768D4D9CD71192CF00065BF2598B076EA5ED@il27exm02.cig.mot.com> (Kick Damien-DKICK's message of "Thu, 11 Mar 2004 13:23:57 -0600") References: <8F37768D4D9CD71192CF00065BF2598B076EA5ED@il27exm02.cig.mot.com> Message-ID: I forgot two things: 1. Maybe this is an error that can only be seen on Sun OS. I don't have a Sun to test so you might want to use an x86 machine as your client if possible and see if it exposes the same problem. 2. You wrote: > I just tried and I got the same error. Well, not exactly the same error, but close. Maybe you could try again with CL-PPCRE:*USE-BMH-MATCHERS* set to T and TRACE the CL-PPCRE::CREATE-BMH-MATCHER function to see which arguments it gets? Sorry for not being more helpful. I currently have no idea what happens. Cheers, Edi. From DKICK1 at motorola.com Thu Mar 11 22:28:05 2004 From: DKICK1 at motorola.com (Kick Damien-DKICK1) Date: Thu, 11 Mar 2004 16:28:05 -0600 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 Message-ID: <8F37768D4D9CD71192CF00065BF2598B076EA5F0@il27exm02.cig.mot.com> Well, if all of the optimizations are still on, I don't see the SIGSEGV on the first try. It doesn't come until later, after trying a run a few times. If I recompile CL-PPCRE 0.7.4 with all the optimizations off, the type checking kicks into ERROR on the first try. -----Original Message----- From: cl-ppcre-devel-bounces at common-lisp.net [mailto:cl-ppcre-devel-bounces at common-lisp.net] On Behalf Of Edi Weitz Sent: Thursday, 11 March, 2004 16:22 To: Kick Damien-DKICK1 Cc: cl-ppcre-devel at common-lisp.net Subject: Re: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 So I've tried to reproduce the error you get and I didn't succeed. I've temporarily enabled telnet on a local Linux machine and set the bash PS1 prompt to be 'tekelec:[\w] \! % ' to be as close to your example as possible. The whole transcript is below with only the password removed. I had to change "Login" to "ogin" and "ls" to "ls --color=never" but everything else is unchanged. CL-PPCRE is 0.7.4 compiled without modifications, CMUCL is 18e on a Linux (SuSE 9.0) system. Hmmm..... Edi. edi at bird:/tmp > cat expect.lisp (defpackage #:break-cl-ppcre (:use #:common-lisp #:extensions #:cl-ppcre)) (in-package #:break-cl-ppcre) ;; I believe that the following regular expression is causing CL-PPCRE ;; to choke. (defconstant +default-mgts-server-prompt--break-cl-ppcre+ `(:sequence #\Newline "tekelec:[" (:greedy-repetition 0 nil :everything) "] " (:greedy-repetition 1 nil :digit-class) " % " :end-anchor)) (defvar *test-expect-login* nil) (defvar *test-expect-password* nil) (declaim (inline string-cat)) (defun string-cat (&rest args) (apply #'concatenate 'string args)) (defmacro with-default-spawn ((default-spawn) &body code) `(flet ((expect (expected &optional (spawn ,default-spawn) &key (echo *standard-output*)) (expect expected spawn :echo echo)) (send (message &optional (spawn ,default-spawn)) (send message spawn))) (macrolet ((send1 (&rest message-parts) `(send* ,',default-spawn , at message-parts))) , at code))) (defmacro with-spawn-process ((id exec-name &optional exec-args &key without-default-spawn) &body code) (let ((exec-args-value (gensym "EXEC-ARGS-VALUE-"))) `(let* ((,exec-args-value ,exec-args) (,id (spawn ,exec-name ,exec-args-value))) (unwind-protect ,(if without-default-spawn `(progn , at code) `(with-default-spawn (,id) , at code)) (process-close ,id))))) (defmacro with-spawn-stream ((stream exec-name &optional exec-args &key without-default-spawn) &body code) (let ((exec-args-value (gensym "EXEC-ARGS-VALUE-")) (id (gensym "SPAWN-PROCESS-"))) `(let ((,exec-args-value ,exec-args)) (with-spawn-process (,id ,exec-name ,exec-args-value :without-default-spawn t) (let ((,stream (process-pty ,id))) ,(if without-default-spawn `(progn , at code) `(with-default-spawn (,stream) , at code))))))) (defgeneric expect (expected spawn &key echo) (:documentation "ARGS: EXPECTED SPAWN &KEY ECHO This is a CMU CL version of Don Libes' expect. EXPECTED is what one expects to find on SPAWN, created by the function SPAWN.")) (defgeneric send (message spawn) (:documentation "ARGS: MESSAGE SPAWN A CMU CL version of Don Libe's send. Send MESSAGE to SPAWN, created by the function SPAWN.")) (defun send* (spawn &rest messages) (send (apply #'concatenate 'string (mapcar #'string messages)) spawn)) (defun spawn (program &optional args) "ARGS: PROGRAM &OPTIONAL ARGS A CMU CL version of Don Libes' spawn. PROGRAM is the name of the program to be exec'd in a pseudo-terminal." (run-program program args :wait nil :pty t :input t :output t :error t)) (defmethod expect ((expected string) (spawn extensions::process) &key (echo *standard-output*) regexp case-insensitive-mode multi-line-mode single-line-mode extended-mode) (expect (create-scanner (if regexp expected (quote-meta-chars expected)) :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode) (process-pty spawn) :echo echo)) (defmethod expect ((expected string) (spawn stream) &key (echo *standard-output*) regexp case-insensitive-mode multi-line-mode single-line-mode extended-mode) (expect (create-scanner (if regexp expected (quote-meta-chars expected)) :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode) spawn :echo echo)) ;; expected is a parse-tree (defmethod expect ((expected t) (spawn extensions::process) &key (echo *standard-output*) case-insensitive-mode multi-line-mode single-line-mode extended-mode destructive) (expect (create-scanner expected :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode :destructive destructive) (process-pty spawn) :echo echo)) ;; expected is a parse-tree (defmethod expect ((expected t) (spawn stream) &key (echo *standard-output*) case-insensitive-mode multi-line-mode single-line-mode extended-mode destructive) (expect (create-scanner expected :case-insensitive-mode case-insensitive-mode :multi-line-mode multi-line-mode :single-line-mode single-line-mode :extended-mode extended-mode :destructive destructive) spawn :echo echo)) ;; expected is a scanner (defmethod expect ((expected function) (spawn extensions::process) &key (echo *standard-output*)) (expect expected (process-pty spawn) :echo echo)) ;; expected is a scanner (defmethod expect ((expected function) (spawn stream) &key (echo *standard-output*)) (let ((buffer (make-array '(0) :element-type 'base-char :fill-pointer 0 :adjustable t))) (with-output-to-string (match buffer) (let ((io (make-echo-stream spawn (if echo (make-broadcast-stream match echo) match)))) ;; I know that this is going to be a horribly inefficient ;; algorithm; i.e. reading a single character at a time ;; and re-scanning the BUFFER every time a new character ;; is added. I'll work on fixing this later. For know, I ;; just want to get something working. -- Damien Kick (loop (read-char io) (multiple-value-bind (match-start match-end reg-starts reg-ends) (scan expected buffer) (when match-start (return (values buffer match-start match-end reg-starts reg-ends))))))))) (defmethod send ((message string) (spawn extensions::process)) (send message (process-pty spawn))) (defmethod send ((message string) (spawn stream)) (write-string message spawn) (force-output spawn) message) (defun test-telnet (address &key (login *test-expect-login*) (password *test-expect-password*) (prompt '(:sequence "tekelec:[" (:greedy-repetition 0 nil :everything) #\] (:greedy-repetition 1 nil #\Space) (:greedy-repetition 1 nil (:char-class (:range #\0 #\9))) (:greedy-repetition 1 nil #\Space) #\%))) (with-spawn-stream (stream "telnet" (list address)) (expect "ogin:") (send (string-cat (string login) (string #\Newline))) (expect "assword:") (send (string-cat (string password) (string #\Newline))) (expect prompt) (send (string-cat "ls --color=never" (string #\Newline))) (expect prompt) t)) edi at bird:/tmp > cmucl ; Loading #p"/home/edi/.cmucl-init". ; loading system definition from /usr/local/lisp/Registry/asdf-install.asd into ; # ; registering # as ASDF-INSTALL CMU Common Lisp 18e, running on bird With core: /usr/local/lib/cmucl/lib/lisp.core Dumped on: Thu, 2003-04-03 15:47:12+02:00 on orion See for support information. Loaded subsystems: Python 1.1, target Intel x86 CLOS 18e (based on PCL September 16 92 PCL (f)) * (mk:load-system :cl-ppcre) ; Loading #p"/usr/local/lisp/source/cl-ppcre/packages.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/specials.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/util.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/errors.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/lexer.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/parser.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/regex-class.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/convert.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/optimize.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/closures.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/repetition-closures.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/scanner.x86f". ; Loading #p"/usr/local/lisp/source/cl-ppcre/api.x86f". (# # # # # # # # # # # # #) * (load (compile-file "expect.lisp")) ; Python version 1.1, VM version Intel x86 on 11 MAR 04 11:11:39 pm. ; Compiling: /tmp/expect.lisp 11 MAR 04 11:09:42 pm ; Byte Compiling Top-Level Form: ; Converted STRING-CAT. ; Compiling DEFUN STRING-CAT: ; Converted WITH-DEFAULT-SPAWN. ; Compiling DEFMACRO WITH-DEFAULT-SPAWN: ; Converted WITH-SPAWN-PROCESS. ; Compiling DEFMACRO WITH-SPAWN-PROCESS: ; Converted WITH-SPAWN-STREAM. ; Compiling DEFMACRO WITH-SPAWN-STREAM: ; Byte Compiling Top-Level Form: ; Converted SEND*. ; Compiling DEFUN SEND*: ; Converted SPAWN. ; Compiling DEFUN SPAWN: ; Compiling DEFMETHOD EXPECT (STRING EXTENSIONS::PROCESS): ; Compiling DEFMETHOD EXPECT (STRING STREAM): ; Compiling DEFMETHOD EXPECT (T EXTENSIONS::PROCESS): ; Byte Compiling Top-Level Form: ; Compiling DEFMETHOD EXPECT (T STREAM): ; Compiling DEFMETHOD EXPECT (FUNCTION EXTENSIONS::PROCESS): ; Compiling DEFMETHOD EXPECT (FUNCTION STREAM): ; Compiling DEFMETHOD SEND (STRING EXTENSIONS::PROCESS): ; Compiling DEFMETHOD SEND (STRING STREAM): ; Converted TEST-TELNET. ; Compiling DEFUN TEST-TELNET: ; Byte Compiling Top-Level Form: ; expect.x86f written. ; Compilation finished in 0:00:00. T * (in-package :break-cl-ppcre) # * (setf *test-expect-login* "edi") "edi" * (setf *test-expect-password* "********") "********" * (test-telnet "miles") Trying 62.159.208.81... Connected to miles. Escape character is '^]'. Welcome to SuSE Linux 7.1 (i386) - Kernel 2.4.0-4GB (5). miles login: edi Password: Last login: Thu Mar 11 23:09:28 from trane.agharta.de Have a lot of fun... tekelec:[/tmp/foo] 501 % ls --color=never 08_zappa.mp3 genera-handbook.pdf fpga-technology_charts.pdf my-exchange-file-changed-functions.el tekelec:[/tmp/foo] 502 % T * (test-telnet "miles" :prompt +default-mgts-server-prompt--break-cl-ppcre+) Trying 62.159.208.81... Connected to miles. Escape character is '^]'. Welcome to SuSE Linux 7.1 (i386) - Kernel 2.4.0-4GB (5). miles login: edi Password: Last login: Thu Mar 11 23:12:44 from trane.agharta.de Have a lot of fun... tekelec:[/tmp/foo] 501 % ls --color=never 08_zappa.mp3 genera-handbook.pdf fpga-technology_charts.pdf my-exchange-file-changed-functions.el tekelec:[/tmp/foo] 501 % T * (quit) edi at bird:/tmp > _______________________________________________ cl-ppcre-devel site list cl-ppcre-devel at common-lisp.net http://common-lisp.net/mailman/listinfo/cl-ppcre-devel From edi at agharta.de Thu Mar 11 22:36:15 2004 From: edi at agharta.de (Edi Weitz) Date: Thu, 11 Mar 2004 23:36:15 +0100 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 In-Reply-To: <8F37768D4D9CD71192CF00065BF2598B076EA5F0@il27exm02.cig.mot.com> (Kick Damien-DKICK's message of "Thu, 11 Mar 2004 16:28:05 -0600") References: <8F37768D4D9CD71192CF00065BF2598B076EA5F0@il27exm02.cig.mot.com> Message-ID: On Thu, 11 Mar 2004 16:28:05 -0600, Kick Damien-DKICK1 wrote: > Well, if all of the optimizations are still on, I don't see the > SIGSEGV on the first try. It doesn't come until later, after trying > a run a few times. OK, good data point. But still no luck. Just tried it again. I've called TEST-TELNET about a dozen times manually then 200 times from a DOTIMES loop. It always worked as expected. From DKICK1 at motorola.com Fri Mar 12 04:01:59 2004 From: DKICK1 at motorola.com (Kick Damien-DKICK1) Date: Thu, 11 Mar 2004 22:01:59 -0600 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 Message-ID: <8F37768D4D9CD71192CF00065BF2598B076EA5F1@il27exm02.cig.mot.com> Edi Weitz [edi at agharta.de] wrote: > 1. Maybe this is an error that can only be seen on Sun OS. I don't > have a Sun to test so you might want to use an x86 machine as > your client if possible and see if it exposes the same problem. That will take a bit longer but I think I should be able to find a GNU/Linux box on an x86. I'll have to start from installing CMUCL, etc. I'll let you know how things go... > Well, not exactly the same error, but close. Maybe you could try > again with CL-PPCRE:*USE-BMH-MATCHERS* set to T and TRACE the > CL-PPCRE::CREATE-BMH-MATCHER function to see which arguments it > gets? * (in-package #:break-cl-ppcre) # * (setf *test-expect-login* (setf *test-expect-password* #| ... |#)) #| ... |# * cl-ppcre:*use-bmh-matchers* T * (trace CL-PPCRE::CREATE-BMH-MATCHER) (CL-PPCRE::CREATE-BMH-MATCHER) * (test-telnet #| ... |#) 0: (CL-PPCRE::CREATE-BMH-MATCHER "login:" NIL) 0: CL-PPCRE::CREATE-BMH-MATCHER returned # Trying #| ... |#... Connected to #| ... |#. Escape character is '^]'. SunOS 5.6 login: 0: (CL-PPCRE::CREATE-BMH-MATCHER "assword:" NIL) 0: CL-PPCRE::CREATE-BMH-MATCHER returned # #| ... |# Password: 0: (CL-PPCRE::CREATE-BMH-MATCHER "tekelec:[" NIL) 0: CL-PPCRE::CREATE-BMH-MATCHER returned # Last login: Thu Mar 11 21:20:26 from 10.17.193.24 Sun Microsystems Inc. SunOS 5.6 Generic August 1997 tekelec:[/tekelec/users/#| ... |#] 1 % 0: (CL-PPCRE::CREATE-BMH-MATCHER "tekelec:[" NIL) 0: CL-PPCRE::CREATE-BMH-MATCHER returned # ls SEdisplaylJ_1N_ log mgts_cit_csh auto.sh mgts.Xdefaults mgts_cit_env auto_datafiles.tar mgts.cshrc mgts_gsr6.tar datafile.6.0.1.0.4.tar mgts.login mgts_run datafiles mgts.profile mgts_umt_csh datafiles.bak mgts.xinitrc set_mgts_env install.errors mgts.xsession tekelec:[/tekelec/users/#| ... |#] 2 % T * (test-telnet #| ... |# :prompt +default-mgts-server-prompt--break-cl-ppcre+) 0: (CL-PPCRE::CREATE-BMH-MATCHER "login:" NIL) 0: CL-PPCRE::CREATE-BMH-MATCHER returned # Trying #| ... |#... Connected to #| ... |#. Escape character is '^]'. SunOS 5.6 login: 0: (CL-PPCRE::CREATE-BMH-MATCHER "assword:" NIL) 0: CL-PPCRE::CREATE-BMH-MATCHER returned # #| ... |# Password: 0: (CL-PPCRE::CREATE-BMH-MATCHER " % " NIL) 0: CL-PPCRE::CREATE-BMH-MATCHER returned # 0: (CL-PPCRE::CREATE-BMH-MATCHER " tekelec:[" NIL) 0: CL-PPCRE::CREATE-BMH-MATCHER returned # Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER: -1 is not of type (MOD 536870911) Restarts: 0: [ABORT] Return to Top-Level. Debug (type H for help) ("DEFUN CREATE-BMH-MATCHER" -2) Source: ; File: /usr/vob/2gtt/lti/cl-ppcre-0.7.4/scanner.lisp (AREF SKIP (CHAR-CODE (SCHAR PATTERN K))) 0] From edi at agharta.de Fri Mar 12 08:54:52 2004 From: edi at agharta.de (Edi Weitz) Date: Fri, 12 Mar 2004 09:54:52 +0100 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 In-Reply-To: <8F37768D4D9CD71192CF00065BF2598B076EA5F1@il27exm02.cig.mot.com> (Kick Damien-DKICK's message of "Thu, 11 Mar 2004 22:01:59 -0600") References: <8F37768D4D9CD71192CF00065BF2598B076EA5F1@il27exm02.cig.mot.com> Message-ID: OK, what you've sent so far looks OK. Could you now please add the following code, try again, and show me the output (you can of course leave out the login/password stuff as long as it doesn't cause the error)? 1. In your EXPECT function between (READ-CHAR IO) and (MULTIPLE-VALUE-BIND ...) add (print (list 'expect expected buffer (type-of expected) (type-of buffer))) 2. In BMH-MATCHER-AUX in scanner.lisp (from CL-PPCRE) after the line `(LAMBDA (START-POS) remove the declaration and replace it with (print (list 'bmh start-pos *end-pos* *string* pattern (type-of *string*) (type-of pattern))) Let's see what we get... Thanks, Edi. From DKICK1 at motorola.com Wed Mar 17 20:18:15 2004 From: DKICK1 at motorola.com (Kick Damien-DKICK1) Date: Wed, 17 Mar 2004 14:18:15 -0600 Subject: [cl-ppcre-devel] Problems with a regexp using CL-PPCRE 0.7.4 Message-ID: <8F37768D4D9CD71192CF00065BF2598B076EA603@il27exm02.cig.mot.com> Sorry I've been away for a bit... between my sister-in-law's wedding last weekend, an aikido seminar this coming weekend, and work, I haven't had any time to spare for CL-PPCRE. I probably won't be able to get to this until sometime next week/weekend but I haven't forgotten about it.