From patchwork Fri May 26 17:40:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 685933 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1046383wrt; Fri, 26 May 2023 10:41:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ctA9mFlPgt5YFP9oCHMuNpW+6spfOVlLqoqnxEJCHi2RnuUas4+pfP0eBL9eWgLPePbPX X-Received: by 2002:a05:6214:f0c:b0:625:aa1a:b6d7 with SMTP id gw12-20020a0562140f0c00b00625aa1ab6d7mr3329367qvb.57.1685122881218; Fri, 26 May 2023 10:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685122881; cv=none; d=google.com; s=arc-20160816; b=swQDMKjV8RiE3eESI3uw+nGfocAyAN0ryAmGZdBjXYKQuuvBUp3W5jgRjsOSuzF7n/ FgWHESqDjqHNxc4+EkvAsCh5OzA+4+a62GOXN1odrEEfuUOuvF9pAKPeTFJBzuRK1HJy KaAO1Z6Q2yGpP4Tlmp/r4T1TpEOgvZwNWmuayefO8dPCoIF9jv/AqA8A3QXlN3Sq3BLK jpJyIHjMEE9Okqz4x4Vs9jsseTlJmxXn+oAYM0nn3S95nGfkn3UW5ecn2pstabVg1JZJ bwiZDBwK9Wy19mib0NKuyc7aM4BqInnps4kOSqxkky10JFnAkKIZWrPYpVyIK2P76G+d LlVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=yUy/aMUiAhZ360nTPVM0iei+KMQ1HuLh5k4JhFoRsN8=; b=raFODmwT69/XTXb9noPHvrAxyjkReftN1litBRuZIuNVmwx0wMIMLApeklU86y3Xd/ fuMgSwknK1hg2u9zVX3XDBkshpcKOgcjvV8AC2OmNYWf5XrSPL8xKBio09dDtWZxvtLU 94DG8l69oVZc2Tnv/6GzWlDMYkEjVBSb+oUTLjjJd5wwl/aAfkfS6vhykmg/qjiPn110 x88gR3N7IrGZiLneNSaOXxJBK2xvAZwm7sjBhKiuq1FL8wvfUK8fFYfUtZktQ9yaHQzb thyXcn/sgEkUsPw5ZpYQlGslzEC4hjQ7DC5HV8KVkECRraponbzRw8IVoJ60YOpvDWzv VnUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l5f66zDU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u22-20020a05620a121600b007467da8ab5dsi1575489qkj.517.2023.05.26.10.41.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 May 2023 10:41:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l5f66zDU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2bQE-0005pk-Sm; Fri, 26 May 2023 13:40:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2bQA-0005pR-E2 for qemu-devel@nongnu.org; Fri, 26 May 2023 13:40:11 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q2bQ8-0002B8-I5 for qemu-devel@nongnu.org; Fri, 26 May 2023 13:40:10 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-64d2a613ec4so939344b3a.1 for ; Fri, 26 May 2023 10:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685122807; x=1687714807; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yUy/aMUiAhZ360nTPVM0iei+KMQ1HuLh5k4JhFoRsN8=; b=l5f66zDUworPUaTfRnDGmELZulPJ3e6sCUWANZ7z9gHT5hvHnxoAgy9D0dfZSh7Zuh zhMjJGztrrYEzoz/vEMWi21N2qqqNWEtdyLKLp+baKkorKLTQEKgxu+k6VhjEN7jYTF2 FZL7RcFC/WTimlND7s+FW8R6FoTeQEvCjKbZfXq7YmJEyOYko2hFNK05zqHYNAKcAXbi HMliutL2RYP68QdoDqSeA4ika//SP1ZLGZpDkKcZoJKhrl20xjv4FMnE0wdTMD2kPMEX qD5/h0FxJPd4f9ufHsOjGUTbK0IaN9/kyM9ObBfvPxDOKDcjdaLKqLN/OKSzaquR/PGw DTug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685122807; x=1687714807; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yUy/aMUiAhZ360nTPVM0iei+KMQ1HuLh5k4JhFoRsN8=; b=Blk2YUcZyBvOSf/bvyjsUtJSFPFaxBPmw0mT4TJOmMsH4TsYYz6mRy7Rdn6ZNNcJBS eliY1645BJakyfWhiZ++qwtF77unGxBXYV96mPzRPWar7HTpZrynu8c4Ex24SCthPcAf Aa44gVyQgINgI8/+q4V5D0gL5FUpcB69FdS2jjhM1RAWtYvyJ9OEKnxSGGLhz5Rz79JP 6Yv1v5CNUxNQZ0EDK92eiiTcDYSozM0AGV0J1zrli0qmOcPFqZCO6yFpud4j5Ehh8fGk tTd0J6OJvTzH5tYJ5faedfZ1CeGM/RZn8BvNhlM1tD+/UjxbvSm1VEPeMNKHUcRWRRCS GywA== X-Gm-Message-State: AC+VfDxQRmcJ1pnmJvNlC8xteI+Hk71FnxYSp6qK95hOFOkm5DJ1bzKP ZXNy7AbEL9FEZZbCVx1ujhvQNW9VLYOAad5n7MI= X-Received: by 2002:a05:6a20:158a:b0:104:873:c3b5 with SMTP id h10-20020a056a20158a00b001040873c3b5mr65903pzj.44.1685122806874; Fri, 26 May 2023 10:40:06 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:86cc:4482:68db:2c0f]) by smtp.gmail.com with ESMTPSA id c26-20020a62e81a000000b0064cb464e08fsm3089902pfi.15.2023.05.26.10.40.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 10:40:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH] decodetree: Do not remove output_file from /dev Date: Fri, 26 May 2023 10:40:05 -0700 Message-Id: <20230526174005.1801043-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Nor report any PermissionError on remove. Previously we were testing with "> /dev/null", but that's not easy to do with meson test(), so we want to use '-o /dev/null' instead. That works fine for all of the existing tests, where all errors are diagnosed before opening the output file. However, PMM's named field patch set diagnoses cycle errors during output. This is fair, but we need to be more careful with the remove. Signed-off-by: Richard Henderson --- scripts/decodetree.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/decodetree.py b/scripts/decodetree.py index e4ef0a03cc..a9a0cd0fa3 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -71,7 +71,12 @@ def error_with_file(file, lineno, *args): if output_file and output_fd: output_fd.close() - os.remove(output_file) + # Do not try to remove e.g. -o /dev/null + if not output_file.startswith("/dev"): + try: + os.remove(output_file) + except PermissionError: + pass exit(0 if testforerror else 1) # end error_with_file