prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  tput smam breaks build
  Using latest on Debian Sid.
  
  ```
  ‣  Running finalize script…
  ‣  Creating tar archive /home/ander/Desktop/mkosi/tools/mkosi.workspace/.mkosi-tmp9zitpbja/staging/image.tar…
  ‣  /home/ander/Desktop/mkosi/tools/mkosi.output/image size is 1016.1M, consumes 1016.1M.
  ‣ "tput smam" returned non-zero exit code 1.
  make: *** [Makefile:13: build] Error 1
  ```
  
  `tput` in Debian do not understand `smam`?
  
  ```
  $ tput smam; echo $?
  1
  ```
  
  Introduced in e651b88.
  
  Ugly workaround:
  ```
  $ ln -s /usr/bin/true ~/.local/bin/tput
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mkosi/__main__.py`
  Content:
  ```
  1 # SPDX-License-Identifier: LGPL-2.1+
  2 # PYTHON_ARGCOMPLETE_OK
  3 
  4 import contextlib
  5 import logging
  6 import shutil
  7 import subprocess
  8 import sys
  9 from collections.abc import Iterator
  10 
  11 from mkosi import run_verb
  12 from mkosi.config import MkosiConfigParser
  13 from mkosi.log import ARG_DEBUG, log_setup
  14 from mkosi.run import ensure_exc_info, run
  15 
  16 
  17 @contextlib.contextmanager
  18 def propagate_failed_return() -> Iterator[None]:
  19     try:
  20         yield
  21     except SystemExit as e:
  22         if ARG_DEBUG.get():
  23             sys.excepthook(*ensure_exc_info())
  24 
  25         sys.exit(e.code)
  26     except KeyboardInterrupt:
  27         if ARG_DEBUG.get():
  28             sys.excepthook(*ensure_exc_info())
  29         else:
  30             logging.error("Interrupted")
  31 
  32         sys.exit(1)
  33     except subprocess.CalledProcessError as e:
  34         # Failures from qemu, ssh and systemd-nspawn are expected and we won't log stacktraces for those.
  35         if ARG_DEBUG.get() and e.cmd and e.cmd[0] not in ("qemu", "ssh", "systemd-nspawn"):
  36             sys.excepthook(*ensure_exc_info())
  37 
  38         # We always log when subprocess.CalledProcessError is raised, so we don't log again here.
  39         sys.exit(e.returncode)
  40 
  41 
  42 @propagate_failed_return()
  43 def main() -> None:
  44     log_setup()
  45     args, presets = MkosiConfigParser().parse()
  46 
  47     if ARG_DEBUG.get():
  48         logging.getLogger().setLevel(logging.DEBUG)
  49 
  50     try:
  51         run_verb(args, presets)
  52     finally:
  53         if sys.stderr.isatty() and shutil.which("tput"):
  54             run(["tput", "cnorm"])
  55             run(["tput", "smam"])
  56 
  57 
  58 if __name__ == "__main__":
  59     main()
  60
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/mkosi/__main__.py b/mkosi/__main__.py
  --- a/mkosi/__main__.py
  +++ b/mkosi/__main__.py
  @@ -51,8 +51,8 @@
           run_verb(args, presets)
       finally:
           if sys.stderr.isatty() and shutil.which("tput"):
  -            run(["tput", "cnorm"])
  -            run(["tput", "smam"])
  +            run(["tput", "cnorm"], check=False)
  +            run(["tput", "smam"], check=False)
   
   
   if __name__ == "__main__":
  
verification_info: {"golden_diff": "diff --git a/mkosi/__main__.py b/mkosi/__main__.py\n--- a/mkosi/__main__.py\n+++ b/mkosi/__main__.py\n@@ -51,8 +51,8 @@\n         run_verb(args, presets)\n     finally:\n         if sys.stderr.isatty() and shutil.which(\"tput\"):\n-            run([\"tput\", \"cnorm\"])\n-            run([\"tput\", \"smam\"])\n+            run([\"tput\", \"cnorm\"], check=False)\n+            run([\"tput\", \"smam\"], check=False)\n \n \n if __name__ == \"__main__\":\n", "issue": "tput smam breaks build\nUsing latest on Debian Sid.\r\n\r\n```\r\n\u2023  Running finalize script\u2026\r\n\u2023  Creating tar archive /home/ander/Desktop/mkosi/tools/mkosi.workspace/.mkosi-tmp9zitpbja/staging/image.tar\u2026\r\n\u2023  /home/ander/Desktop/mkosi/tools/mkosi.output/image size is 1016.1M, consumes 1016.1M.\r\n\u2023 \"tput smam\" returned non-zero exit code 1.\r\nmake: *** [Makefile:13: build] Error 1\r\n```\r\n\r\n`tput` in Debian do not understand `smam`?\r\n\r\n```\r\n$ tput smam; echo $?\r\n1\r\n```\r\n\r\nIntroduced in e651b88.\r\n\r\nUgly workaround:\r\n```\r\n$ ln -s /usr/bin/true ~/.local/bin/tput\r\n```\n", "before_files": [{"content": "# SPDX-License-Identifier: LGPL-2.1+\n# PYTHON_ARGCOMPLETE_OK\n\nimport contextlib\nimport logging\nimport shutil\nimport subprocess\nimport sys\nfrom collections.abc import Iterator\n\nfrom mkosi import run_verb\nfrom mkosi.config import MkosiConfigParser\nfrom mkosi.log import ARG_DEBUG, log_setup\nfrom mkosi.run import ensure_exc_info, run\n\n\n@contextlib.contextmanager\ndef propagate_failed_return() -> Iterator[None]:\n    try:\n        yield\n    except SystemExit as e:\n        if ARG_DEBUG.get():\n            sys.excepthook(*ensure_exc_info())\n\n        sys.exit(e.code)\n    except KeyboardInterrupt:\n        if ARG_DEBUG.get():\n            sys.excepthook(*ensure_exc_info())\n        else:\n            logging.error(\"Interrupted\")\n\n        sys.exit(1)\n    except subprocess.CalledProcessError as e:\n        # Failures from qemu, ssh and systemd-nspawn are expected and we won't log stacktraces for those.\n        if ARG_DEBUG.get() and e.cmd and e.cmd[0] not in (\"qemu\", \"ssh\", \"systemd-nspawn\"):\n            sys.excepthook(*ensure_exc_info())\n\n        # We always log when subprocess.CalledProcessError is raised, so we don't log again here.\n        sys.exit(e.returncode)\n\n\n@propagate_failed_return()\ndef main() -> None:\n    log_setup()\n    args, presets = MkosiConfigParser().parse()\n\n    if ARG_DEBUG.get():\n        logging.getLogger().setLevel(logging.DEBUG)\n\n    try:\n        run_verb(args, presets)\n    finally:\n        if sys.stderr.isatty() and shutil.which(\"tput\"):\n            run([\"tput\", \"cnorm\"])\n            run([\"tput\", \"smam\"])\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "mkosi/__main__.py"}], "after_files": [{"content": "# SPDX-License-Identifier: LGPL-2.1+\n# PYTHON_ARGCOMPLETE_OK\n\nimport contextlib\nimport logging\nimport shutil\nimport subprocess\nimport sys\nfrom collections.abc import Iterator\n\nfrom mkosi import run_verb\nfrom mkosi.config import MkosiConfigParser\nfrom mkosi.log import ARG_DEBUG, log_setup\nfrom mkosi.run import ensure_exc_info, run\n\n\n@contextlib.contextmanager\ndef propagate_failed_return() -> Iterator[None]:\n    try:\n        yield\n    except SystemExit as e:\n        if ARG_DEBUG.get():\n            sys.excepthook(*ensure_exc_info())\n\n        sys.exit(e.code)\n    except KeyboardInterrupt:\n        if ARG_DEBUG.get():\n            sys.excepthook(*ensure_exc_info())\n        else:\n            logging.error(\"Interrupted\")\n\n        sys.exit(1)\n    except subprocess.CalledProcessError as e:\n        # Failures from qemu, ssh and systemd-nspawn are expected and we won't log stacktraces for those.\n        if ARG_DEBUG.get() and e.cmd and e.cmd[0] not in (\"qemu\", \"ssh\", \"systemd-nspawn\"):\n            sys.excepthook(*ensure_exc_info())\n\n        # We always log when subprocess.CalledProcessError is raised, so we don't log again here.\n        sys.exit(e.returncode)\n\n\n@propagate_failed_return()\ndef main() -> None:\n    log_setup()\n    args, presets = MkosiConfigParser().parse()\n\n    if ARG_DEBUG.get():\n        logging.getLogger().setLevel(logging.DEBUG)\n\n    try:\n        run_verb(args, presets)\n    finally:\n        if sys.stderr.isatty() and shutil.which(\"tput\"):\n            run([\"tput\", \"cnorm\"], check=False)\n            run([\"tput\", \"smam\"], check=False)\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "mkosi/__main__.py"}]}