Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: Ico <sup@zevv.nl>
To: sup-talk <sup-talk@rubyforge.org>
Subject: [sup-talk] Bug reading/writing contacts with \" in them
Date: Mon, 24 Jan 2011 06:20:47 +0100	[thread overview]
Message-ID: <1295845756-sup-308@pruts.nl> (raw)

Hi all,

I just found out about Sup yesterday, great stuff, thanks for that to all
involved with development!

I did run into a small bug yesterday though. I was able to analyze it a bit,
but my Ruby is not good enough to propose a solid fix. 

The problem occurs when contacts have a certain combination of backslashes and
quotes in them. I 'imported' my mutt aliases with a simple script converting
the format (too bad it is *almost* the same but not quite), and one of the
contacts looked like this:

  somename: \"Some, Name\" <somename@somedomain.com>

It seems there is a problem somewhere with parsing and writing out the backslashes, which
get escaped each time sup saves the contact list, doubling the number of backslashes each time.

  somename: Some, Name\\ <somename@somedomain.com>
  somename: Some, Name\\\\ <somename@somedomain.com>
  somename: Some, Name\\\\\\\\ <somename@somedomain.com>

and so on.

I first got a hint something was wrong when I noticed that sup was starting up slower
and slower each time, and took over 10 minutes after a few tries. It seems that the regexp
at person.rb:79 

         when /(.+?) ((\S+?)@\S+) \3/

goes haywire backtracking through all the backslashes, I guess the first .+?
probably uses exponential time when trying to match the huge number of \'s

Anyway, I did some quick trials to find where exaclty the bug is, but I
couldn't come up with the proper fix right away. My problem has of course gone
away by just removing the backslashes from the contacts file, but I hope
somebody with more ruby-sense is willing to look into this one.

Thanks,

Ico

-- 
:wq
^X^Cy^K^X^C^C^C^C
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


             reply	other threads:[~2011-01-24  9:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24  5:20 Ico [this message]
2011-01-24 18:20 ` [sup-devel] [PATCH] " Michael Stapelberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295845756-sup-308@pruts.nl \
    --to=sup@zevv.nl \
    --cc=sup-talk@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox