Subject: Re: bug#1862: 23.0.60; tar-mode on posix ustar

From: Kevin Ryde <[email-masked]>
Date: Fri, 16 Jan 2009 11:18:45 +1100

Stefan Monnier <[email-masked]> writes:
>
> Indeed, the code didn't pay attention to the version field, but
> incorrectly clipped it out.  I've installed a similar fix to yours, just
> a bit simpler.

Does tar-rename-entry have to notice the shorter magic-str now too?
Maybe something like the following, with the happy side effect of no
longer writing a \0 in the version field, rather digits 00 per posix.

Note totally untested!, as my build is in a rather broken state at the
moment ... :-)

*** tar-mode.el	14 Jan 2009 07:53:50 +1100	1.136
--- tar-mode.el	16 Jan 2009 11:10:21 +1100	
***************
*** 1053,1060 ****
                 (string-match "/" encoded-new-name
  			     (- (length encoded-new-name) 99))
  	       (< (match-beginning 0) 155))
!       (unless (equal (tar-header-magic descriptor) "ustar\0\0")
!         (tar-alter-one-field tar-magic-offset "ustar\0\0"))
        (setq prefix (substring encoded-new-name 0 (match-beginning 0)))
        (setq encoded-new-name (substring encoded-new-name (match-end 0))))
  
--- 1053,1060 ----
                 (string-match "/" encoded-new-name
  			     (- (length encoded-new-name) 99))
  	       (< (match-beginning 0) 155))
!       (unless (equal (tar-header-magic descriptor) "ustar\0")
!         (tar-alter-one-field tar-magic-offset "ustar\0\060\060"))
        (setq prefix (substring encoded-new-name 0 (match-beginning 0)))
        (setq encoded-new-name (substring encoded-new-name (match-end 0))))