summaryrefslogtreecommitdiff
path: root/deb-view.el
diff options
context:
space:
mode:
authorpsg <>2005-10-24 16:54:58 +0000
committerpsg <>2005-10-24 16:54:58 +0000
commit2d38c2c94e170e0b3a08f60f2c68513637518de6 (patch)
tree5b9a09b81de049af9d0dcc1fd8e40e41cb9aa5fa /deb-view.el
parent8f2757d4d4a24b6724c587d9301ad4a7db73591c (diff)
deb-view.el 1.12 2005-10-24 Peter S. Galbraith <psg@debian.org>
- Output an error message if the package file is corrupted (e.g. partial download). Thanks to Dan Jacobson for suggesting this change (Closes: #235673).
Diffstat (limited to 'deb-view.el')
-rw-r--r--deb-view.el26
1 files changed, 21 insertions, 5 deletions
diff --git a/deb-view.el b/deb-view.el
index b3c201b..4d6d997 100644
--- a/deb-view.el
+++ b/deb-view.el
@@ -206,6 +206,11 @@
;; doesn't really need to be 1/2 the screen. Thanks to Dan
;; Jacobson for suggesting this change (Closes: #224950).
+;; 1.12 2005-10-24 Peter S. Galbraith <psg@debian.org>
+;; - Output an error message if the package file is corrupted
+;; (e.g. partial download). Thanks to Dan
+;; Jacobson for suggesting this change (Closes: #235673).
+
;;; Code:
@@ -287,7 +292,10 @@ See also the variable deb-find-directory."
Press \"q\" in either window to kill both buffers
and return to the dired buffer. See deb-view."
(interactive)
- (deb-view (dired-get-filename)))
+ (let ((file (dired-get-filename)))
+ (if (string-match ".deb$" file)
+ (deb-view file)
+ (error "Not a Debian package file"))))
;;;###autoload
(defun deb-view (debfile)
@@ -386,10 +394,18 @@ at the prompt."
(delete-other-windows)
;; data
(set-buffer data-buffer)
- (call-process shell-file-name nil t nil shell-command-switch
- (if new-archive-format
- (concat "ar -p " debfile " data.tar.gz | gzip -cd")
- (concat "dpkg-deb --fsys-tarfile " debfile)))
+ (cond
+ (new-archive-format
+ (call-process "ar" nil '(t t) nil "-p" debfile "data.tar.gz")
+ (goto-char (point-max))
+ (when (search-backward "is not a valid archive" nil t)
+ (kill-buffer data-buffer)
+ (kill-buffer info-buffer)
+ (error "%s: Not a valid package file" deb-view-buffer-name))
+ (call-process-region (point-min) (point-max) "gzip" t t nil "-cd"))
+ (t
+ (call-process shell-file-name nil t nil shell-command-switch
+ (concat "dpkg-deb --fsys-tarfile " debfile))))
(goto-char 1)
(setq buffer-file-name (concat deb-view-file-name "-DATA"))
(if (fboundp 'set-buffer-multibyte) (set-buffer-multibyte nil))