Skip Menu |
 

This queue is for tickets about the BibTeX-Parser CPAN distribution.

Report information
The Basics
Id: 43014
Status: resolved
Priority: 0/
Queue: BibTeX-Parser

People
Owner: Nobody in particular
Requestors: chong [...] seas.harvard.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Author names with non-word characters
Date: Tue, 03 Feb 2009 19:07:57 -0800
To: bug-BibTeX-Parser [...] rt.cpan.org
From: Stephen Chong <chong [...] seas.harvard.edu>
Download (untitled) / with headers
text/plain 284b
Hi, I think there is a bug in the pattern used to match author names, on line 141 of Author.pm. The expression \b([\w-]+) does not match surnames that contain, for example, an apostrophe, such as "O'Malley". Thanks for writing/maintaining this, it is very useful! Cheers, Steve.
Download (untitled) / with headers
text/plain 811b
On Tue Feb 03 22:08:39 2009, chong@seas.harvard.edu wrote: Show quoted text
> Hi, > I think there is a bug in the pattern used to match author names, on > line 141 of Author.pm. The expression \b([\w-]+) does not match surnames > that contain, for example, an apostrophe, such as "O'Malley". > > Thanks for writing/maintaining this, it is very useful!
Hi Gerhard, hi Steve, I'm also suffering from a related problem (but probably not exactly the same as Steve). The following BibTeX entry sends the parser into an endless loop: @article{testkey, year = {2008}, author = {A. Bar and L.M. M\"uller}, journal = {journal}, volume = {1}, number = {1}, pages = {1}, } I'd really, really appreciate to get this issue fixed! I'd hate having to write my own parser :( Thanks for writing the parser! Cheers, Steffen
Download (untitled) / with headers
text/plain 439b
Hi Gerhard, On Wed Jul 15 10:19:39 2009, SMUELLER wrote: Show quoted text
> @article{testkey, > year = {2008}, > author = {A. Bar and L.M. M\"uller}, > journal = {journal}, > volume = {1}, > number = {1}, > pages = {1}, > }
please find two files in the attachments: t/bibs/10-funnyname.bib and t/10-funnyname.t which test the related bug. The infinite loop only occurs when the ->author or ->editor methods are called. Best regards, Steffen
Download (untitled) / with headers
text/plain 118b
Oddly, the attachment didn't work the first time. Trying again with only one each time. This should be the test file.
Download 10-funnyname.t
text/x-perl 1k
#!perl -T use Test::More tests => 11; use IO::File; use BibTeX::Parser; my $fh = IO::File->new('t/bibs/10-funnyname.bib'); my $parser = BibTeX::Parser->new($fh); #my @result = BibTeX::Parser->_parse($fh); my $entry = $parser->next; is_deeply( $entry, { _type => 'ARTICLE', _key => 'testkey', author => "A. Bar and L.M. M\"uller", title => 'foo', journal => 'journal', volume => 1, number => 1, pages => 1, year => 2008, _parse_ok => 1 }, "parse \@ARTICLE" ); my @authors = $entry->author; pass("->author didn't loop forever"); ok(@authors == 2, "Two authors"); is($authors[0]->first, 'A.', "A1 first name"); is($authors[0]->last, 'Bar', "A1 last name"); ok(!$authors[0]->von, "A1 no 'von'"); ok(!$authors[0]->jr, "A1 no 'jr'"); is($authors[1]->first, 'L.M.', "A2 first name"); is($authors[1]->last, 'M"uller', "A2 last name"); ok(!$authors[1]->von, "A2 no 'von'"); ok(!$authors[1]->jr, "A2 no 'jr'");
This should be the test BIB file.
Download 10-funnyname.bib
text/x-bibtex 165b
@article{testkey, year = {2008}, title = "foo", author = {A. Bar and L.M. M\"uller}, journal = {journal}, volume = {1}, number = {1}, pages = {1}, }
Download (untitled) / with headers
text/plain 159b
Hi, I fixed both problems in version 0.3 which should be on CPAN now. If you find any additional names that cause problems I would be glad to hear about them.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.