GNU bug report logs - #14652
24.3; ZIP files corrupted when saved via tramp

Previous Next

Package: emacs;

Reported by: JuanLeon Lahoz <juanleon.lahoz <at> gmail.com>

Date: Tue, 18 Jun 2013 15:50:02 UTC

Severity: important

Found in version 24.3

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 14652 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: JuanLeon Lahoz <juanleon.lahoz <at> gmail.com>
Cc: 14652 <at> debbugs.gnu.org
Subject: Re: bug#14652: 24.3; ZIP files corrupted when saved via tramp
Date: Thu, 20 Jun 2013 14:02:10 +0200
JuanLeon Lahoz <juanleon.lahoz <at> 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.




This bug report was last modified 11 years and 341 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.