From patchwork Tue May 30 18:59:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 686902 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp894955wru; Tue, 30 May 2023 12:05:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4qwp5AwpaBVW5/fX37glQum8VvMBCxq84odVJDAbXxC2rWVx1WlWch6X73iXtOmnHVPheV X-Received: by 2002:a05:620a:4553:b0:75b:23a1:3648 with SMTP id u19-20020a05620a455300b0075b23a13648mr4134317qkp.9.1685473515642; Tue, 30 May 2023 12:05:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685473515; cv=none; d=google.com; s=arc-20160816; b=a0A7YL56CKGLYlHHqQYKiMXWHAnznpD3mgWZl4WzW2sLZmzKso7qTCXHJl5OqcHP2f +GngJPUh2/7HglbZ2qKhlsaBhfIDRABw2L1A3vE3Y3gUl9I5B8O1Gh9mRaXWA6w5XMkm Y7OITMqtuuli2B3Lbf1ck9kOZKY9+oI55iAMTZ0edC1KDvdCxe/K0wJJB56jOBJTYk+w huyJD116R6XCQ0Q9DHwCVqDhqa15e9AC/unnwIY+7cCyfv10cm0tugOqA2mQjUTADVV8 5FZejSmIwzuaIclXd4cb+FPjl9nKHEHAPAwWtreVkUTJzG3LE6L7Q3ZI46vH9XPtmPxL eZyw== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=THhkGZr6a/UiI45iUYjbN0L/k4ifkcv6BhtXqusiewE=; b=iOT0KzVLykRTRE92kP277MmExN+ttGqHrM0u+nmRViWDn8uy9+qzklyH/CPZSIi/6b oDesqnroBxX7uOKyuIJz+hs7oJhN43s1GF/lmRytQDr9qhrkCh8820bWqS/ZJRbwHLzQ 4Np2Evwm9jCLZXvG0Gewmul/+DKC03v762BOHLwIB6nqLlXxZYPMrgNaLpFAmYwqMFw/ 3EQe0wGW7NE4bkhwTOgc5tXP5bedVe3GCHLjFcv0cTckUj+CxuExjZGKetuyrtgULDf6 /Mgv0XSFWZtAKkk7yGmWd4UnJj7+gvZ3q2Bwt8HIM2wRhKr059SJPs4IF0lkTft5OOKi VDaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w2C7V0d3; 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 p13-20020a05620a112d00b0075b1827e151si6704595qkk.407.2023.05.30.12.05.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 May 2023 12:05:15 -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=w2C7V0d3; 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 1q44Zz-0000v1-L9; Tue, 30 May 2023 15:00:23 -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 1q44Zp-0000rc-EF for qemu-devel@nongnu.org; Tue, 30 May 2023 15:00:13 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q44Zn-00018v-Fk for qemu-devel@nongnu.org; Tue, 30 May 2023 15:00:13 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-52cb78647ecso3096438a12.1 for ; Tue, 30 May 2023 12:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685473209; x=1688065209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=THhkGZr6a/UiI45iUYjbN0L/k4ifkcv6BhtXqusiewE=; b=w2C7V0d3nAHhcXPvsJ560J8hhJbC/h9tKhqOQSGC66XeZA03LYJuja81vH7acrrL6O fjv01ELyiRYMojImH7vqKJ8ejSO05DC00Pe0l9Q+DpW7tEp8u5BhcX6AP88+N74U8VVk D4BCKk6N0HO7aLIelgncSycV28YK6e6mwYYG9kAAE5NOEqILYe+yfeCD0hP3Wjlz4B4j VRbl40g9fBHHOHUc85tx6kXIK1dnVOw6l0HEb0H2V58YIYH79H6CFPGjjsiz7zl5E7LR gGtcZLRaYb566lPzUJ5C+pmrG+uP+kdcQdpMBxsxzc4Cu0cR5JQygHnyaocG9aqcxxPk JmXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685473209; x=1688065209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=THhkGZr6a/UiI45iUYjbN0L/k4ifkcv6BhtXqusiewE=; b=M44TARXEcs+L7IvAG6RgvQI38ehLkEDxnMJHl5HwYW7gcKZurShbDTXVKETOoDxCnI ZoRlaQ1iINdtZd/jo84O+gCO9SbE3Z5cnIL4CewXb0YBu8QCQjxDMtcM0sqwxBRXPvIe vkFiwa+fG5xazfXbkOmaGPFaKDMvRuIMhcByXkCe3kz5voov5fJo5qBmuuNV2RjNtp9J 1ub7yrrDw4/Lpz3KEfK2u5yAzkbbhi5Dwf7TLhz01XjoVI6VjSx229teazPrMAk4UE8d lm3G4w08Ps49WZjNu4ahffgXfk1wiH7eEauiIdbXE6tVv9JsDc0zyTBRd/lcWmRO+sMc ND6g== X-Gm-Message-State: AC+VfDxbaPtrn1PsGJ5LBgrNAcOdXege+4zcxh02Odw+xU6+G6QLQDK9 ik51qqpQ2m3UjNsgezehtgiCCBtCbXHPDyi5rFE= X-Received: by 2002:a05:6a20:1610:b0:10b:8698:2097 with SMTP id l16-20020a056a20161000b0010b86982097mr4169932pzj.0.1685473209289; Tue, 30 May 2023 12:00:09 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:35a2:c45d:7485:f488]) by smtp.gmail.com with ESMTPSA id g18-20020a63fa52000000b0051f14839bf3sm9128496pgk.34.2023.05.30.12.00.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 12:00:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 21/27] decodetree: Do not remove output_file from /dev Date: Tue, 30 May 2023 11:59:43 -0700 Message-Id: <20230530185949.410208-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530185949.410208-1-richard.henderson@linaro.org> References: <20230530185949.410208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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. The primary purpose is testing with -o /dev/null. 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