From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA08072; Tue, 17 Aug 2004 21:52:14 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA08015 for ; Tue, 17 Aug 2004 21:52:13 +0200 (MET DST) Received: from annexia.force9.co.uk (annexia.force9.co.uk [212.56.101.183]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i7HJqCRM027612 for ; Tue, 17 Aug 2004 21:52:12 +0200 Received: from rich by annexia.force9.co.uk with local (Exim 3.36 #1 (Debian)) id 1BxA0C-0004MJ-00 for ; Tue, 17 Aug 2004 20:52:12 +0100 Date: Tue, 17 Aug 2004 20:52:12 +0100 To: caml-list@inria.fr Subject: [Caml-list] ocaml 3.08: camlp4 corrupts Pcre module strings (?) Message-ID: <20040817195212.GA16691@annexia.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Jones X-Miltered: at concorde with ID 412261EC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; camlp:01 pcre:01 ocamlc:01 pcre:01 ocamlc:01 -pp:01 camlp:01 flags:01 2004:99 prerr:01 endline:01 ltd:98 regexp:01 ocaml:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk This is with OCaml 3.08 from Debian ... $ ocamlc -I +pcre pcre.cma test.ml -o test $ ./test num of subs = 11 $ ocamlc -pp "camlp4o" -I +pcre pcre.cma test.ml -o test $ ./test num of subs = 2 (Note that num of subs is different in the two cases). The file 'test.ml' is attached below. This is actually causes a major problem with our live servers at the moment, and I've no idea exactly what the cause is. Rich. ---------------------------------------------------------------------- let line_re = Pcre.regexp ~flags:[`EXTENDED] " ^ (\\d+\\.\\d+\\.\\d+\\.\\d+) # Inet addr. \\s ([-\\w]+) # Identd username. \\s ([-\\w]+) # Auth username. \\s \\[(.*?)\\] # Date (we parse this separately). \\s \"(.*?)\" # Query. \\s (-|\\d+) # Result code. \\s (-|\\d+) # Size. \\s \"(.*?)\" # Referer. \\s \"(.*?)\" # UA. (?:\\s (-|[\\w.]+))? # Clickstream " let line = "212.56.101.183 - - [27/Jan/2004:10:21:22 +0000] \"GET / HTTP/1.0\" 200 1676 \"-\" \"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031215 Firebird/0.7\" 212.56.101.183.35281075198882802" let subs = Pcre.exec ~rex:line_re line let () = prerr_endline ("num of subs = " ^ string_of_int (Pcre.num_of_subs subs)) ---------------------------------------------------------------------- -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment MONOLITH is an advanced framework for writing web applications in C, easier than using Perl & Java, much faster and smaller, reusable widget-based arch, database-backed, discussion, chat, calendaring: http://www.annexia.org/freeware/monolith/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners