Re: problems with nmbug and empty prefix (UnicodeWarning and broken pipe)

Subject: Re: problems with nmbug and empty prefix (UnicodeWarning and broken pipe)

Date: Sat, 13 Feb 2016 14:33:57 -0800

To: David Bremner

Cc: notmuch@notmuchmail.org

From: W. Trevor King


On Sat, Feb 13, 2016 at 03:10:16PM -0400, David Bremner wrote:
> bremner@zancas:~$ export NMBGIT=/tmp/nmbug
> bremner@zancas:~$ export NMBPREFIX=""
> bremner@zancas:~$ nmbug commit
> /usr/lib/python2.7/urllib.py:1303: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
>   return ''.join(map(quoter, s))
> Error flushing output: <fd:8>: Broken pipe
> [u'notmuch', u'dump', u'--format=batch-tag', u'--', u'<censored>'] exited with 254

I couldn't reproduce this in either Python 3.4.3 or 2.7.10.  It might
be your number-of-tags hypothesis, but the UnicodeWarning suggests an
encoding issue involving the dump output, which might mean that you
just have a strange tag.  Can you try again with:

  $ nmbug --log-level debug commit

which will give us the full traceback.

We only call ‘notmuch dump …’ from _index_tags, where dump's stdout is
tweaked and fed into ‘git update-index …’.  Your urllib UnicodeWarning
suggests the issue lies in:

  tags = [
      _unquote(tag[len(prefix):])
      for tag in tags_string.split()
      if tag.startswith(prefix)]

in which case it would be useful to try something like:

  tags = []
  for tag in tags_string.split():
      try:
          if tag.startswith(prefix):
              tags.append(_unquote(tag[len(prefix):]))
      except UnicodeWarning as error:
          raise ValueError('{!r} ({!r}, {})'.format(tag, prefix, error))

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
signature.asc (application/pgp-signature)

Thread: