bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14652: 24.3; ZIP files corrupted when saved via tramp


From: Michael Albinus
Subject: bug#14652: 24.3; ZIP files corrupted when saved via tramp
Date: Thu, 20 Jun 2013 14:02:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

JuanLeon Lahoz <juanleon.lahoz@gmail.com> writes:

> Dear Emacs maintainers,

Hi,

> The funny thing is that when I modify the zip file locally, it works
> fine and emacs does not remind me I need to save the zip file (emacs
> reminds me to do it with the tgz file), but remotely emacs reminds me
> to save the zip file. When I do, it gets corrupted.
>
> I was not sure if the problem lies within tramp or in the emacs code
> that deals with zip files, so I filed a bug report to tramp. Here is
> their answer:
>
> I would say it is due to arc-mode.el. I've checked the code shortly;
> it uses `call-process' internally, which is not prepared for remote
> files.  Replacing all such calls by `process-file' was not reasonable,
> at least handling of temporary files must be improved as well.

I have checked arc-mode.el in detail; the usage of `call-process' is not
a problem, because it is applied on local copies of the archive.

Archives could be marked as "remote". In that case, the archive is not
saved by intention when it is modified, but the message mentioned above
appears.

However, the following patch I have committed to the trunk allows to
save the archive by "C-x C-s" (this is `save-buffer'), without
corrupting the archive:

--8<---------------cut here---------------start------------->8---
*** ~/src/emacs/lisp/arc-mode.el.~113092~  2013-06-20 13:56:09.298495645 +0200
--- ~/src/emacs/lisp/arc-mode.el         2013-06-20 13:40:03.496925664 +0200
***************
*** 689,697 ****
    (setq revert-buffer-function 'archive-mode-revert)
    (auto-save-mode 0)
  
!       ;; Remote archives are not written by a hook.
!       (if archive-remote nil
!         (add-hook 'write-contents-functions 'archive-write-file nil t))
  
        (make-local-variable 'require-final-newline)
        (setq require-final-newline nil)
--- 689,695 ----
    (setq revert-buffer-function 'archive-mode-revert)
    (auto-save-mode 0)
  
!       (add-hook 'write-contents-functions 'archive-write-file nil t)
  
        (make-local-variable 'require-final-newline)
        (setq require-final-newline nil)
--8<---------------cut here---------------end--------------->8---

> (I would appreciate very much a way to get a patch for fixing this,
> if/when available)

Could you, please, check whether the patch works for you?

Best regards, Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]