Fossil Forum

hook delete all assertion error
Login

hook delete all assertion error

hook delete all assertion error

(1) By Kirill M (Kirill) on 2022-01-08 07:41:23 [source]

Happy new year, all!

I'm finally starting to explore hooks and noticed that delete all dumps core. Deleting hooks one by one works fine:

km@pf ~/navn $ fossil hook list
  0: type = before-commit
     command = echo %A
     sequence = 10

  1: type = before-commit
     command = cat %A
     sequence = 20

  2: type = before-commit
     command = echo %F %R %A
     sequence = 10
km@pf ~/navn $ fossil hook delete 2                                                             
km@pf ~/navn $ fossil hook delete 1 
km@pf ~/navn $ fossil hook delete all
unauthorized change to protected setting "hooks"
Abort trap (core dumped) 
km@pf ~/navn $ 

This is fossil version 2.16 [7aedd56758], but fossil version 2.17 [f48180f2ff] behaves the same way.

Although not a C programmer, I traced the error to be an assertion failure after hook.c tries db_set("hooks","[]", 0):

/*
** Assert that either all protections are off (including PROTECT_BASELINE
** which is usually always enabled), or the setting named in the argument
** is no a sensitive setting.
**
** This assert() is used to verify that the db_set() and db_set_int()
** interfaces do not modify a sensitive setting.
*/
void db_assert_protection_off_or_not_sensitive(const char *zName){
  if( db.protectMask!=0 && db_setting_is_protected(zName) ){
    fossil_panic("unauthorized change to protected setting \"%s\"", zName);
  }
}

hook.c does not look to do anything about PROTECT_BASEline prior to calling db_set.

Kirill

(2) By Stephan Beal (stephan) on 2022-01-08 08:30:15 in reply to 1 [link] [source]

hook.c does not look to do anything about PROTECT_BASEline prior to calling db_set.

Apparently, modifying "sensitive" settings requires briefly disabling all db protections. This has been fixed in the trunk.

Thank you for the report.