unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4730: 23.1; tar-chown-entry corrupts tar file
@ 2009-10-15 16:31 ` Dan McCarthy
  2009-10-17  4:45   ` bug#4730: marked as done (23.1; tar-chown-entry corrupts tar file) Emacs bug Tracking System
  0 siblings, 1 reply; 2+ messages in thread
From: Dan McCarthy @ 2009-10-15 16:31 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2514 bytes --]

If I'm editing a tar file, and I change a subfile's owner or group, I
get the following:

Debugger entered--Lisp error: (cl-assertion-failed (not (or
enable-multibyte-cha
racters (multibyte-string-p new-data-string))))
  signal(cl-assertion-failed ((not (or enable-multibyte-characters ...))))
  tar-alter-one-field(265 "root  tar-chown-entry("root")
  call-interactively(tar-chown-entry nil nil)

and tar will be unable to read that particular tar header. I'm
able to work around it with the following advice:

(defadvice tar-alter-one-field (around fix-multibyte-input)
  (let ((new-data-string (ad-get-arg 1)))
    (if (multibyte-string-p new-data-string)
        (ad-set-arg 1 (string-to-unibyte new-data-string)))
    ad-do-it))

This is on a Debian 4.0 box with GNU tar 1.16.

In GNU Emacs 23.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2009-08-03 on discordia
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--with-x-toolkit=gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Tar

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <down-mouse-1> <mouse-1> C-x C-f f o o
<tab> . t <tab> <return> M-x t o g g l e - d e b u
g - <tab> e <tab> <return> O <C-backspace> r o o t
<return> <help-echo> <help-echo> <help-echo> <help-echo>
<down-mouse-1> <mouse-1> M-x r e p o <tab> r t - =
<backspace> e m a c s - b u g <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Parsing tar file...done
Loading vc-svn...done
Debug on Error enabled globally
Entering debugger...
Buffer foo.tar has shrunk a lot; auto save disabled in that buffer until
next re
al save
Making completion list...

[-- Attachment #2: Type: text/html, Size: 3031 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#4730: marked as done (23.1; tar-chown-entry corrupts tar file)
  2009-10-15 16:31 ` bug#4730: 23.1; tar-chown-entry corrupts tar file Dan McCarthy
@ 2009-10-17  4:45   ` Emacs bug Tracking System
  0 siblings, 0 replies; 2+ messages in thread
From: Emacs bug Tracking System @ 2009-10-17  4:45 UTC (permalink / raw)
  To: Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

Your message dated Sat, 17 Oct 2009 00:35:06 -0400
with message-id <jwv7huuzlj6.fsf-monnier+emacsbugreports@gnu.org>
and subject line Re: bug#4730: 23.1; tar-chown-entry corrupts tar file
has caused the Emacs bug report #4730,
regarding 23.1; tar-chown-entry corrupts tar file
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
4730: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4730
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 8739 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 2514 bytes --]

If I'm editing a tar file, and I change a subfile's owner or group, I
get the following:

Debugger entered--Lisp error: (cl-assertion-failed (not (or
enable-multibyte-cha
racters (multibyte-string-p new-data-string))))
  signal(cl-assertion-failed ((not (or enable-multibyte-characters ...))))
  tar-alter-one-field(265 "root  tar-chown-entry("root")
  call-interactively(tar-chown-entry nil nil)

and tar will be unable to read that particular tar header. I'm
able to work around it with the following advice:

(defadvice tar-alter-one-field (around fix-multibyte-input)
  (let ((new-data-string (ad-get-arg 1)))
    (if (multibyte-string-p new-data-string)
        (ad-set-arg 1 (string-to-unibyte new-data-string)))
    ad-do-it))

This is on a Debian 4.0 box with GNU tar 1.16.

In GNU Emacs 23.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2009-08-03 on discordia
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--with-x-toolkit=gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Tar

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <down-mouse-1> <mouse-1> C-x C-f f o o
<tab> . t <tab> <return> M-x t o g g l e - d e b u
g - <tab> e <tab> <return> O <C-backspace> r o o t
<return> <help-echo> <help-echo> <help-echo> <help-echo>
<down-mouse-1> <mouse-1> M-x r e p o <tab> r t - =
<backspace> e m a c s - b u g <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Parsing tar file...done
Loading vc-svn...done
Debug on Error enabled globally
Entering debugger...
Buffer foo.tar has shrunk a lot; auto save disabled in that buffer until
next re
al save
Making completion list...

[-- Attachment #2.1.2: Type: text/html, Size: 3031 bytes --]

[-- Attachment #3: Type: message/rfc822, Size: 4082 bytes --]

From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dan McCarthy <daniel.c.mccarthy@gmail.com>
Subject: Re: bug#4730: 23.1; tar-chown-entry corrupts tar file
Date: Sat, 17 Oct 2009 00:35:06 -0400
Message-ID: <jwv7huuzlj6.fsf-monnier+emacsbugreports@gnu.org>

> If I'm editing a tar file, and I change a subfile's owner or group, I
> get the following:

> Debugger entered--Lisp error: (cl-assertion-failed (not (or
> enable-multibyte-cha
> racters (multibyte-string-p new-data-string))))
>   signal(cl-assertion-failed ((not (or enable-multibyte-characters ...))))
>   tar-alter-one-field(265 "root  tar-chown-entry("root")
>   call-interactively(tar-chown-entry nil nil)

Thank you.
I've installed the patch below which fixes it,


        Stefan


--- tar-mode.el.~1.141.~	2009-09-03 23:06:21.000000000 -0400
+++ tar-mode.el	2009-10-17 00:31:24.000000000 -0400
@@ -312,8 +313,12 @@
            link-p
            linkname
            uname-valid-p
-           (and uname-valid-p (substring string tar-uname-offset uname-end))
-           (and uname-valid-p (substring string tar-gname-offset gname-end))
+           (when uname-valid-p
+             (decode-coding-string
+              (substring string tar-uname-offset uname-end) coding))
+           (when uname-valid-p
+             (decode-coding-string
+              (substring string tar-gname-offset gname-end) coding))
            (tar-parse-octal-integer string tar-dmaj-offset tar-dmin-offset)
            (tar-parse-octal-integer string tar-dmin-offset tar-prefix-offset)
            ))))))
@@ -1013,7 +1018,10 @@
         (read-string "New UID string: " (tar-header-uname descriptor))))))
   (cond ((stringp new-uid)
 	 (setf (tar-header-uname (tar-current-descriptor)) new-uid)
-	 (tar-alter-one-field tar-uname-offset (concat new-uid "\000")))
+	 (tar-alter-one-field tar-uname-offset
+                              (concat (encode-coding-string
+                                       new-uid tar-file-name-coding-system)
+                                      "\000")))
 	(t
 	 (setf (tar-header-uid (tar-current-descriptor)) new-uid)
 	 (tar-alter-one-field tar-uid-offset
@@ -1039,7 +1047,9 @@
   (cond ((stringp new-gid)
 	 (setf (tar-header-gname (tar-current-descriptor)) new-gid)
 	 (tar-alter-one-field tar-gname-offset
-	   (concat new-gid "\000")))
+                              (concat (encode-coding-string
+                                       new-gid tar-file-name-coding-system)
+                                      "\000")))
 	(t
 	 (setf (tar-header-gid (tar-current-descriptor)) new-gid)
 	 (tar-alter-one-field tar-gid-offset

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-17  4:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <jwv7huuzlj6.fsf-monnier+emacsbugreports@gnu.org>
2009-10-15 16:31 ` bug#4730: 23.1; tar-chown-entry corrupts tar file Dan McCarthy
2009-10-17  4:45   ` bug#4730: marked as done (23.1; tar-chown-entry corrupts tar file) Emacs bug Tracking System

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).