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
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)