From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8EFE115800F for ; Tue, 17 Jan 2023 20:46:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8039DE07FE; Tue, 17 Jan 2023 20:46:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6AFAFE07FE for ; Tue, 17 Jan 2023 20:46:19 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5852433BE41 for ; Tue, 17 Jan 2023 20:46:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 046C4851 for ; Tue, 17 Jan 2023 20:46:16 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1673988363.67f57cab42a865339096d0305f7773006dafab2e.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/sync/ X-VCS-Repository: proj/pkgcore/pkgcore X-VCS-Files: src/pkgcore/sync/base.py X-VCS-Directories: src/pkgcore/sync/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 67f57cab42a865339096d0305f7773006dafab2e X-VCS-Branch: master Date: Tue, 17 Jan 2023 20:46:16 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 896a81a3-4b35-493a-9ef1-f39872b5e823 X-Archives-Hash: 772fc20d0ebe3904c265fd1e510224be commit: 67f57cab42a865339096d0305f7773006dafab2e Author: Brian Harring gmail com> AuthorDate: Tue Jan 10 10:00:23 2023 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Tue Jan 17 20:46:03 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=67f57cab fix(sync): Add loggger.debug() of the sync command actually being invoked. Additionally, since we know the sync subsystem was written before basic sanity of the frontend, and we know that it invokes processes that write to stdout/stderr, force a flush of those handles to ensure that we don't wind up with interlaced output from two processes. The need to bury a flush here is a sign that the abstraction needs redesign, but that's a problem for a later date. Signed-off-by: Brian Harring gmail.com> Signed-off-by: Arthur Zamarin gentoo.org> src/pkgcore/sync/base.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pkgcore/sync/base.py b/src/pkgcore/sync/base.py index 1114532fb..f015cd2c0 100644 --- a/src/pkgcore/sync/base.py +++ b/src/pkgcore/sync/base.py @@ -14,6 +14,7 @@ __all__ = ( import os import pwd import stat +import sys import typing from importlib import import_module @@ -22,6 +23,7 @@ from snakeoil import process from .. import os_data from ..config.hint import ConfigHint, configurable from ..exceptions import PkgcoreUserException +from ..log import logger class SyncError(PkgcoreUserException): @@ -195,6 +197,12 @@ class ExternalSyncer(Syncer): # Note: stderr is explicitly forced to stdout since that's how it was originally done. # This can be changed w/ a discussion. kwargs.setdefault("fd_pipes", {1: 1, 2: 1}) + logger.debug("sync invoking command %r, kwargs %r", command, kwargs) + # since we're intermixing two processes writing to stdout/stderr- us, and what we're invoking- + # force a flush to keep output from being interlaced. This is not hugely optimal, but + # the CLI/observability integration needs refactoring anyways. + sys.stdout.flush() + sys.stderr.flush() return process.spawn.spawn( command, uid=self.uid, gid=self.gid, env=self.env, **kwargs )