Openai/693a7756-3a00-8011-8828-9989794d92e5

Revision as of 05:17, 12 December 2025 by Lukegao (talk | contribs) (by freem.ai...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


This conversation was exported from ChatGPT[1]

gpt-5-1 edit

User: ❯ b2 --help edit

❯ b2 --help Traceback (most recent call last):

 File "/usr/local/bin/b2", line 3, in <module>
   from b2._internal.b2v4.__main__ import main
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/b2/_internal/b2v4/__main__.py", line 13, in <module>
   main()
   Lukegao (talk) 05:17, 12 December 2025 (UTC)^^
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/b2/_internal/console_tool.py", line 5635, in main
   exit_status = ct.run_command(sys.argv)
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/b2/_internal/console_tool.py", line 5462, in run_command
   parser = B2.create_parser(name=self.b2_binary_name, b2_binary_name=self.b2_binary_name)
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/b2/_internal/console_tool.py", line 1023, in create_parser
   parser = B2ArgumentParser(parser_kwargs)
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/b2/_internal/arg_parser.py", line 104, in __init__
   self._short_description = self._make_short_description(
                             05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)Lukegao (talk)^
       kwargs.get('usage', ), kwargs.get('description', )
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   )
   ^
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/b2/_internal/arg_parser.py", line 144, in _make_short_description
   return self._encode_description(line.strip())
          05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)Lukegao (talk) 05:17, 12 December 2025 (UTC)^^^^^^^^^^^^^^
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/b2/_internal/arg_parser.py", line 133, in _encode_description
   return rst2ansi(value.encode(encoding), output_encoding=encoding)
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/rst2ansi/__init__.py", line 48, in rst2ansi
   out = core.publish_string(input_string.decode('utf-8'), settings_overrides=overrides, writer=Writer(unicode=output_encoding.startswith('utf')))
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/docutils/core.py", line 460, in publish_string
   output, publisher = publish_programmatically(
                       05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)Lukegao (talk) 05:17, 12 December 2025 (UTC)^
       source_class=io.StringInput, source=source, source_path=source_path,
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ...<7 lines>...
       config_section=config_section,
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       enable_exit_status=enable_exit_status)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/docutils/core.py", line 722, in publish_programmatically
   output = publisher.publish(enable_exit_status=enable_exit_status)
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/docutils/core.py", line 237, in publish
   output = self.writer.write(self.document, self.destination)
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/docutils/writers/__init__.py", line 80, in write
   self.translate()
   05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)Lukegao (talk) 05:17, 12 December 2025 (UTC)^^
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/rst2ansi/visitor.py", line 41, in translate
   visitor = self.translator_class(self.document, self.options)
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/rst2ansi/ansi.py", line 113, in __init__
   self.termsize = termsize or get_terminal_size((80,20))
                               05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)05:17, 12 December 2025 (UTC)~~^^^^^^^^^
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/rst2ansi/get_terminal_size.py", line 116, in get_terminal_size
   size = _get_terminal_size(sys.__stdout__.fileno())
 File "/usr/local/Cellar/b2-tools/4.4.2_1/libexec/lib/python3.14/site-packages/rst2ansi/get_terminal_size.py", line 75, in _get_terminal_size
   res = fcntl.ioctl(fd, termios.TIOCGWINSZ, b"\x00" * 4)

SystemError: buffer overflow

Assistant: This is a known bug in some recent b2-tools / rst2ansi combinations on macOS, especially with Python 3.14. edit

This is a known bug in some recent b2-tools / rst2ansi combinations on macOS, especially with Python 3.14. The traceback shows:

fcntl.ioctl(... TIOCGWINSZ ...) → SystemError: buffer overflow

This happens because rst2ansi is calling get_terminal_size() in a way that is no longer compatible with Python 3.14 (Python changed some low-level ioctl argument handling).

Good news: you can fix it, and the issue is not your fault.

✅ Fix Options (pick one) edit

Option 1 — Run b2 with a safe TERM size override (quick workaround) edit

rst2ansi will not try ioctl if you force a fallback terminal size:

COLUMNS=80 LINES=24 b2 --help

or:

export COLUMNS=80
export LINES=24
b2 --help

If this works, it means the bug is specifically the ioctl call.

Option 2 — Install the Python 3.12-based build instead of Python 3.14 edit

Homebrew recently migrated many formulae to Python 3.14, but rst2ansi is not compatible.

Check your brew version:

brew info b2-tools

To downgrade:

brew uninstall b2-tools
brew install [email protected]

or whatever the latest Python-3.12-based version is (Homebrew normally keeps one old revision).

If that works, pin it:

brew pin b2-tools

Option 3 — Force pip version of rst2ansi that avoids the bug edit

(For users comfortable patching their Homebrew libexec)

pip3 install --force-reinstall "rst2ansi==0.1.5"

Older versions avoid the broken TIOCGWINSZ call.

You may need to run it inside b2's libexec Python:

/usr/local/Cellar/b2-tools/4.4.2_1/libexec/bin/pip install "rst2ansi==0.1.5"

Option 4 — Disable rst2ansi entirely edit

You can tell b2 to skip fancy formatting:

b2 --no-color --help

Or:

export B2_USE_PLAIN_TEXT=1

(If the env var doesn't exist, you can patch it by editing the console tool, but usually --no-color is enough.)

✔ What I recommend edit

Start with easiest:

1️⃣ Try:

COLUMNS=80 LINES=24 b2 --help

If it works → it's definitely the Python 3.14 ioctl bug. Then do:

2️⃣ Install older b2-tools linked against Python 3.12.

If you want, I can:

  • Check what brew info b2-tools reports
  • Suggest the exact version to install based on your Homebrew versions
  • Provide a patch to fix the bug inside the installed package

Just paste:

brew info b2-tools
python3 --version

References edit

  1. "B2 tools fix options". ChatGPT. Retrieved 2025-12-12.