tests/test-obsolete-bounds-checking.t
author Arseniy Alekseyev <aalekseyev@janestreet.com>
Thu, 04 Apr 2024 14:15:32 +0100
branchstable
changeset 51572 13c004b54cbe
parent 50725 7e5be4a7cda7
permissions -rw-r--r--
wireprotoserver: ensure that output stream gets flushed on exception Previously flush was happening due to Python finalizer being run on `BufferedWriter`. With upgrade to Python 3.11 this started randomly failing. My guess is that the finalizer on the raw `FileIO` object may be running before the finalizer of `BufferedWriter` has a chance to run. At any rate, since we're not relying on finalizers in the happy case we should also not rely on them in case of exception.

Create a repo, set the username to something more than 255 bytes, then run hg amend on it.

  $ unset HGUSER
  $ cat >> $HGRCPATH << EOF
  > [ui]
  > username = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa <very.long.name@example.com>
  > [extensions]
  > amend =
  > [experimental]
  > evolution.createmarkers=True
  > evolution.exchange=True
  > EOF
  $ hg init tmpa
  $ cd tmpa
  $ echo a > a
  $ hg add
  adding a
  $ hg commit -m "Initial commit"
  $ echo a >> a
  $ hg amend 2>&1 | grep -E -v '^(\*\*|  )'
  transaction abort!
  rollback completed
  Traceback (most recent call last):
  *ProgrammingError: obsstore metadata value cannot be longer than 255 bytes (value "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa <very.long.name@example.com>" for key "user" is 285 bytes) (glob)