Closed Bug 1247044 Opened 8 years ago Closed 8 years ago

TypeError: expected a string or other character buffer object with Mercurial 3.7

Categories

(Developer Services :: Mercurial: bzexport, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gps, Assigned: gps)

Details

Attachments

(1 file)

bzexport appears busted with Mercurial 3.7 according to tests failing:

--- /Users/gps/src/hgcustom/version-control-tools/hgext/bzexport/tests/test-auth.t
+++ /Users/gps/src/hgcustom/version-control-tools/hgext/bzexport/tests/test-auth.t.err
@@ -28,33 +28,221 @@
 No auth info should lead to prompting (verifies mozhg.auth is hooked up)

   $ hg newbug --product TestProduct --component TestComponent -t 'No auth' 'dummy'
-  Bugzilla username: None
-  abort: unable to obtain Bugzilla authentication.
-  [255]
+  Bugzilla username: ** Unknown exception encountered with possibly-broken third-party extension bzexport
+  ** which supports versions 3.6 of Mercurial.
+  ** Please disable bzexport and try your action again.
+  ** If that fixes the bug please report it to https://bugzilla.mozilla.org/enter_bug.cgi?product=Developer%20Services&component=Mercurial%3A%20bzexport
+  ** Python 2.7.11 (default, Dec  5 2015, 14:44:53) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)]
+  ** Mercurial Distributed SCM (version 3.7.1)
+  ** Extensions loaded: strip, mq, bzexport
+  Traceback (most recent call last):
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/bin/hg", line 43, in <module>
+      mercurial.dispatch.run()
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/dispatch.py", line 54, in run
+      sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/dispatch.py", line 120, in dispatch
+      ret = _runcatch(req)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/dispatch.py", line 191, in _runcatch
+      return _dispatch(req)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/dispatch.py", line 924, in _dispatch
+      cmdpats, cmdoptions)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/dispatch.py", line 681, in runcommand
+      ret = _runcommand(ui, options, cmd, d)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/dispatch.py", line 1055, in _runcommand
+      return checkargs()
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/dispatch.py", line 1015, in checkargs
+      return cmdfunc()
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/dispatch.py", line 921, in <lambda>
+      d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/util.py", line 991, in check
+      return func(*args, **kwargs)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/extensions.py", line 195, in closure
+      return func(*(args + a), **kw)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/util.py", line 991, in check
+      return func(*args, **kwargs)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/hgext/mq.py", line 3516, in mqcommand
+      return orig(ui, repo, *args, **kwargs)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/util.py", line 991, in check
+      return func(*args, **kwargs)
+    File "/Users/gps/src/hgcustom/version-control-tools/hgext/bzexport/__init__.py", line 1107, in newbug
+      auth, api_server, bugzilla = bugzilla_info(ui, opts.get('ffprofile'))
+    File "/Users/gps/src/hgcustom/version-control-tools/hgext/bzexport/__init__.py", line 387, in bugzilla_info
+      auth = bzauth.get_auth(ui, bugzilla, profile)
+    File "/Users/gps/src/hgcustom/version-control-tools/hgext/bzexport/bzauth.py", line 237, in get_auth
+      auth = getbugzillaauth(ui, require=True, profile=profile)
+    File "/Users/gps/src/hgcustom/version-control-tools/pylib/mozhg/mozhg/auth.py", line 100, in getbugzillaauth
+      username = ui.prompt(_('Bugzilla username:'), None)
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/ui.py", line 801, in prompt
+      self.write(msg, ' ', default, "\n")
+    File "/Users/gps/src/hgcustom/version-control-tools/venv/mercurials/3.7.1/lib/python2.7/site-packages/mercurial/ui.py", line 672, in write
+      self.fout.write(a)
+  TypeError: expected a string or other character buffer object
+  [1]
Assignee: nobody → gps
Status: NEW → ASSIGNED
Mercurial 3.7 enforces that the value for "default" be a string or
character buffer object. We were previously passing None, which is
neither. This was causing the prompt to throw a TypeError on Mercurial
3.7.

Since we're only checking truthiness of the result, it doesn't matter if
it is an empty string or None, since they are both Falsy. So use an
empty string.

Review commit: https://reviewboard.mozilla.org/r/34281/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/34281/
Attachment #8717715 - Flags: review?(smacleod)
Comment on attachment 8717715 [details]
MozReview Request: mozhg: make prompt default argument an empty string (bug 1247044); r?smacleod

https://reviewboard.mozilla.org/r/34281/#review31087
Attachment #8717715 - Flags: review?(smacleod) → review+
Autolanded.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
It looks like the upstream change was accidental. A patch was sent to restore the behavior of allowing "None" as the default argument. It will presumably be part of 3.7.2. But I think this patch is OK sticking.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: