Gnus development mailing list
 help / color / mirror / Atom feed
* pgnus-0.31: invoke external MIME stuff
@ 1998-09-23 15:39 Kai Grossjohann
  1998-09-23 15:47 ` Lee Willis
  1998-09-23 16:10 ` Shenghuo ZHU
  0 siblings, 2 replies; 20+ messages in thread
From: Kai Grossjohann @ 1998-09-23 15:39 UTC (permalink / raw)


Sometimes, invokation of external programs for a part doesn't work
right.  Apparently, the program is called for the base64-encoded stuff
rather than doing the base64-decoding first.  Also, whenever I hit RET
to save a part into a file, the saved file is base64-encoded.

kai
-- 
OOP: object oriented programming;  OOPS: object oriented mistakes


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-23 15:39 pgnus-0.31: invoke external MIME stuff Kai Grossjohann
@ 1998-09-23 15:47 ` Lee Willis
  1998-09-23 16:44   ` Kai Grossjohann
  1998-09-23 16:10 ` Shenghuo ZHU
  1 sibling, 1 reply; 20+ messages in thread
From: Lee Willis @ 1998-09-23 15:47 UTC (permalink / raw)


Kai Grossjohann <grossjohann@amaunet.cs.uni-dortmund.de> writes:

> Sometimes, invokation of external programs for a part doesn't work
> right.  Apparently, the program is called for the base64-encoded stuff
> rather than doing the base64-decoding first.  Also, whenever I hit RET
> to save a part into a file, the saved file is base64-encoded.

Yeah I've already reported it to lars but I haven't had time to edebug
the stuff he asked me to properly yet (Sorry :) )

It doesn't always happen though, sometimes it decodes it, other times it
doesn't ...

Lee.
-- 
I was doing object-oriented assembly at 1 year old ...  
For some reason my mom insists on calling it "Playing with blocks"


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-23 15:39 pgnus-0.31: invoke external MIME stuff Kai Grossjohann
  1998-09-23 15:47 ` Lee Willis
@ 1998-09-23 16:10 ` Shenghuo ZHU
  1998-09-23 16:43   ` Kai Grossjohann
                     ` (2 more replies)
  1 sibling, 3 replies; 20+ messages in thread
From: Shenghuo ZHU @ 1998-09-23 16:10 UTC (permalink / raw)


>>>>> "KG" == Kai Grossjohann <grossjohann@amaunet.cs.uni-dortmund.de> writes:

KG> Sometimes, invokation of external programs for a part doesn't work
KG> right.  Apparently, the program is called for the base64-encoded
KG> stuff rather than doing the base64-decoding first.  Also, whenever
KG> I hit RET to save a part into a file, the saved file is
KG> base64-encoded.

I also met this problem sometimes. I guess whether base64.el had been
loaded when this happened. To verify my guess, check (featurep 'base64)
when the stuff is not decoded. GNUS does not complain since the
following codes are found in mm-decode-content-transfer-encoding.

    (condition-case ()
	(base64-decode-region (point-min) (point-max))
      (error nil))

Since I added (require 'base64) in .gnus, this bug never happened to
me.

-- 
Shenghuo


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-23 16:10 ` Shenghuo ZHU
@ 1998-09-23 16:43   ` Kai Grossjohann
  1998-09-23 18:55   ` Matt Armstrong
  1998-09-23 18:56   ` Jan Vroonhof
  2 siblings, 0 replies; 20+ messages in thread
From: Kai Grossjohann @ 1998-09-23 16:43 UTC (permalink / raw)
  Cc: ding

>>>>> On 23 Sep 1998-400, Shenghuo ZHU said:

  ZSH> I also met this problem sometimes. I guess whether base64.el had been
  ZSH> loaded when this happened.

Right.  Loaded base64, faxes displayed nicely.  Grmpf.

  ZSH>     (condition-case ()
  ZSH> 	       (base64-decode-region (point-min) (point-max))
  ZSH>       (error nil))

Maybe a (require 'base64) should be added outside the
condition-case...

kai
-- 
OOP: object oriented programming;  OOPS: object oriented mistakes


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-23 15:47 ` Lee Willis
@ 1998-09-23 16:44   ` Kai Grossjohann
  0 siblings, 0 replies; 20+ messages in thread
From: Kai Grossjohann @ 1998-09-23 16:44 UTC (permalink / raw)
  Cc: ding

>>>>> On 23 Sep 1998, Lee Willis said:

  Lee> It doesn't always happen though, sometimes it decodes it, other
  Lee> times it doesn't ...

Maybe it's the missing base64 stuff, as reported by Zhu?  Anyway, I
just put (require 'base64) in my .gnus and it seems that does the trick.

kai
-- 
OOP: object oriented programming;  OOPS: object oriented mistakes


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-23 16:10 ` Shenghuo ZHU
  1998-09-23 16:43   ` Kai Grossjohann
@ 1998-09-23 18:55   ` Matt Armstrong
  1998-09-23 18:56   ` Jan Vroonhof
  2 siblings, 0 replies; 20+ messages in thread
From: Matt Armstrong @ 1998-09-23 18:55 UTC (permalink / raw)


Shenghuo ZHU <zsh@cs.rochester.edu> writes:

> >>>>> "KG" == Kai Grossjohann <grossjohann@amaunet.cs.uni-dortmund.de> writes:
> 
> KG> Sometimes, invokation of external programs for a part doesn't work
> KG> right.  Apparently, the program is called for the base64-encoded
> KG> stuff rather than doing the base64-decoding first.  Also, whenever
> KG> I hit RET to save a part into a file, the saved file is
> KG> base64-encoded.
> 
> I also met this problem sometimes. I guess whether base64.el had been
> loaded when this happened. To verify my guess, check (featurep 'base64)
> when the stuff is not decoded. GNUS does not complain since the
> following codes are found in mm-decode-content-transfer-encoding.
> 
>     (condition-case ()
> 	(base64-decode-region (point-min) (point-max))
>       (error nil))
> 
> Since I added (require 'base64) in .gnus, this bug never happened to
> me.

I posted a patch yesterday to mm-bodies.el that should fix the problem
you're seeing with mm-decode-content-transfer-encoding and the loading
of base64.el.  Lars says it'll be in 0.32.


-- 
matta



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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-23 16:10 ` Shenghuo ZHU
  1998-09-23 16:43   ` Kai Grossjohann
  1998-09-23 18:55   ` Matt Armstrong
@ 1998-09-23 18:56   ` Jan Vroonhof
  1998-09-23 22:21     ` Lars Magne Ingebrigtsen
  2 siblings, 1 reply; 20+ messages in thread
From: Jan Vroonhof @ 1998-09-23 18:56 UTC (permalink / raw)


Shenghuo ZHU <zsh@cs.rochester.edu> writes:

>     (condition-case ()
> 	(base64-decode-region (point-min) (point-max))
>       (error nil))

Shouldn't the whole (condition-case () be dropped? as well?

Jan


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-23 18:56   ` Jan Vroonhof
@ 1998-09-23 22:21     ` Lars Magne Ingebrigtsen
  1998-09-24 10:03       ` Jan Vroonhof
  0 siblings, 1 reply; 20+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-09-23 22:21 UTC (permalink / raw)


Jan Vroonhof <vroonhof@math.ethz.ch> writes:

> >     (condition-case ()
> > 	(base64-decode-region (point-min) (point-max))
> >       (error nil))
> 
> Shouldn't the whole (condition-case () be dropped? as well?

No -- base64 throws errors is the region in question isn't a valid
base64 file, if I recall correctly.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-23 22:21     ` Lars Magne Ingebrigtsen
@ 1998-09-24 10:03       ` Jan Vroonhof
  1998-09-24 17:13         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Vroonhof @ 1998-09-24 10:03 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> No -- base64 throws errors is the region in question isn't a valid
> base64 file, if I recall correctly.

Shouldn't you be catching JUST that error?

Jan


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-24 10:03       ` Jan Vroonhof
@ 1998-09-24 17:13         ` Lars Magne Ingebrigtsen
  1998-09-25 11:15           ` Jan Vroonhof
  0 siblings, 1 reply; 20+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-09-24 17:13 UTC (permalink / raw)


Jan Vroonhof <vroonhof@math.ethz.ch> writes:

> > No -- base64 throws errors is the region in question isn't a valid
> > base64 file, if I recall correctly.
> 
> Shouldn't you be catching JUST that error?

How does one catch an error thrown by `error' and no other errors?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-24 17:13         ` Lars Magne Ingebrigtsen
@ 1998-09-25 11:15           ` Jan Vroonhof
  1998-09-25 13:58             ` Simon Josefsson
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Vroonhof @ 1998-09-25 11:15 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> > > No -- base64 throws errors is the region in question isn't a valid
> > > base64 file, if I recall correctly.
> > 
> > Shouldn't you be catching JUST that error?
> 
> How does one catch an error thrown by `error' and no other errors?

One fixes the library (in this case base-64.el) to signal a more
specialised error, like this

 (condition-case ()
    (base64-decode-region (point-min) (point-max))
      (mime-conversion-error nil))


diff -u /u/scratch/vroonhof/xemacs/gnus/pgnus-0.32/lisp/base64.el~ /u/scratch/vroonhof/xemacs/gnus/pgnus-0.32/lisp/base64.el
--- /u/scratch/vroonhof/xemacs/gnus/pgnus-0.32/lisp/base64.el~	Fri Sep 25 13:14:06 1998
+++ /u/scratch/vroonhof/xemacs/gnus/pgnus-0.32/lisp/base64.el	Fri Sep 25 13:14:06 1998
@@ -29,6 +29,16 @@
 (if (not (fboundp 'char-int))
     (fset 'char-int 'identity))
 
+(define-error 'mime-conversion-error "Error in coverting encoded data.")
+; As data we return  (list <number of> <units>) where units is 'bits
+(define-error 'mime-short-coding-string
+  "The encoded string is short"
+  'mime-conversion-error)
+(define-error 'mime-external-program-error
+  "External conversion program error"
+  'mime-conversion-error)
+
+
 (defvar base64-alphabet
   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
 
@@ -134,7 +144,7 @@
 				   base64-decoder-program
 				   base64-decoder-switches)))
 		(if (not (eq status t))
-		    (error "%s" (cdr status))))
+		    (signal-error 'mime-external-program-error (cdr status))))
 	    (goto-char start)
 	    (skip-chars-forward non-data-chars end)
 	    (while (not done)
@@ -159,13 +169,13 @@
 	      (cond
 	       ((= (point) end)
 		(if (not (zerop counter))
-		    (error "at least %d bits missing at end of base64 encoding"
-			   (* (- 4 counter) 6)))
+		    (signal-error 'mime-short-coding-string
+			   (list (* (- 4 counter) 6) 'bits)))
 		(setq done t))
 	       ((= (char-after (point)) ?=)
 		(setq done t)
 		(cond ((= counter 1)
-		       (error "at least 2 bits missing at end of base64 encoding"))
+		       (signal-error 'mime-short-coding-string '(2 bits))
 		      ((= counter 2)
 		       (base64-insert-char (lsh bits -10) 1 nil work-buffer))
 		      ((= counter 3)
@@ -201,7 +211,7 @@
 				   base64-encoder-program
 				   base64-encoder-switches)))
 		(if (not (eq status t))
-		    (error "%s" (cdr status))))
+		    (signal-error 'mime-external-program-error (list (cdr status)))))
 	    (setq inputpos start)
 	    (while (< inputpos end)
 	      (setq bits (+ bits (char-int (char-after inputpos))))


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-25 11:15           ` Jan Vroonhof
@ 1998-09-25 13:58             ` Simon Josefsson
  1998-09-25 14:17               ` Alan Shutko
  1998-09-25 15:59               ` Hrvoje Niksic
  0 siblings, 2 replies; 20+ messages in thread
From: Simon Josefsson @ 1998-09-25 13:58 UTC (permalink / raw)
  Cc: ding

Jan Vroonhof <vroonhof@math.ethz.ch> writes:

> One fixes the library (in this case base-64.el) to signal a more
> specialised error, like this
> 
>  (condition-case ()
>     (base64-decode-region (point-min) (point-max))
>       (mime-conversion-error nil))

Uhm, isn't this very XEmacs specific?

/s


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-25 13:58             ` Simon Josefsson
@ 1998-09-25 14:17               ` Alan Shutko
  1998-09-25 15:59               ` Hrvoje Niksic
  1 sibling, 0 replies; 20+ messages in thread
From: Alan Shutko @ 1998-09-25 14:17 UTC (permalink / raw)
  Cc: Jan Vroonhof, ding

>>>>> "S" == Simon Josefsson <jas@pdc.kth.se> writes:

S> Jan Vroonhof <vroonhof@math.ethz.ch> writes:
>> One fixes the library (in this case base-64.el) to signal a more
>> specialised error, like this

S> Uhm, isn't this very XEmacs specific?

No, I don't think so.  Take a look at (elisp)Errors .

-- 
Alan Shutko <ats@acm.org> - By consent of the corrupted
It doesn't matter whether you win or lose -- until you lose.


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-25 13:58             ` Simon Josefsson
  1998-09-25 14:17               ` Alan Shutko
@ 1998-09-25 15:59               ` Hrvoje Niksic
  1998-09-26 18:11                 ` Jan Vroonhof
  1 sibling, 1 reply; 20+ messages in thread
From: Hrvoje Niksic @ 1998-09-25 15:59 UTC (permalink / raw)


Simon Josefsson <jas@pdc.kth.se> writes:

> Jan Vroonhof <vroonhof@math.ethz.ch> writes:
> 
> > One fixes the library (in this case base-64.el) to signal a more
> > specialised error, like this
> > 
> >  (condition-case ()
> >     (base64-decode-region (point-min) (point-max))
> >       (mime-conversion-error nil))
> 
> Uhm, isn't this very XEmacs specific?

It's not.  However, the `define-error' bit will not work under FSF
Emacs.

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
"A Real Programmer's code can awe with its fiendish brilliance, even
as its crockishness appalls."


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-25 15:59               ` Hrvoje Niksic
@ 1998-09-26 18:11                 ` Jan Vroonhof
  1998-09-29 10:43                   ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Vroonhof @ 1998-09-26 18:11 UTC (permalink / raw)


Hrvoje Niksic <hniksic@srce.hr> writes:

> It's not.  However, the `define-error' bit will not work under FSF
> Emacs.

Sigh.. I was already wondering why the LISP manual errors section
didn't mention them.

Time for gnus-define-error?

Jan


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-26 18:11                 ` Jan Vroonhof
@ 1998-09-29 10:43                   ` Lars Magne Ingebrigtsen
  1998-09-29 12:57                     ` Jan Vroonhof
  0 siblings, 1 reply; 20+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-09-29 10:43 UTC (permalink / raw)


Jan Vroonhof <vroonhof@math.ethz.ch> writes:

> Sigh.. I was already wondering why the LISP manual errors section
> didn't mention them.
> 
> Time for gnus-define-error?

I don't think it's worth it.  Ignoring all errors when base64-decoding
is OK.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-29 10:43                   ` Lars Magne Ingebrigtsen
@ 1998-09-29 12:57                     ` Jan Vroonhof
  1998-10-01  2:39                       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Vroonhof @ 1998-09-29 12:57 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> I don't think it's worth it.  Ignoring all errors when base64-decoding
> is OK.

Personally think that these error mechanisms are highly underused in
Emacs, which might be due to fact that FSF does not have these
convenience functions. This what the reason I made it is a patch. Then 
you wouldn't have to do any work. 
This is not the first time that bugs were hard
to find  because of the

(condition-case ()
  ;;
  (error nil))

idiom. Could you at the very least print the error message so that you just
have converted it in a non-fatal error. FWIW It might be very
interesting to know that a base64 encoded part was malformed.

Jan


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-09-29 12:57                     ` Jan Vroonhof
@ 1998-10-01  2:39                       ` Lars Magne Ingebrigtsen
  1998-10-01  9:01                         ` Jan Vroonhof
  0 siblings, 1 reply; 20+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-10-01  2:39 UTC (permalink / raw)


Jan Vroonhof <vroonhof@math.ethz.ch> writes:

> Personally think that these error mechanisms are highly underused in
> Emacs, which might be due to fact that FSF does not have these
> convenience functions. This what the reason I made it is a patch.

But the patch was to base64.el, which is something that won't be in
the (X)Emacs distributions of Gnus -- the base64 things will be done
in the C layer.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-10-01  2:39                       ` Lars Magne Ingebrigtsen
@ 1998-10-01  9:01                         ` Jan Vroonhof
  1998-10-01  9:12                           ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Vroonhof @ 1998-10-01  9:01 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> But the patch was to base64.el, which is something that won't be in
> the (X)Emacs distributions of Gnus -- the base64 things will be done
> in the C layer.

As the C layer is at the moment the only part of Emacs signaling
differentiated errors that it is all the more important that the lisp
prototype gets it right.

Jan


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

* Re: pgnus-0.31: invoke external MIME stuff
  1998-10-01  9:01                         ` Jan Vroonhof
@ 1998-10-01  9:12                           ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 20+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-10-01  9:12 UTC (permalink / raw)


Jan Vroonhof <vroonhof@math.ethz.ch> writes:

> As the C layer is at the moment the only part of Emacs signaling
> differentiated errors that it is all the more important that the lisp
> prototype gets it right.

The C base64 functions do not signal any errors at all -- they return
nil on not being able to decode.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


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

end of thread, other threads:[~1998-10-01  9:12 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-23 15:39 pgnus-0.31: invoke external MIME stuff Kai Grossjohann
1998-09-23 15:47 ` Lee Willis
1998-09-23 16:44   ` Kai Grossjohann
1998-09-23 16:10 ` Shenghuo ZHU
1998-09-23 16:43   ` Kai Grossjohann
1998-09-23 18:55   ` Matt Armstrong
1998-09-23 18:56   ` Jan Vroonhof
1998-09-23 22:21     ` Lars Magne Ingebrigtsen
1998-09-24 10:03       ` Jan Vroonhof
1998-09-24 17:13         ` Lars Magne Ingebrigtsen
1998-09-25 11:15           ` Jan Vroonhof
1998-09-25 13:58             ` Simon Josefsson
1998-09-25 14:17               ` Alan Shutko
1998-09-25 15:59               ` Hrvoje Niksic
1998-09-26 18:11                 ` Jan Vroonhof
1998-09-29 10:43                   ` Lars Magne Ingebrigtsen
1998-09-29 12:57                     ` Jan Vroonhof
1998-10-01  2:39                       ` Lars Magne Ingebrigtsen
1998-10-01  9:01                         ` Jan Vroonhof
1998-10-01  9:12                           ` Lars Magne Ingebrigtsen

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 NNTP newsgroup(s).