From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 085B33858D32 for ; Mon, 27 Feb 2023 17:35:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 085B33858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677519305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pCpr6S/129lylDTuYt2Zfr1b9Jfsa1oObdBZdby55wI=; b=PKIzNzsSQpIZKryZ9i9LRQ5qCWHyt+/J29jYgGtD/hkpr2Zq54l82foZPiMlNfy24U2Owa cgFZCybImzkxfSaiVUB95od29ZFvPcCIQ0VTorN2dxDfNp3FFVF/39w85z6hZz8DsE+HZa JBQHqeZ0ZHBvwRe3tGaH4PA6E+dfWBM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-407-WWUQIaS9Oliaz91hMbM5JQ-1; Mon, 27 Feb 2023 12:35:00 -0500 X-MC-Unique: WWUQIaS9Oliaz91hMbM5JQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BBF181C08782; Mon, 27 Feb 2023 17:34:59 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.45.226.66]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E448A2026D4B; Mon, 27 Feb 2023 17:34:58 +0000 (UTC) From: Florian Weimer To: Gioele Barabucci Cc: Gioele Barabucci via Systemtap Subject: Re: [PATCH] dtrace: Use deterministic temp file creation for all temp files References: <6bfff40c-2c4b-c119-116d-7834310299d7@svario.it> <87fsarm7m5.fsf@oldenburg.str.redhat.com> <3de411c4-8cbd-667b-a64e-aeeac297ea94@svario.it> <87356rm4wx.fsf@oldenburg.str.redhat.com> <9af13f7f-6633-6552-c572-92a45c80c743@svario.it> Date: Mon, 27 Feb 2023 18:34:57 +0100 In-Reply-To: <9af13f7f-6633-6552-c572-92a45c80c743@svario.it> (Gioele Barabucci's message of "Mon, 27 Feb 2023 18:15:02 +0100") Message-ID: <87edqbko5a.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Gioele Barabucci: > @@ -380,6 +373,7 @@ def main(): > usage() > return 1 > > + TEMP_DIR = mkdtemp() > if s_filename != "" and use_cpp: > (ignore, fname) = mktemp_determ(["use_cpp", s_filename], suffix=".d") > cpp = os.environ.get("CPP", "cpp") > @@ -458,6 +452,9 @@ def main(): > else: > print("cpp: " + s_filename) > > + if not keep_temps: > + os.rmdir(TEMP_DIR) This should probably use try:/finally: or a context manager with tempfile.TemporaryDirectory. Thanks, Florian