https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6872
--- Comment #12 from Mark Martinec <mark.marti...@ijs.si> --- Meanwhile the Net::DNS 0.71 has been released, temporarily reverting the change that broke sa-update, until we get our 3.4.0 out - thank you Willem and the rest of the NLnet Lab crew! This is from Net::DNS 0.71 release notes: **** 0.71 Dec 15, 2012 Temporary workaround rt.cpan.org #81760 The rdatastr method for TXT RRs will return unconditionally quoted rdata fields to work around an issue with updating SpamAssassin rules. This workaround will be reverted after release of a version of SpamAssassin which resolves the issue. After some offline discussion with Willem (me complaining about the difficulties when a caller wants to access data strings from TXT records with multiple RDATA <character-string> fields, while also avoiding the Net::DNS habit of using a zone-file format encodings in the API, only to have the caller go into trouble of undoing the unnecessary encoding) - Willem suggested the following: > > So what can I do? Check a Net::DNS version and use char_str_list() > > with older Net::DNS, and txtdata() with newer??? > > I promise to discuss this thoroughly with Dick and Olaf and report back > with a statement on which you can build and depend. > > In the mean time, I encourage you to use txtdata for getting the values > of <version>.updates.spamassassin.org and > mirros.updates.spamassassin.org. As those records have only a single > rdata field, txtdata would return the same value since Net::DNS 0.34. This sounds like a good advise, especially since Net::DNS 0.34 already happen to be the lowest supported version of Net::DNS in SpamAssassin. So I'm folding in a couple of changes to implement it. Will attach the diff in the next posting. The following new comments in the code and a few samples of the change should make the reasoning clearer, I hope: - $log = $answer->rdatastr; - $log =~ s/^"(.*)"\z/$1/s; + # txtdata returns a non- zone-file-format encoded result, unlike rdatastr; + # avoid space-separated RDATA <character-string> fields if possible, + # txtdata provides a list of strings in a list context since Net::DNS 0.69 + $log = join('',$answer->txtdata); + # NOTE: $rr->rdatastr returns the result encoded in a DNS zone file + # format, i.e. enclosed in double quotes if a result contains whitespace + # (or other funny characters), and may use \DDD encoding or \X quoting as + # per RFC 1035. Using $rr->txtdata instead avoids this unnecessary encoding + # step and a need for decoding by a caller, returning an unmodified string. + # Caveat: in case of multiple RDATA <character-string> fields contained + # in a resource record (TXT, SPF, HINFO), starting with Net::DNS 0.69 + # the $rr->txtdata in a list context returns these strings as a list. + # The $rr->txtdata in a scalar context always returns a single string + # with <character-string> fields joined by a single space character as + # a separator. The $rr->txtdata in Net::DNS 0.68 and older returned + # such joined space-separated string even in a list context. + # + # From Net::DNS maintainers (Willem Toorop, NLnet Labs): + # I encourage you to use txtdata for getting the values of + # <version>.updates.spamassassin.org and mirros.updates.spamassassin.org. + # As those records have only a single rdata field, txtdata would return + # the same value since Net::DNS 0.34. - my $text = $rr->rdatastr; - if (defined $text && $text ne '') { - local($1); - $text =~ s/^"(.*)"\z/$1/s; - push(@result,$text); - } + # scalar context! + my $text = $rr->UNIVERSAL::can('txtdata') ? $rr->txtdata : $rr->rdatastr; + push(@result,$text) if defined $text && $text ne ''; Trunk: Bug 6872 - replace $rr->rdatastr with $rr->txtdata where appropriate Sending lib/Mail/SpamAssassin/Dns.pm Sending lib/Mail/SpamAssassin/DnsResolver.pm Sending lib/Mail/SpamAssassin/Plugin/AskDNS.pm Sending lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm Sending sa-update.raw Committed revision 1425068. -- You are receiving this mail because: You are the assignee for the bug.