in reply to Re: Generating and storing regexp
in thread Generating and storing regexp

Thank you for your reply. I did implement YAML and while generating I store two hashes. One without regexps and one with with regexps. When I store it I load it again and compares the two hashes and they are the same, everything is fine. BUT when I load it in my main program, I get segmentation fault on the one with regexps but the other get read without any problem. They are loaded with the same function but not at the same time. What could be wrong?
Made a test for ruling out errors, still the same thing

#!/usr/bin/perl use warnings; use strict; use YAML::XS qw(LoadFile Dump); my $ref_LOG = LoadFile("modules/patterns.data"); print Dump($ref_LOG);
Output
--- ~ Segmentation fault


The data file looks sane, and it was verified...

Replies are listed 'Best First'.
Re^3: Generating and storing regexp
by Eliya (Vicar) on Feb 20, 2011 at 17:42 UTC

    Segfaults are the result of programming bugs, or sometimes caused by not correctly handling unexpected input (which is essentially also a bug).

    Unfortunately, it's next to impossible to debug such problems without being able to reproduce them.

    In other words, it would help if you could reduce the input to a minimal case the allows to reproduce the issue, and then submit a bug report to YAML::XS, as the author of the module can probably help better here.

    Until then, you might want to try the non-XS version of YAML instead.

      Reverted to YAML::Syck and it worked. Tried to boil the problem with YAML::XS down. Worked through all the indata and when attaching a particular part of the data to a working YAML file it stopped working. Thing is if I try to just use that part or any other it works, so the data can't be wrong. I can't see anything special with that part (its about 2MB, each block is working seperatly , could be it since the other part I use were smaller). With the same data but generated with Syck it works as a charm. Syck seems to ignore CompressSeries flag so I bet that could be the problem. Or at least my data were generated without it. Thanks again for pointing me to this. Ill never use Dumper again ;)