Re: Internal error: Message without type term

2023-07-03 Thread Olly Betts
On Mon, Jul 03, 2023 at 02:26:03PM +0200, David Bremner wrote:
> "Peter P."  writes:
> 
> > I ran xapian-check on ~/.notmuch/xapian and include its messages
> > below at the end of this mail. Everyone please forgive me for
> > pasting 1121 there. :)
> 
> H'mm. It doesn't look familiar to me, but I will check with xapian
> experts to see if the failure mode is known/fixable. I'd guess probably
> not fixable.

Currently we don't have a database fixing tool for glass databases (the
"fix" mode in xapian-check can recreate base files for the older chert
database format, but glass doesn't have these base files which
eradicated the failure mode of them sometimes getting truncated to zero
size on power failure or OS crash).

Some of the problems reported have an obvious fix, but we don't have
existing code to fix them, and some look like they are probably due to
data being overwritten so fixing everything to be consistent probably
wouldn't actually give a database that entirely matches your email
anyway.

Was this database originally created by Xapian < 1.4.22?  It looks
like it could be the result of the bug fixed in 1.4.22 with handling
commit() failure on disk full.

> >> 2)  Move the database out of the way, re-run notmuch new,
> >> and restore your state using "notmuch restore < notmuch-db.txt"
> >  
> > I'd be fine regenerating the entire database without a backup dump even,
> > I don't think there is anything in there that can't be regernerated,
> > no?
> 
> The main thing that would be lost is tags that are not synched to
> maildir flags. In the "standard" workflow "inbox" is such a tag.

If there's tag data in the database which isn't backed up or synced to
maildir flags, you may be able to rescue it using:

https://git.xapian.org/?p=xapian;a=blob;f=README.notmuch;hb=refs/heads/notmuch-tag-rescue-hack

This creates a file with the tag data in the format `notmuch restore`
expects.  I'd expect this would work for your database as the termlist
table is mostly OK.

Cheers,
Olly
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Fwd: [PATCH] improve notmuch-hello layout

2023-07-03 Thread Rudolf Adamkovič
Ping! :)

 Start of forwarded message 
From: Rudolf Adamkovič 
To: notmuch@notmuchmail.org
Subject: [PATCH] improve notmuch-hello layout
Date: Thu, 25 May 2023 17:30:26 +0200

Howdy, howdy fellow e-mail hackers. :)

The attached patches are my first-cut attempt to:

(1) Make notmuch-hello play nicely with display-line-numbers-mode.
(2) Make notmuch-hello re-layout when window width changes.

WDYT?

Rudy
>From 278017d06bb986f4ec99118bfcfdec8dab970f2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Thu, 25 May 2023 16:22:08 +0200
Subject: [PATCH 1/2] emacs: fix notmuch-hello layout when
 display-line-numbers-mode is on

---
 emacs/notmuch-hello.el | 25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 4662e704..3235f555 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -412,6 +412,7 @@ supported for \"Customized queries section\" items."
 (defun notmuch-search-item-field-width ()
   (max 8 ; Don't let the search boxes be less than 8 characters wide.
(- (window-width)
+	  (line-number-display-width)
 	  notmuch-hello-indent ; space at bol
 	  notmuch-hello-indent ; space at eol
 	  1; for the space before the [save] button
@@ -508,23 +509,31 @@ should be. Returns a cons cell `(tags-per-line width)'."
 	 (cond
 	  ((integerp notmuch-column-control)
 	   (max 1
-		(/ (- (window-width) notmuch-hello-indent)
+		(/ (- (window-width)
+		  (line-number-display-width)
+		  notmuch-hello-indent)
 		   ;; Count is 9 wide (8 digits plus space), 1 for the space
 		   ;; after the name.
 		   (+ 9 1 (max notmuch-column-control widest)
 	  ((floatp notmuch-column-control)
-	   (let* ((available-width (- (window-width) notmuch-hello-indent))
+	   (let* ((available-width (- (window-width)
+  (line-number-display-width)
+  notmuch-hello-indent))
 		  (proposed-width (max (* available-width notmuch-column-control)
    widest)))
 	 (floor available-width proposed-width)))
 	  (t
 	   (max 1
-		(/ (- (window-width) notmuch-hello-indent)
+		(/ (- (window-width)
+		  (line-number-display-width)
+		  notmuch-hello-indent)
 		   ;; Count is 9 wide (8 digits plus space), 1 for the space
 		   ;; after the name.
 		   (+ 9 1 widest)))
 (cons tags-per-line (/ (max 1
-(- (window-width) notmuch-hello-indent
+(- (window-width)
+   (line-number-display-width)
+   notmuch-hello-indent
    ;; Count is 9 wide (8 digits plus
    ;; space), 1 for the space after the
    ;; name.
@@ -824,7 +833,9 @@ Complete list of currently available key bindings:
   (widget-create 'editable-field
 		 ;; Leave some space at the start and end of the
 		 ;; search boxes.
-		 :size (max 8 (- (window-width) notmuch-hello-indent
+		 :size (max 8 (- (window-width)
+ (line-number-display-width)
+ notmuch-hello-indent
  (length "Search: ")))
 		 :action #'notmuch-hello-search)
   ;; Add an invisible dot to make `widget-end-of-line' ignore
@@ -947,7 +958,9 @@ following:
 			 (customize-variable 'notmuch-hello-sections))
 		   :button-prefix "" :button-suffix ""
 		   "this page.")
-(let ((fill-column (- (window-width) notmuch-hello-indent)))
+(let ((fill-column (- (window-width)
+			  (line-number-display-width)
+			  notmuch-hello-indent)))
   (center-region start (point)
 
 ;;; Hello!
-- 
2.37.1 (Apple Git-137.1)

>From 4964ac4a656521a0e84615ea718c81fb4e95bedf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Thu, 25 May 2023 17:21:38 +0200
Subject: [PATCH 2/2] emacs: re-layout notmuch-hello when window width changes

---
 emacs/notmuch-hello.el | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 3235f555..f245a7dd 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -383,6 +383,10 @@ supported for \"Customized queries section\" items."
 (defvar notmuch-hello-first-run t
   "True if `notmuch-hello' is run for the first time, set to nil afterwards.")
 
+(defvar notmuch-hello-scheduled-to-run nil
+  "True if `notmuch-hello' is scheduled to run during the next
+re-display, and set to nil afterwards.")
+
 ;;; Widgets for inserters
 
 (define-widget 'notmuch-search-item 'item
@@ -701,12 +705,23 @@ with `notmuch-hello-query-counts'."
 	;; The user just switched to hello in this window (hello
 	;; is currently visible, was not visible on the last
 	;; configuration change, and this is not a new window)
-	(setq do-refresh t)
-(when (and do-refresh notmuch-hello-auto-refresh)
+	(setq do-refresh t)))
+	(when (eq cur-buf hello-buf)
+	  ;; This is the hello buffer, so check its last and current width.
+	  (let ((last-width (window-parameter window 'notmuch-hello-last-width))
+		(cur-width (window-width window)))
+	

Re: Internal error: Message without type term

2023-07-03 Thread Peter P.
(to notmuch-list only)

* David Bremner  [2023-07-03 14:26]:
[...]

> >> 2)  Move the database out of the way, re-run notmuch new,
> >> and restore your state using "notmuch restore < notmuch-db.txt"
> >  
> > I'd be fine regenerating the entire database without a backup dump even,
> > I don't think there is anything in there that can't be regernerated,
> > no?
> 
> The main thing that would be lost is tags that are not synched to
> maildir flags. In the "standard" workflow "inbox" is such a tag.

I gladly re-created the database and the error is gone. Do you want me
to keep to old database in case someone wants to research this issue further?

Much appreciated,
Peter
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Internal error: Message without type term

2023-07-03 Thread David Bremner
"Peter P."  writes:

> I ran xapian-check on ~/.notmuch/xapian and include its messages below at the
> end of this mail. Everyone please forgive me for pasting 1121 there. :)
>

H'mm. It doesn't look familiar to me, but I will check with xapian
experts to see if the failure mode is known/fixable. I'd guess probably
not fixable.

>> 2)  Move the database out of the way, re-run notmuch new,
>> and restore your state using "notmuch restore < notmuch-db.txt"
>  
> I'd be fine regenerating the entire database without a backup dump even,
> I don't think there is anything in there that can't be regernerated,
> no?

The main thing that would be lost is tags that are not synched to
maildir flags. In the "standard" workflow "inbox" is such a tag.

> How could I move the existing database out of the way? I have the
> following files in notmuch's directory:
>
> ~/.notmuch/xapian$ ls -1
>   docdata.glass
>   flintlock
>   iamglass
>   position.glass
>   postlist.glass
>   termlist.glass

just

$ mv ~/.notmuch/xapian ~/.notmuch/xapian.bak

(assuming that partition has space)

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Internal error: Message without type term

2023-07-03 Thread Peter P.
Dear David,

* David Bremner  [2023-07-03 12:34]:
[...]
> The first thing to try is to make a backup of your database with
> 
> notmuch dump > notmuch-db.txt
Thanks! notmuch dump throws the same error, prefixed with
+inbox +signed -- id:201805
though I am not sure if this id really belongs to the email causing it.
 
> (or whatever you want to call the file).
> 
> If this succeeds then follow the steps below. If not, then _maybe_ there
> is a way to recover your tags etc., but it will require recompiling some
> parts of xapian, so write again.

> 1) install xapian-tools and run
> 
> $ xapian-check ~/.local/share/notmuch/default/xapian
> 
> This is mainly for (my) curiousity, but it may highlight some database
> corruption or if xapian reports no errors that leans more towards a
> notmuch bug.
I ran xapian-check on ~/.notmuch/xapian and include its messages below at the
end of this mail. Everyone please forgive me for pasting 1121 there. :)

> 2)  Move the database out of the way, re-run notmuch new,
> and restore your state using "notmuch restore < notmuch-db.txt"
 
I'd be fine regenerating the entire database without a backup dump even,
I don't think there is anything in there that can't be regernerated, no?

How could I move the existing database out of the way? I have the
following files in notmuch's directory:

~/.notmuch/xapian$ ls -1
docdata.glass
flintlock
iamglass
position.glass
postlist.glass
termlist.glass

Thanks again David!
P

-->

docdata:
blocksize=8K items=161 firstunused=1 revision=1 levels=0 root=0
B-tree checked okay
docdata table structure checked OK

termlist:
blocksize=8K items=267730 firstunused=23171 revision=1 levels=2 root=746
B-tree checked okay
Size of wdf out of range in termlist
termlist_size != # of entries in termlist
doclen != sum(wdf)
termlist table errors found: 3

postlist:
blocksize=8K items=2437844 firstunused=22023 revision=1 levels=2 root=567
B-tree checked okay
document id 63805: length 325 doesn't match 0 in the termlist table
document id 89028: length 404416 doesn't match 359353 in the termlist table
collfreq 29 != sum wdf 25
termfreq 5 != # of entries 1
docid 3536 > last docid 3534
docid 3538 > last docid 3534
collfreq 15055 != sum wdf 15059
First did in this chunk is <= last in prev chunk
termfreq 8544 != # of entries 8555
collfreq 331831 != sum wdf 334753
termfreq 11793 != # of entries 11800
collfreq 24971 != sum wdf 24993
docid 10538 > last docid 10534
collfreq 217566 != sum wdf 217570
termfreq 5 != # of entries 1
collfreq 109 != sum wdf 113
docid 21012 > last docid 20915
docid 21019 > last docid 20915
docid 21117 > last docid 20915
docid 21229 > last docid 20915
docid 21340 > last docid 20915
docid 21342 > last docid 20915
docid 21392 > last docid 20915
docid 21394 > last docid 20915
docid 21408 > last docid 20915
docid 21499 > last docid 20915
docid 21597 > last docid 20915
docid 21641 > last docid 20915
docid 21643 > last docid 20915
docid 21693 > last docid 20915
docid 21695 > last docid 20915
docid 21714 > last docid 20915
docid 21805 > last docid 20915
docid 21903 > last docid 20915
docid 21906 > last docid 20915
docid 283841 > last docid 20915
docid 319527 > last docid 20915
docid 355212 > last docid 20915
docid 355309 > last docid 20915
docid 355326 > last docid 20915
docid 355424 > last docid 20915
docid 355535 > last docid 20915
docid 355633 > last docid 20915
docid 355751 > last docid 20915
docid 355867 > last docid 20915
docid 355980 > last docid 20915
docid 356097 > last docid 20915
docid 356205 > last docid 20915
docid 356209 > last docid 20915
docid 356259 > last docid 20915
docid 356263 > last docid 20915
docid 356280 > last docid 20915
docid 356371 > last docid 20915
docid 356469 > last docid 20915
docid 356590 > last docid 20915
docid 356647 > last docid 20915
docid 356649 > last docid 20915
docid 377564 > last docid 20915
docid 377565 > last docid 20915
docid 377662 > last docid 20915
docid 377672 > last docid 20915
docid 30 > last docid 20915
docid 377881 > last docid 20915
docid 377996 > last docid 20915
docid 378094 > last docid 20915
docid 378096 > last docid 20915
docid 662365 > last docid 20915
docid 662366 > last docid 20915
docid 662463 > last docid 20915
docid 662472 > last docid 20915
docid 662570 > last docid 20915
docid 662681 > last docid 20915
docid 662779 > last docid 20915
docid 662894 > last docid 20915
docid 662900 > last docid 20915
docid 662950 > last docid 20915
docid 662956 > last docid 20915
docid 662975 > last docid 20915
docid 663066 > last docid 20915
docid 663164 > last docid 20915
docid 663283 > last docid 20915
docid 663339 > last docid 20915
docid 663447 > last docid 20915
docid 663449 > last docid 20915
docid 925384 > last docid 20915
docid 925385 > last docid 20915
docid 925482 > last docid 20915
docid 925490 > last docid 20915
docid 925588 > last docid 20915
docid 925699 > last docid 20915
docid 925797 > last docid 20915
docid 925799 > last docid 

Re: Internal error: Message without type term

2023-07-03 Thread David Bremner
"Peter P."  writes:

> Hi list,
> I am not subscribed to this list, please add me as CC in your replies,
> thanks!
>
> I am getting 
>   Internal error: Message without type term (lib/message.cc:402).
> with notmuch 0.37-1+b1 on Debian stable. What can I do next?
>

The first thing to try is to make a backup of your database with

notmuch dump > notmuch-db.txt

(or whatever you want to call the file).

If this succeeds then follow the steps below. If not, then _maybe_ there
is a way to recover your tags etc., but it will require recompiling some
parts of xapian, so write again.

1) install xapian-tools and run

$ xapian-check ~/.local/share/notmuch/default/xapian

This is mainly for (my) curiousity, but it may highlight some database
corruption or if xapian reports no errors that leans more towards a
notmuch bug.

2)  Move the database out of the way, re-run notmuch new,
and restore your state using "notmuch restore < notmuch-db.txt"

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Internal error: Message without type term

2023-07-03 Thread Peter P.


Hi list,
I am not subscribed to this list, please add me as CC in your replies,
thanks!

I am getting 
Internal error: Message without type term (lib/message.cc:402).
with notmuch 0.37-1+b1 on Debian stable. What can I do next?

Thanks!
Peter
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org