* [Caml-list] Fatal error: exception Pcre.Error(0) @ 2011-12-22 18:39 oliver 2011-12-22 18:50 ` oliver 2011-12-22 19:53 ` Stéphane Glondu 0 siblings, 2 replies; 12+ messages in thread From: oliver @ 2011-12-22 18:39 UTC (permalink / raw) To: caml-list Hello, where is there a documentation about these kind of errors from pcre-lib? I'm using Pcre.pmatch, which should just give me a bool. Ciao, Oliver ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Caml-list] Fatal error: exception Pcre.Error(0) 2011-12-22 18:39 [Caml-list] Fatal error: exception Pcre.Error(0) oliver @ 2011-12-22 18:50 ` oliver 2011-12-22 19:53 ` Stéphane Glondu 1 sibling, 0 replies; 12+ messages in thread From: oliver @ 2011-12-22 18:50 UTC (permalink / raw) To: caml-list On Thu, Dec 22, 2011 at 07:39:14PM +0100, oliver wrote: > Hello, > > where is there a documentation about these kind of errors from pcre-lib? > I'm using Pcre.pmatch, which should just give me a bool. [...] If I remove ~flags:[`PARTIAL] from the call, this problem vanishes. And there are some non-matching items... Info on Pcre-module: /usr/lib/ocaml/pcre/META: ======================================================================= name="pcre" version="6.0.1" description="Perl Compatibility Regular Expressions" requires="" archive(byte)="pcre.cma" archive(native)="pcre.cmxa" linkopts = "" ======================================================================= /var/lib/ocaml/lintian/libpcre-ocaml-dev.info: ======================================================================= Package: libpcre-ocaml-dev Runtime: libpcre-ocaml Version: 6.0.1-2build1 File: debian/libpcre-ocaml-dev/usr/lib/ocaml/pcre/pcre.cma Force custom: no Extra C object files: -lpcre_stubs -lpcre -L/usr/lib Extra C options: -Wl,-Bsymbolic-functions ======================================================================= Not the newest one... (older Ubuntu system), so maybe it's an already known problem... Ciao, Oliver ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Caml-list] Fatal error: exception Pcre.Error(0) 2011-12-22 18:39 [Caml-list] Fatal error: exception Pcre.Error(0) oliver 2011-12-22 18:50 ` oliver @ 2011-12-22 19:53 ` Stéphane Glondu 2011-12-22 21:39 ` oliver 1 sibling, 1 reply; 12+ messages in thread From: Stéphane Glondu @ 2011-12-22 19:53 UTC (permalink / raw) To: oliver; +Cc: caml-list Le 22/12/2011 19:39, oliver a écrit : > where is there a documentation about these kind of errors from pcre-lib? > I'm using Pcre.pmatch, which should just give me a bool. See pcre.mli. Pcre.Error(0) is the raw representation of Partial (i.e. string only matched the pattern partially). By the way, in doubt, you can catch Pcre.Error and pattern-match on its argument. Cheers, -- Stéphane ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Caml-list] Fatal error: exception Pcre.Error(0) 2011-12-22 19:53 ` Stéphane Glondu @ 2011-12-22 21:39 ` oliver 2011-12-22 22:35 ` Stéphane Glondu 0 siblings, 1 reply; 12+ messages in thread From: oliver @ 2011-12-22 21:39 UTC (permalink / raw) To: Stéphane Glondu; +Cc: caml-list On Thu, Dec 22, 2011 at 08:53:56PM +0100, Stéphane Glondu wrote: > Le 22/12/2011 19:39, oliver a écrit : > > where is there a documentation about these kind of errors from pcre-lib? > > I'm using Pcre.pmatch, which should just give me a bool. > > See pcre.mli. Pcre.Error(0) is the raw representation of Partial (i.e. > string only matched the pattern partially). [...] In my pcre.mli this error is not mentioned. There is a type error = | Partial (** String only matched the pattern partially *) | BadPartial (** Pattern contains items that cannot be used together with partial matching. *) | BadPattern of string * int (** [BadPattern (msg, pos)] regular expression is malformed. The reason is in [msg], the position of the error in the pattern in [pos]. *) | BadUTF8 (** UTF8 string being matched is invalid *) | BadUTF8Offset (** Gets raised when a UTF8 string being matched with offset is invalid. *) | MatchLimit (** Maximum allowed number of match attempts with backtracking or recursion is reached during matching. ALL FUNCTIONS CALLING THE MATCHING ENGINE MAY RAISE IT!!! *) | RecursionLimit | InternalError of string (** [InternalError msg] C-library exhibits unknown/undefined behaviour. The reason is in [msg]. *) Which also mentioned a partial-match error. But Pcre.Error(0) looks somehow cryptical and strange to me. Maybe that old version is just too old. > > By the way, in doubt, you can catch Pcre.Error and pattern-match on its > argument. Yes, I think that makes sense. But Pcre.Error(0) is not very verbose, and I also want to know what I catch and why... Installing a newer pcre was easy, but then my build process complains about multiple stublibs-directories. So I threw it away. So maybe it's better to change the apt-get stuff instead. (I also tried to create a pcre-ocaml PKGBUILD for Arch Linux, but I would need to fake the install-drectories, so that it would install locally inside the fakeroot... any ideas on that?) Ciao, Oliver ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Caml-list] Fatal error: exception Pcre.Error(0) 2011-12-22 21:39 ` oliver @ 2011-12-22 22:35 ` Stéphane Glondu 2011-12-23 0:13 ` oliver 2011-12-23 0:45 ` [Caml-list] Fatal error: exception Pcre.Error(0) oliver 0 siblings, 2 replies; 12+ messages in thread From: Stéphane Glondu @ 2011-12-22 22:35 UTC (permalink / raw) To: oliver; +Cc: caml-list Le 22/12/2011 22:39, oliver a écrit : >>> where is there a documentation about these kind of errors from pcre-lib? >>> I'm using Pcre.pmatch, which should just give me a bool. >> >> See pcre.mli. Pcre.Error(0) is the raw representation of Partial (i.e. >> string only matched the pattern partially). > [...] > > In my pcre.mli this error is not mentioned. > > There is a > > > type error = > | Partial (** String only matched the pattern partially *) ^^^^^^^ There. > Which also mentioned a partial-match error. > But Pcre.Error(0) looks somehow cryptical > and strange to me. Pcre.Error(0) is cryptical but not strange: it is the same as Pcre.Error(Pcre.Partial). Whatever gives you the error message mentioning Pcre.Error(0) does not have access to type information, so it cannot give you more than Pcre.Error(0). You didn't tell where the error message came from. >> By the way, in doubt, you can catch Pcre.Error and pattern-match on its >> argument. > > Yes, I think that makes sense. > But Pcre.Error(0) is not very verbose, and I also want to know > what I catch and why... try Pcre.exec ... with Pcre.Error e -> match e with | Partial -> ... | _ -> ... If you are using the generic exception pretty-printer (module Printexc), you can register a pretty-printer for Pcre.Error with Printexc.register_printer. > Installing a newer pcre was easy, but then my build process complains > about multiple stublibs-directories. So I threw it away. > So maybe it's better to change the apt-get stuff instead. The only way a new version of pcre could "fix" that would be if it registered a pretty-printer as explained above. But this is not the case, even in the last version (6.2.4). Cheers, -- Stéphane ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Caml-list] Fatal error: exception Pcre.Error(0) 2011-12-22 22:35 ` Stéphane Glondu @ 2011-12-23 0:13 ` oliver 2011-12-23 3:35 ` Abdallah Saffidine 2011-12-23 6:29 ` Stéphane Glondu 2011-12-23 0:45 ` [Caml-list] Fatal error: exception Pcre.Error(0) oliver 1 sibling, 2 replies; 12+ messages in thread From: oliver @ 2011-12-23 0:13 UTC (permalink / raw) To: Stéphane Glondu; +Cc: caml-list On Thu, Dec 22, 2011 at 11:35:41PM +0100, Stéphane Glondu wrote: > Le 22/12/2011 22:39, oliver a écrit : > >>> where is there a documentation about these kind of errors from pcre-lib? > >>> I'm using Pcre.pmatch, which should just give me a bool. > >> > >> See pcre.mli. Pcre.Error(0) is the raw representation of Partial (i.e. > >> string only matched the pattern partially). > > [...] > > > > In my pcre.mli this error is not mentioned. > > > > There is a > > > > > > type error = > > | Partial (** String only matched the pattern partially *) > ^^^^^^^ > > There. > > > Which also mentioned a partial-match error. > > But Pcre.Error(0) looks somehow cryptical > > and strange to me. > > Pcre.Error(0) is cryptical but not strange: it is the same as > Pcre.Error(Pcre.Partial). Whatever gives you the error message > mentioning Pcre.Error(0) does not have access to type information, so it > cannot give you more than Pcre.Error(0). You didn't tell where the error > message came from. So, (0) stands for the first entry in the list I assume. BadPartial-exception then would be Pcre.Error(1). ? That there is only returned an int, instead of the type information, where does that come from? Why is that not available? Does it coming from working together with the *.c stuff? > > >> By the way, in doubt, you can catch Pcre.Error and pattern-match on its > >> argument. > > > > Yes, I think that makes sense. > > But Pcre.Error(0) is not very verbose, and I also want to know > > what I catch and why... > > try Pcre.exec ... > with Pcre.Error e -> > match e with > | Partial -> ... > | _ -> ... > > If you are using the generic exception pretty-printer (module Printexc), > you can register a pretty-printer for Pcre.Error with > Printexc.register_printer. Hmhhh. Not used that stuff so far. > > > Installing a newer pcre was easy, but then my build process complains > > about multiple stublibs-directories. So I threw it away. > > So maybe it's better to change the apt-get stuff instead. > > The only way a new version of pcre could "fix" that would be if it > registered a pretty-printer as explained above. But this is not the > case, even in the last version (6.2.4). OK, thanks. I also looked now, at what the original package offers... ...for example with "make doc" a lot of additional nice docs will be created. That was not offered by my OS-based installation. So, looking at the source package was an interesting experience. Ciao, Oliver ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Caml-list] Fatal error: exception Pcre.Error(0) 2011-12-23 0:13 ` oliver @ 2011-12-23 3:35 ` Abdallah Saffidine 2011-12-23 6:29 ` Stéphane Glondu 1 sibling, 0 replies; 12+ messages in thread From: Abdallah Saffidine @ 2011-12-23 3:35 UTC (permalink / raw) To: oliver; +Cc: caml-list [-- Attachment #1: Type: text/plain, Size: 2540 bytes --] 2011/12/22 oliver <oliver@first.in-berlin.de> > On Thu, Dec 22, 2011 at 11:35:41PM +0100, Stéphane Glondu wrote: > > Le 22/12/2011 22:39, oliver a écrit : > > >>> where is there a documentation about these kind of errors from > pcre-lib? > > >>> I'm using Pcre.pmatch, which should just give me a bool. > > >> > > >> See pcre.mli. Pcre.Error(0) is the raw representation of Partial (i.e. > > >> string only matched the pattern partially). > > > [...] > > > > > > In my pcre.mli this error is not mentioned. > > > > > > There is a > > > > > > > > > type error = > > > | Partial (** String only matched the pattern partially *) > > ^^^^^^^ > > > > There. > > > > > Which also mentioned a partial-match error. > > > But Pcre.Error(0) looks somehow cryptical > > > and strange to me. > > > > Pcre.Error(0) is cryptical but not strange: it is the same as > > Pcre.Error(Pcre.Partial). Whatever gives you the error message > > mentioning Pcre.Error(0) does not have access to type information, so it > > cannot give you more than Pcre.Error(0). You didn't tell where the error > > message came from. > > > So, (0) stands for the first entry in the list I assume. > BadPartial-exception then would be Pcre.Error(1). ? > > That there is only returned an int, instead of the type information, > where does that come from? > Why is that not available? > Does it coming from working together with the *.c stuff? > In OCaml no type information is preserved at runtime and the internal representation of an algebraic data type constructor without body like Partial, BadPartial, Nil, Empty etc. is the same as that of an int, the specific int corresponding to the constructor depends on the position of the constructor in the type declaration as you guessed. The reason for lack of runtime type information is that the typechecker ensures at compile time that you're program is well behaved with regard to types, so there is no need to keep type information at runtime. Keeping type information at runtime would result in a higher memory footprint and as a result possibly worse performance. Another way to look at it is : if it was possible to check at compile time that all array access are within bounds, then you would not need costly runtime checks (or risking segfaults), but this is a very hard problem. For the types on the other hand, the situation is easier and checks can be made at compile time, so there is no need for runtime type information. Ciao, Abdallah [-- Attachment #2: Type: text/html, Size: 3073 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Caml-list] Fatal error: exception Pcre.Error(0) 2011-12-23 0:13 ` oliver 2011-12-23 3:35 ` Abdallah Saffidine @ 2011-12-23 6:29 ` Stéphane Glondu 2011-12-23 12:59 ` Pcre-Ocaml-docs (Re: [Caml-list] Fatal error: exception Pcre.Error(0)) oliver 1 sibling, 1 reply; 12+ messages in thread From: Stéphane Glondu @ 2011-12-23 6:29 UTC (permalink / raw) To: oliver; +Cc: caml-list Le 23/12/2011 01:13, oliver a écrit : > I also looked now, at what the original package offers... > ...for example with "make doc" a lot of additional > nice docs will be created. > > That was not offered by my OS-based installation. > So, looking at the source package was an interesting experience. Is there something more than what is in [1]? [1] /usr/share/doc/libpcre-ocaml-dev/ If something is missing, feel free to report a bug against the Debian package. Cheers, -- Stéphane ^ permalink raw reply [flat|nested] 12+ messages in thread
* Pcre-Ocaml-docs (Re: [Caml-list] Fatal error: exception Pcre.Error(0)) 2011-12-23 6:29 ` Stéphane Glondu @ 2011-12-23 12:59 ` oliver 0 siblings, 0 replies; 12+ messages in thread From: oliver @ 2011-12-23 12:59 UTC (permalink / raw) To: Stéphane Glondu; +Cc: caml-list On Fri, Dec 23, 2011 at 07:29:45AM +0100, Stéphane Glondu wrote: > Le 23/12/2011 01:13, oliver a écrit : > > I also looked now, at what the original package offers... > > ...for example with "make doc" a lot of additional > > nice docs will be created. > > > > That was not offered by my OS-based installation. > > So, looking at the source package was an interesting experience. > > Is there something more than what is in [1]? > > [1] /usr/share/doc/libpcre-ocaml-dev/ Yes, the docs are created with ocamldoc and are pretty printed docs with a lot of information. > > If something is missing, feel free to report a bug against the Debian > package. Not sure if these are the unchanged Debian-Packages. It's an older Ubuntu what is running here. So it could be reported either at the Debian or the Ubuntu side. The docs could be created via the sourcce package. Not sure if this was intended or not. Depends on how Debian/Ubuntu want to handle that. Maybe there could be also a package called "libpcre-ocaml-doc" added then, which at the moment does not exist (at least not on this old distribution). Ciao, Oliver ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Caml-list] Fatal error: exception Pcre.Error(0) 2011-12-22 22:35 ` Stéphane Glondu 2011-12-23 0:13 ` oliver @ 2011-12-23 0:45 ` oliver 2011-12-23 1:21 ` oliver 1 sibling, 1 reply; 12+ messages in thread From: oliver @ 2011-12-23 0:45 UTC (permalink / raw) To: Stéphane Glondu; +Cc: caml-list On Thu, Dec 22, 2011 at 11:35:41PM +0100, Stéphane Glondu wrote: > Le 22/12/2011 22:39, oliver a écrit : > >>> where is there a documentation about these kind of errors from pcre-lib? > >>> I'm using Pcre.pmatch, which should just give me a bool. > >> > >> See pcre.mli. Pcre.Error(0) is the raw representation of Partial (i.e. > >> string only matched the pattern partially). > > [...] > > > > In my pcre.mli this error is not mentioned. > > > > There is a > > > > > > type error = > > | Partial (** String only matched the pattern partially *) > ^^^^^^^ > > There. > > > Which also mentioned a partial-match error. > > But Pcre.Error(0) looks somehow cryptical > > and strange to me. > > Pcre.Error(0) is cryptical but not strange: it is the same as > Pcre.Error(Pcre.Partial). [...] > Whatever gives you the error message ... would be interesting to know. In some other code with partial matches, I got no error... (with or without the partial-flag). And I also would not await an error at all... The difference between the true/false result and the Pcre.Error(0) result is, that the latter one occurs in recursive calls of a function. But AFAIK pcre-ocaml should have no problem here... ...and it's not even multithreaded, but even there, nothing like that should happen...?! > mentioning Pcre.Error(0) does not have access to type information, so it > cannot give you more than Pcre.Error(0). You didn't tell where the error > message came from. Can you be more precise in what you mean with where it comes from? If the exception is called Pcre.Error(0) I would assume it., coming from Pcre module. Ciao, Oliver ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Caml-list] Fatal error: exception Pcre.Error(0) 2011-12-23 0:45 ` [Caml-list] Fatal error: exception Pcre.Error(0) oliver @ 2011-12-23 1:21 ` oliver 2011-12-23 2:09 ` Markus Mottl 0 siblings, 1 reply; 12+ messages in thread From: oliver @ 2011-12-23 1:21 UTC (permalink / raw) To: Stéphane Glondu; +Cc: caml-list Here is what I get in examples: let _ = let pattern = "node" in let doc = "httpsdjshdjshdjnodeshdsden" in (* true *) let doc = "skjdfjjeroiurt//lkj" in (* false *) let doc = "skjdf" in (* false *) let doc = "skjdfg" in (* false *) let doc = "hsgshsn" in (* ~flags:[`PARTIAL] => Fatal error: exception Pcre.Error(0) *) let doc = "http:gggggggggggg//spnnden" in (* ~flags:[`PARTIAL] => Fatal error: exception Pcre.Error(0) *) if Pcre.pmatch ~pat:pattern ~flags:[`PARTIAL] doc then print_endline "true" else print_endline "false" Rather looks like a true pcre-problem, not one of ocaml-pcre... ?! Ciao, Oliver ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Caml-list] Fatal error: exception Pcre.Error(0) 2011-12-23 1:21 ` oliver @ 2011-12-23 2:09 ` Markus Mottl 0 siblings, 0 replies; 12+ messages in thread From: Markus Mottl @ 2011-12-23 2:09 UTC (permalink / raw) To: oliver; +Cc: Stéphane Glondu, caml-list Please read the pcre man page on partial matching: "man pcrepartial". The reason why e.g. "hsgshsn" gives you a partial match is that it ends in "n", and the pattern starts with "n". This means that the subject string might match the pattern "node" if it were extended appropriately. Regards, Markus On Thu, Dec 22, 2011 at 20:21, oliver <oliver@first.in-berlin.de> wrote: > > > Here is what I get in examples: > > > let _ = > > let pattern = "node" in > > let doc = "httpsdjshdjshdjnodeshdsden" in (* true *) > let doc = "skjdfjjeroiurt//lkj" in (* false *) > let doc = "skjdf" in (* false *) > let doc = "skjdfg" in (* false *) > let doc = "hsgshsn" in (* ~flags:[`PARTIAL] => Fatal error: exception Pcre.Error(0) *) > let doc = "http:gggggggggggg//spnnden" in (* ~flags:[`PARTIAL] => Fatal error: exception Pcre.Error(0) *) > > if Pcre.pmatch ~pat:pattern ~flags:[`PARTIAL] doc then print_endline "true" else print_endline "false" > > > Rather looks like a true pcre-problem, not one of ocaml-pcre... ?! > > > > Ciao, > Oliver > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- Markus Mottl http://www.ocaml.info markus.mottl@gmail.com ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-12-23 12:59 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-12-22 18:39 [Caml-list] Fatal error: exception Pcre.Error(0) oliver 2011-12-22 18:50 ` oliver 2011-12-22 19:53 ` Stéphane Glondu 2011-12-22 21:39 ` oliver 2011-12-22 22:35 ` Stéphane Glondu 2011-12-23 0:13 ` oliver 2011-12-23 3:35 ` Abdallah Saffidine 2011-12-23 6:29 ` Stéphane Glondu 2011-12-23 12:59 ` Pcre-Ocaml-docs (Re: [Caml-list] Fatal error: exception Pcre.Error(0)) oliver 2011-12-23 0:45 ` [Caml-list] Fatal error: exception Pcre.Error(0) oliver 2011-12-23 1:21 ` oliver 2011-12-23 2:09 ` Markus Mottl
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox