Containers: remove debug messages (via files)

Remove container_log messages ahead of debug info being sent over
standard streams.
This commit is contained in:
deeplow 2023-11-20 08:48:45 +00:00
parent dca46d0a6b
commit 331b6514e8
No known key found for this signature in database
GPG key ID: 577982871529A52A
3 changed files with 2 additions and 31 deletions

View file

@ -309,10 +309,6 @@ async def main() -> int:
except Exception as e:
converter.update_progress(str(e), error=True)
error_code = errors.UnexpectedConversionError.error_code
if not running_on_qubes():
# Write debug information (containers version)
with open("/tmp/dangerzone/captured_output.txt", "wb") as container_log:
container_log.write(converter.captured_output)
return error_code

View file

@ -97,17 +97,10 @@ async def main() -> int:
try:
await converter.convert(ocr_lang)
error_code = 0 # Success!
return 0
except (RuntimeError, TimeoutError, ValueError) as e:
converter.update_progress(str(e), error=True)
error_code = 1
if not running_on_qubes():
# Write debug information (containers version)
with open("/safezone/captured_output.txt", "wb") as container_log:
container_log.write(converter.captured_output)
return error_code
return 1
if __name__ == "__main__":

View file

@ -296,14 +296,6 @@ class Container(IsolationProvider):
]
ret = self.exec_container(document, command, extra_args)
if getattr(sys, "dangerzone_dev", False):
log_path = pixel_dir / "captured_output.txt"
with open(log_path, "r", encoding="ascii", errors="replace") as f:
untrusted_log = f.read(MAX_CONVERSION_LOG_CHARS)
log.info(
f"Conversion output (doc to pixels):\n{self.sanitize_conversion_str(untrusted_log)}"
)
if ret != 0:
log.error("documents-to-pixels failed")
@ -348,16 +340,6 @@ class Container(IsolationProvider):
# We did it
success = True
if getattr(sys, "dangerzone_dev", False):
log_path = safe_dir / "captured_output.txt"
if log_path.exists(): # If first stage failed this may not exist
with open(log_path, "r", encoding="ascii", errors="replace") as f:
text = (
f"Container output: (pixels to PDF)\n"
f"{PIXELS_TO_PDF_LOG_START}\n{f.read()}{PIXELS_TO_PDF_LOG_END}"
)
log.info(text)
return success
def get_max_parallel_conversions(self) -> int: