Gnus development mailing list
 help / color / mirror / Atom feed
* Change to make gnus-nov-parse-line error free
@ 2002-09-26  4:09 tsuchiya
  2002-09-26  4:57 ` Simon Josefsson
  0 siblings, 1 reply; 9+ messages in thread
From: tsuchiya @ 2002-09-26  4:09 UTC (permalink / raw)


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

Hi, Gnus developers.

I propose the following change to make gnus-nov-parse-line() error
free.  This change will protect Gnus against corrupted messages and
illegal charsets of group parameters.


[-- Attachment #2: Type: text/plain, Size: 945 bytes --]

--- gnus-sum.el	2002/09/21 04:33:42	6.228
+++ gnus-sum.el	2002/09/26 04:36:54
@@ -3838,7 +3838,7 @@
 
     ;; overview: [num subject from date id refs chars lines misc]
     (unwind-protect
-	(progn
+	(let (x)
 	  (narrow-to-region (point) eol)
 	  (unless (eobp)
 	    (forward-char))
@@ -3846,10 +3846,14 @@
 	  (setq header
 		(make-full-mail-header
 		 number			; number
-		 (funcall gnus-decode-encoded-word-function
-			  (nnheader-nov-field))	; subject
-		 (funcall gnus-decode-encoded-word-function
-			  (nnheader-nov-field))	; from
+		 (condition-case ()	; subject
+		     (funcall gnus-decode-encoded-word-function
+			      (setq x (nnheader-nov-field)))
+		   (error x))
+		 (condition-case ()	; from
+		     (funcall gnus-decode-encoded-word-function
+			      (setq x (nnheader-nov-field)))
+		   (error x))
 		 (nnheader-nov-field)	; date
 		 (nnheader-nov-read-message-id)	; id
 		 (setq references (nnheader-nov-field))	; refs

[-- Attachment #3: Type: text/plain, Size: 23 bytes --]

-- 
TSUCHIYA Masatoshi

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

* Re: Change to make gnus-nov-parse-line error free
  2002-09-26  4:09 Change to make gnus-nov-parse-line error free tsuchiya
@ 2002-09-26  4:57 ` Simon Josefsson
  2002-09-26  5:12   ` tsuchiya
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Josefsson @ 2002-09-26  4:57 UTC (permalink / raw)
  Cc: ding

tsuchiya@namazu.org writes:

> Hi, Gnus developers.
>
> I propose the following change to make gnus-nov-parse-line() error
> free.  This change will protect Gnus against corrupted messages and
> illegal charsets of group parameters.
>
> --- gnus-sum.el	2002/09/21 04:33:42	6.228
> +++ gnus-sum.el	2002/09/26 04:36:54
> @@ -3838,7 +3838,7 @@
>  
>      ;; overview: [num subject from date id refs chars lines misc]
>      (unwind-protect

It seems that entire code is already wrapped in a unwind-protect to
make Gnus cope with corrupt messages.  Doesn't it work?

> -	(progn
> +	(let (x)
>  	  (narrow-to-region (point) eol)
>  	  (unless (eobp)
>  	    (forward-char))
> @@ -3846,10 +3846,14 @@
>  	  (setq header
>  		(make-full-mail-header
>  		 number			; number
> -		 (funcall gnus-decode-encoded-word-function
> -			  (nnheader-nov-field))	; subject
> -		 (funcall gnus-decode-encoded-word-function
> -			  (nnheader-nov-field))	; from
> +		 (condition-case ()	; subject
> +		     (funcall gnus-decode-encoded-word-function
> +			      (setq x (nnheader-nov-field)))
> +		   (error x))
> +		 (condition-case ()	; from
> +		     (funcall gnus-decode-encoded-word-function
> +			      (setq x (nnheader-nov-field)))
> +		   (error x))
>  		 (nnheader-nov-field)	; date
>  		 (nnheader-nov-read-message-id)	; id
>  		 (setq references (nnheader-nov-field))	; refs
> -- 
> TSUCHIYA Masatoshi




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

* Re: Change to make gnus-nov-parse-line error free
  2002-09-26  4:57 ` Simon Josefsson
@ 2002-09-26  5:12   ` tsuchiya
  2002-09-26  5:34     ` Katsumi Yamaoka
  0 siblings, 1 reply; 9+ messages in thread
From: tsuchiya @ 2002-09-26  5:12 UTC (permalink / raw)


>> On Thu, 26 Sep 2002 06:57:51 +0200
>> jas@extundo.com (Simon Josefsson) said as follows:

>It seems that entire code is already wrapped in a unwind-protect to
>make Gnus cope with corrupt messages.  Doesn't it work?

Yes, it works.

However, we tend to miss corrupted messages, because they are simply
ignored and are not displayed in summary.  When my proposed change is
installed, undecoded raw subjects and from fields are displayed in
summary.  They will call our attention for broken messages.

-- 
TSUCHIYA Masatoshi



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

* Re: Change to make gnus-nov-parse-line error free
  2002-09-26  5:12   ` tsuchiya
@ 2002-09-26  5:34     ` Katsumi Yamaoka
  2002-09-26 16:29       ` Simon Josefsson
  0 siblings, 1 reply; 9+ messages in thread
From: Katsumi Yamaoka @ 2002-09-26  5:34 UTC (permalink / raw)


>>>>> In <87ofalcp0s.fsf@pine.kuee.kyoto-u.ac.jp>
>>>>>	tsuchiya@namazu.org wrote:

jas> It seems that entire code is already wrapped in a unwind-protect
jas> to make Gnus cope with corrupt messages.  Doesn't it work?

> Yes, it works.

> However, we tend to miss corrupted messages, because they are simply
> ignored and are not displayed in summary.  When my proposed change is
> installed, undecoded raw subjects and from fields are displayed in
> summary.  They will call our attention for broken messages.

I know only one example.  If a user has specified an illegal
charset for the `charset' group parameter, Gnus won't show any
articles for the group.  It will also occur if a user has set
the variable `gnus-parameters' as follows:

(push '("" (charset . non-existent-charset)) gnus-parameters)

TSUCHIYA-san's patch helps such a case.  However, it is required
that the code should run fast to make summary lines.  Is it
needless fears though I worry about a speed fall?
-- 
Katsumi Yamaoka <yamaoka@jpl.org>



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

* Re: Change to make gnus-nov-parse-line error free
  2002-09-26  5:34     ` Katsumi Yamaoka
@ 2002-09-26 16:29       ` Simon Josefsson
  2002-09-26 16:45         ` Jesper Harder
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Josefsson @ 2002-09-26 16:29 UTC (permalink / raw)
  Cc: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> TSUCHIYA-san's patch helps such a case.  

Ah, I understand, it seems good.

> However, it is required that the code should run fast to make
> summary lines.  Is it needless fears though I worry about a speed
> fall?

It is time critical code, but perhaps it won't make much difference.




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

* Re: Change to make gnus-nov-parse-line error free
  2002-09-26 16:29       ` Simon Josefsson
@ 2002-09-26 16:45         ` Jesper Harder
  2002-09-27  3:23           ` Katsumi Yamaoka
  2002-09-27  5:47           ` Clemens Fischer
  0 siblings, 2 replies; 9+ messages in thread
From: Jesper Harder @ 2002-09-26 16:45 UTC (permalink / raw)


Simon Josefsson <jas@extundo.com> writes:

> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>
>> However, it is required that the code should run fast to make summary
>> lines.  Is it needless fears though I worry about a speed fall?
>
> It is time critical code, but perhaps it won't make much difference.

I profiled it, and it doesn't seem to make any discernible difference.




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

* Re: Change to make gnus-nov-parse-line error free
  2002-09-26 16:45         ` Jesper Harder
@ 2002-09-27  3:23           ` Katsumi Yamaoka
  2002-09-27  5:47           ` Clemens Fischer
  1 sibling, 0 replies; 9+ messages in thread
From: Katsumi Yamaoka @ 2002-09-27  3:23 UTC (permalink / raw)
  Cc: ding

>>>>> In <m3y99oaeel.fsf@defun.localdomain>
>>>>>	Jesper Harder <harder@ifa.au.dk> wrote:

> Simon Josefsson <jas@extundo.com> writes:

>> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>>
>>> However, it is required that the code should run fast to make summary
>>> lines.  Is it needless fears though I worry about a speed fall?
>>
>> It is time critical code, but perhaps it won't make much difference.

> I profiled it, and it doesn't seem to make any discernible difference.

I understood.  I've committed TSUCHIYA-san's patch just now.
Thank you,
-- 
Katsumi Yamaoka <yamaoka@jpl.org>



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

* Re: Change to make gnus-nov-parse-line error free
  2002-09-26 16:45         ` Jesper Harder
  2002-09-27  3:23           ` Katsumi Yamaoka
@ 2002-09-27  5:47           ` Clemens Fischer
  2002-09-27 13:35             ` Jesper Harder
  1 sibling, 1 reply; 9+ messages in thread
From: Clemens Fischer @ 2002-09-27  5:47 UTC (permalink / raw)


Jesper Harder <harder@ifa.au.dk> writes:

> [about code in the summaries]
> I profiled it, and it doesn't seem to make any discernible difference.

how do i profile elisp code?

clemens





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

* Re: Change to make gnus-nov-parse-line error free
  2002-09-27  5:47           ` Clemens Fischer
@ 2002-09-27 13:35             ` Jesper Harder
  0 siblings, 0 replies; 9+ messages in thread
From: Jesper Harder @ 2002-09-27 13:35 UTC (permalink / raw)


Clemens Fischer <ino@despammed.com> writes:

> how do i profile elisp code?

One possibility is `elp.el':

* use `elp-instrument-function' or `elp-instrument-package' to
  instrument the stuff you want to profile.
* Do something.
* Do `M-x elp-results' to get the results.

elp.el is fine, but it can also be a bit misleading if you have
instrumented a lot functions because the instrumentation itself degrades
performance.

XEmacs also has `profile-key', which is different.

I'm mainly interested in the performance of generating a large summary
buffer, so I have function which times how long time it takes to show
the first 10.000 articles of a certain group[1] a number of times and
writes it to a file.  I sometimes run this after updating Gnus, to get
an idea about if the performance has changed significantly.

[1] I never expire on my local news server, so they're always the same.




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

end of thread, other threads:[~2002-09-27 13:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-26  4:09 Change to make gnus-nov-parse-line error free tsuchiya
2002-09-26  4:57 ` Simon Josefsson
2002-09-26  5:12   ` tsuchiya
2002-09-26  5:34     ` Katsumi Yamaoka
2002-09-26 16:29       ` Simon Josefsson
2002-09-26 16:45         ` Jesper Harder
2002-09-27  3:23           ` Katsumi Yamaoka
2002-09-27  5:47           ` Clemens Fischer
2002-09-27 13:35             ` Jesper Harder

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).