Subject: bug#63578: 29.0.91; Org Cannot tangle with tramp using sudo

From: Ihor Radchenko <[email-masked]>
Date: Fri, 19 May 2023 06:32:33 +0000

Eli Zaretskii <[email-masked]> writes:

>> Triyng to tangle this org block on emacs 29.0.91 with emacs -Q
>> 
>> #+begin_src conf :tangle /ssh:user@server|sudo::/etc/test.conf
>> test
>> #+end_src
>> 
>> It hangs with Opening connection nil for root@server using sudo.... If I
>> install emacs 28 everything works fine.
> ...
> Adding Org developers to CC, in case Org has something to do with
> this.

It would help to do M-x toggle-debug-on-quit ... try to tangle ... C-g,
and share the backtrace.

The suspicious, recently changed part of the tangle code is below.
I do not see anything fishy there, even when file is remote.

(unless
                       (and (file-exists-p file-name)
                            (let ((tangle-buf (current-buffer)))
                              (with-temp-buffer
                                (insert-file-contents file-name)
                                (and
                                 (equal (buffer-size)
                                        (buffer-size tangle-buf))
                                 (= 0
                                    (let (case-fold-search)
                                      (compare-buffer-substrings
                                       nil nil nil
                                       tangle-buf nil nil)))))))
                     ;; erase previous file
                     (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))

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>