[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#509935: decide whether Uploaders is parsed per RFC 5322



* Russ Allbery <rra@debian.org>, 2011-09-08, 19:09:
I propose the following simple solution to this bug:
- Let's forget about RFC 822/5322 compatibility, as it would introduce only needless complexity. - Let's allow any punctuation characters in maintainer names and e-mail addresses *except* "<" and ">".

This way comma is completely disambiguated: it splits the field if and only it's preceded by the ">" character. I.e. you can use the following Perl regex to split the field: /\>\K\s*,\s*/.

Oh, hm, yeah, that would work.

Currently, the only way to express such a name that works with our existing tools is to drop the comma, since several programs blindly split on commas when parsing the field.

Let's fix them, then. :) I volunteer to fix lintian and dd-list. Do you know any other tools that parse Uploaders?

dak, of course, but it sounds from your message like it's already doing the right thing.

One think it doesn't do right is that it doesn't allow for space before the comma. (We have a few packages in the archive with " , " in the Uploaders field.) Should other (than space) whitespace characters be allowed before/after comma as well?

The PTS and DDPO -- I'm not sure what gets that data into those systems.

They have both their own, IMO over-engineered parsers of Sources files.

PTS:

  def addresses_from_string(content):
      pattern = re.compile("([^>]),")
      hacked_content = pattern.sub("\\1WEWANTNOCOMMAS", content)
      msg = email.message_from_string("Header: " + hacked_content)
      hacked_list = email.Utils.getaddresses(msg.get_all("Header", []))
      list = map(lambda p:
                 map(lambda s:string.replace(s,"WEWANTNOCOMMAS",","), p),
                 hacked_list)
      return list

Again, PTS trips on a space before comma.

DDPO:

  my @uploaders = ($uploaders =~ /([^,@ ][^@]+@[^@]+>)/g);
  $db{"com:$package"} = scalar @uploaders;
  foreach my $uploader (@uploaders) {
      my ($name, $mail);
      if ($uploader =~ /^\S+$/) {
          ($name, $mail) = ("(unknown)", $uploader);
          warn "Uploader without name: $package $uploader";
      } else {
          $uploader =~ /(.+) <(.+)>/ or warn "$fname:$.: syntax error in $uploader";
          ($name, $mail) = ($1, $2);
          $db{"name:$mail"} = $name;
      }
      $packages{$mail}->{$component}->{$package} = 1;
  }

DDPO doesn't allow for leading comma or @ in the maintainer's name, but that's a minor nitpick.

UDD?

UDD uses Python's email.Utils.getaddresses(), so it will need fixing.

--
Jakub Wilk



Reply to: