From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wDJJN16ukWDiRAAAgWs5BA (envelope-from ) for ; Tue, 04 May 2021 22:28:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 4CzyMl6ukWCWMwAA1q6Kng (envelope-from ) for ; Tue, 04 May 2021 20:28:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 51C1F1AD84 for ; Tue, 4 May 2021 22:28:14 +0200 (CEST) Received: from localhost ([::1]:45956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1le1eP-0000tf-CP for larch@yhetil.org; Tue, 04 May 2021 16:28:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1le1dX-0000kX-1m for emacs-orgmode@gnu.org; Tue, 04 May 2021 16:27:19 -0400 Received: from mout01.posteo.de ([185.67.36.65]:33419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1le1dU-0000CF-Oa for emacs-orgmode@gnu.org; Tue, 04 May 2021 16:27:18 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 1F437240026 for ; Tue, 4 May 2021 22:27:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.eu; s=2017; t=1620160034; bh=MQO6oNoe5boJz8sDTinN7HJq+85PTBHfGWqhb+dqKN0=; h=Subject:To:Cc:From:Date:From; b=lXMtVvITIeNTBltEb+Nv/wlwpt95Wq2jLuyk6hSa+sTNMpLfvmK4xZnkSyZmgGwVa /9/PggY6bDkILRNO6YU6hDjvcWC3i9o//02+b3WNslAard4RENI00V6A8ovPB0/1q0 mx7WqeyHVXNk7KyJhNPx15VvblYkTgnu7GDshwdLfmgAxSY7mc9WgymCRtvh3nd3C0 GVg83v+1k1SDA1pMZXnOlLPQ8h7MmpoowhraKxwGVPHGDMj4nxySWAmbvc08BHdBkA kAPecZWb61fZg5bWprq0JxW8Al2hDqQ9KJU3BaZso3lJld8zsObEKdoUjrnA/ghBPO g/E6Y3nL1a+gQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FZWbh54ggz6tm4; Tue, 4 May 2021 22:27:12 +0200 (CEST) Subject: Re: Bug: org-babel-tangle: persmission denied when tangling [9.4.5 (9.4.5-gbc2659 @ /home/n/.emacs.d/straight/build/org/)] To: No Wayman References: <875yzy73k0.fsf@gmail.com> <1e5a447a-2453-09da-fa51-379c9187b210@posteo.eu> <8735v2706t.fsf@gmail.com> From: =?UTF-8?Q?S=c3=a9bastien_Miquel?= Message-ID: Date: Tue, 4 May 2021 20:27:11 +0000 MIME-Version: 1.0 In-Reply-To: <8735v2706t.fsf@gmail.com> Content-Type: multipart/mixed; boundary="------------BE2648F21C5F9BDCE8112080" Content-Language: fr Received-SPF: pass client-ip=185.67.36.65; envelope-from=sebastien.miquel@posteo.eu; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sebastien.miquel@posteo.eu Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620160094; h=from:from:sender:sender:reply-to: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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=OaTIupH/kXPirVNonRWB/VddaNaHvhxV0vyKfW+BZrc=; b=RptFrSjWDslMC9RWIPFe4U6MmCbPXjNqmEqKrsW6MtfoNR5iyrG/+jva7skcK6Lvqp+n+f 4JpKYnL6feZ2i0Zo6u7Zbao1bNPPh1t7V2Fpf8V9fIo1+RIMu1BvK6WjKAWSceZHPrG1y/ pEUehntkS0RPx18X8/wIWJbzB174os682dL7YYS1nXjD3G1euTC+SvMrYDuGVeqkH4s/Nf UPxGaOZK9Xl0EuZg4FnBM1yvSEezjh2BDsJgfmfLowlGfY8dTneJwZBTt5e1tFpary7/8s Nqd9r8EtBgPtcgBs/7xFCwClH9QwlR4pzsLtk9h0oettZHXHc2YyoRQon6kviA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620160094; a=rsa-sha256; cv=none; b=Nbnmg2AjPu3pcQd1QpB9ZAilTP0JJU/uWiYf4lrflzUqwEc34DAfLDeqoz1EN/swiHyJaj Lezsrut3uFSIhHiHwKZ0YlBRQ+/uiyW7cjj49vM3dxJ4EgmtTQorx45+Bm3S2Ohe1oVXzd L3+bgwL8+1gD0xdBF/8qQ7IiJSJZcnKucjvRsqEuDZEvv7jtMkYYrtvZcm9EvlGSTKpmI7 /XTe8wmi6H3L1pR586xmIy2nyqazRkVYPN04yZaNZLg6SM8H2KErZUByDvHQJvcmBYC0TC 069+l7SyaiGNmw7AOsjljMYMBsEi5ULZfrfsecnEsZWgy7g5HXi035QqOJr3GQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=lXMtVvIT; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.66 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=lXMtVvIT; dmarc=pass (policy=none) header.from=posteo.eu; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 51C1F1AD84 X-Spam-Score: -1.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: +4wYcCbWo65K This is a multi-part message in MIME format. --------------BE2648F21C5F9BDCE8112080 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit No Wayman writes: > Subsequent tangles did not fail for me. Ah yes, I understand, it is possible to delete a file without write permission. I'll see if I can fix this bug and keep the security improvements. In the meantime, you can apply the attached patch that should fix your issue. Thank you for the report. -- Sébastien Miquel --------------BE2648F21C5F9BDCE8112080 Content-Type: text/x-patch; charset=UTF-8; name="0001-fix-readonly-tangle.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-fix-readonly-tangle.patch" diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 36144d6ae..c041ff4b3 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -270,9 +270,10 @@ matching a regular expression." (make-directory fnd 'parents)) ;; erase previous file and set permissions on empty ;; file before writing - (write-region "" nil file-name nil 0) - (mapc (lambda (mode) (set-file-modes file-name mode)) modes) + (when (file-exists-p file-name) + (delete-file file-name)) (write-region nil nil file-name) + (mapc (lambda (mode) (set-file-modes file-name mode)) modes) (push file-name path-collector)))))) (if (equal arg '(4)) (org-babel-tangle-single-block 1 t) --------------BE2648F21C5F9BDCE8112080--