Ticket #2931 (closed defect: fixed)

Opened 16 months ago

Last modified 16 months ago

BDB support in header cache broken

Reported by: cludwig Owned by: mutt-dev
Priority: major Milestone: 1.6
Component: header cache Version: 1.5.16
Keywords: BDB Cc:

Description

If mutt (changeset f4b2c6eba5fd from http://dev.mutt.org/hg/mutt) is configured to use Berkeley DB as header cache backend, then it dumps core in mutt_hcache_open() - it turns out that the database object h->db was never initialized with db_create(). Therefore, the line

(*h->db->open)(h->db, NULL, path, folder, DB_BTREE, createflags, 0600);

causes the dereferentiation of a NULL pointer.

Attached patch fixes this bug, I think.

Regards

Christoph

Attachments

bdb_create.diff (499 bytes) - added by cludwig 16 months ago.
Fix for missing call of db_create()

Change History

Changed 16 months ago by cludwig

Fix for missing call of db_create()

Changed 16 months ago by brendan

  • keywords header_cache removed
  • component changed from mutt to header cache

A similar patch went in 3 months ago: [e363d7a69046]. Are you sure you've got the most recent version checked out?

Changed 16 months ago by cludwig

Well, I cloned the repository at http://dev.mutt.org/hg/mutt yesterday, tip was reported as changeset:f4b2c6eba5fd. I assumed this to be the most recent version and used it as starting point.

If one needs to issue some hg commands before the working directory has the most recent version, then I'd appreciate a pointer on the download page for us mere mortals without hg experience...

Changed 16 months ago by Brendan Cully

On Monday, 16 July 2007 at 17:04, Mutt wrote:
> #2931: BDB support in header cache broken
> 
> Comment (by cludwig):
> 
>  Well, I cloned the repository at http://dev.mutt.org/hg/mutt yesterday,
>  tip was reported as changeset:f4b2c6eba5fd. I assumed this to be the most
>  recent version and used it as starting point.
> 
>  If one needs to issue some hg commands before the working directory has
>  the most recent version, then I'd appreciate a pointer on the download
>  page for us mere mortals without hg experience...

hg parents will tell you which version is checked out. I think if
clone isn't giving you the latest version that's because of a slight
mistake I made converting CVS to Hg (I forgot to rename 'HEAD' to
'default'). hg update -C tip will bring you to the latest version, and
hg update should keep you there. I'll have to fix the branch name
problem.

Changed 16 months ago by Christoph Ludwig

On Mon, Jul 16, 2007 at 05:09:16PM -0000, Mutt wrote:
> #2931: BDB support in header cache broken
> Comment (by Brendan Cully):
> 
>  hg parents will tell you which version is checked out. I think if
>  clone isn't giving you the latest version that's because of a slight
>  mistake I made converting CVS to Hg (I forgot to rename 'HEAD' to
>  'default'). hg update -C tip will bring you to the latest version, and
>  hg update should keep you there. I'll have to fix the branch name
>  problem.

I just did the following:

  castellio:~/hg-repos cludwig$ hg clone http://dev.mutt.org/hg/mutt
  mutt_public_repository
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 5192 changesets with 15396 changes to 514 files (+8 heads)
  369 files updated, 0 files merged, 0 files removed, 0 files unresolved
  castellio:~/hg-repos cludwig$ cd mutt_public_repository/
  castellio:~/hg-repos/mutt_public_repository cludwig$ hg log -r tip
  changeset:   5191:bd75134a6b65
  branch:      HEAD
  tag:         tip
  user:        Brendan Cully <brendan@kublai.com>
  date:        Mon Jul 16 10:46:49 2007 -0700
  summary:     Make is_shell_char static. Closes #2907.

  castellio:~/hg-repos/mutt_public_repository cludwig$ hg parents
  changeset:   5034:f467353f5657
  user:        Brendan Cully <brendan@kublai.com>
  date:        Sat Mar 31 18:50:39 2007 -0700
  summary:     Add tmp flag to bcache_put, create bcache_commit.

  castellio:~/hg-repos/mutt_public_repository cludwig$ hg update -C
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  castellio:~/hg-repos/mutt_public_repository cludwig$ hg parents
  changeset:   5034:f467353f5657
  user:        Brendan Cully <brendan@kublai.com>
  date:        Sat Mar 31 18:50:39 2007 -0700
  summary:     Add tmp flag to bcache_put, create bcache_commit.

Unless I misunderstand you, this should give me the most recent mutt.
However, the call to db_create() is still missing in hcache.c near line 1000.

I agree that changeset e363d7a69046 seems to have fixed the same issue, but,
for whatever reason, the fix has been lost along the way.

Regards

Christoph

Changed 16 months ago by Brendan Cully

On Monday, 16 July 2007 at 19:23, Mutt wrote:
> #2931: BDB support in header cache broken
> 
> Comment (by Christoph Ludwig):
> 
>  {{{
>  On Mon, Jul 16, 2007 at 05:09:16PM -0000, Mutt wrote:
>  > #2931: BDB support in header cache broken
>  > Comment (by Brendan Cully):
>  >
>  >  hg parents will tell you which version is checked out. I think if
>  >  clone isn't giving you the latest version that's because of a slight
>  >  mistake I made converting CVS to Hg (I forgot to rename 'HEAD' to
>  >  'default'). hg update -C tip will bring you to the latest version, and
>  >  hg update should keep you there. I'll have to fix the branch name
>  >  problem.
> 
>  I just did the following:
> 
>    castellio:~/hg-repos cludwig$ hg clone http://dev.mutt.org/hg/mutt
>    mutt_public_repository
>    requesting all changes
>    adding changesets
>    adding manifests
>    adding file changes
>    added 5192 changesets with 15396 changes to 514 files (+8 heads)
>    369 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    castellio:~/hg-repos cludwig$ cd mutt_public_repository/
>    castellio:~/hg-repos/mutt_public_repository cludwig$ hg log -r tip
>    changeset:   5191:bd75134a6b65
>    branch:      HEAD
>    tag:         tip
>    user:        Brendan Cully <brendan@kublai.com>
>    date:        Mon Jul 16 10:46:49 2007 -0700
>    summary:     Make is_shell_char static. Closes #2907.
> 
>    castellio:~/hg-repos/mutt_public_repository cludwig$ hg parents
>    changeset:   5034:f467353f5657
>    user:        Brendan Cully <brendan@kublai.com>
>    date:        Sat Mar 31 18:50:39 2007 -0700
>    summary:     Add tmp flag to bcache_put, create bcache_commit.
> 
>    castellio:~/hg-repos/mutt_public_repository cludwig$ hg update -C
>    0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    castellio:~/hg-repos/mutt_public_repository cludwig$ hg parents
>    changeset:   5034:f467353f5657
>    user:        Brendan Cully <brendan@kublai.com>
>    date:        Sat Mar 31 18:50:39 2007 -0700
>    summary:     Add tmp flag to bcache_put, create bcache_commit.
> 
>  Unless I misunderstand you, this should give me the most recent mutt.
>  However, the call to db_create() is still missing in hcache.c near line
>  1000.

The important bit you missed is you must "hg update -C tip", not "hg
update -C"

hg parents should then show 5191.

Changed 16 months ago by cludwig

Oh, ok, that does indeed resolve the issue. Sorry for the noise.

Regards

Christoph

Changed 16 months ago by brendan

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.