Page MenuHomeVyOS Platform

Commit hooks
Open, LowPublicBUG

Description

I posted this here before I had a phabricator account, but to recap, I cannot get scripts in /config/scripts/commit/post-hooks.d to run, at least not reliably.

I've tried playing with permissions and script naming, but it really seems to be an issue with my_commit and I don't really know how to debug that.

The following specific example output is from a router running my own build of 1.4, but it's at least as unreliable on a clean (but unofficial) build of 1.3.2.

(If you try it and it works, try installing another system image and migrating your config directory. This may have something to do with it.)

Transcript of it not working, with a set -x ; commit to show that the running shell and its subshells do not attempt to run the hook scripts:

vyos@vyos:~$ ls /config/scripts/commit/post-hooks.d
test
vyos@vyos:~$ ls -laR /config/scripts
/config/scripts:
total 16
drwxrwsr-x 3 root vyattacfg 4096 Jan  2 07:13 .
drwxrwxr-x 8 root vyattacfg 4096 Jan  5 14:27 ..
drwxrwsr-x 3 root vyattacfg 4096 Jan  2 07:13 commit
-rwxrwxr-x 1 root vyattacfg  230 Dec 10 11:12 vyos-postconfig-bootup.script

/config/scripts/commit:
total 12
drwxrwsr-x 3 root vyattacfg 4096 Jan  2 07:13 .
drwxrwsr-x 3 root vyattacfg 4096 Jan  2 07:13 ..
drwxrwsr-x 2 root vyattacfg 4096 Jan  2 07:14 post-hooks.d

/config/scripts/commit/post-hooks.d:
total 12
drwxrwsr-x 2 root vyattacfg 4096 Jan  2 07:14 .
drwxrwsr-x 3 root vyattacfg 4096 Jan  2 07:13 ..
-rwxrwxr-x 1 root vyattacfg  131 Jan  2 07:14 test
vyos@vyos:~$ cat /config/scripts/commit/post-hooks.d/test
#!/bin/vbash
if [ "$(id -g -n)" != 'vyattacfg' ] ; then
    exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
fi

echo "pipo"
vyos@vyos:~$ config
[edit]
vyos@vyos# show sy ho
 /* foobar */
 host-name vyos
[edit]
vyos@vyos# comment sy ho ""
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# comment system host-name foobar
[edit]
vyos@vyos# set -x
+ return
++ history -a
[edit]
vyos@vyos# commit
+ vyatta_cfg_run commit
+ [[ commit == \s\e\t ]]
+ local cmd=commit
+ args=("$@")
+ local -a args
+ local -a filtered_cmds
+ get_prefix_filtered_list commit _vyatta_cfg_cmds filtered_cmds
+ declare -a olist
+ local pfx=commit
+ pfx=commit
+ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
++ olist=("${_vyatta_cfg_cmds[@]}")
+ local idx=0
+ for elem in '"${olist[@]}"'
+ local sub=confirm
+ [[ confirm == \c\o\n\f\i\r\m ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=comment
+ [[ comment == \c\o\m\m\e\n\t ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=
+ [[ commit == '' ]]
+ eval 'filtered_cmds[0]=$elem'
++ filtered_cmds[0]=commit
+ ((  idx++  ))
+ for elem in '"${olist[@]}"'
+ local sub=-confirm
+ [[ commit-confirm == \-\c\o\n\f\i\r\m ]]
+ eval 'filtered_cmds[1]=$elem'
++ filtered_cmds[1]=commit-confirm
+ ((  idx++  ))
+ for elem in '"${olist[@]}"'
+ local sub=compare
+ [[ compare == \c\o\m\p\a\r\e ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=copy
+ [[ copy == \c\o\p\y ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=delete
+ [[ delete == \d\e\l\e\t\e ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=discard
+ [[ discard == \d\i\s\c\a\r\d ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=edit
+ [[ edit == \e\d\i\t ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=exit
+ [[ exit == \e\x\i\t ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=load
+ [[ load == \l\o\a\d ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=loadkey
+ [[ loadkey == \l\o\a\d\k\e\y ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=merge
+ [[ merge == \m\e\r\g\e ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=rename
+ [[ rename == \r\e\n\a\m\e ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=rollback
+ [[ rollback == \r\o\l\l\b\a\c\k ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=run
+ [[ run == \r\u\n ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=save
+ [[ save == \s\a\v\e ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=set
+ [[ set == \s\e\t ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=show
+ [[ show == \s\h\o\w ]]
+ [[ -n commit ]]
+ continue
+ local found
+ is_elem_of commit _vyatta_cfg_cmds
+ local elem=commit
+ local -a olist
+ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
++ olist=("${_vyatta_cfg_cmds[@]}")
+ for e in '"${olist[@]}"'
+ [[ confirm == \c\o\m\m\i\t ]]
+ for e in '"${olist[@]}"'
+ [[ comment == \c\o\m\m\i\t ]]
+ for e in '"${olist[@]}"'
+ [[ commit == \c\o\m\m\i\t ]]
+ return 0
+ found=0
+ stty echo
+ [[ 2 == \0 ]]
+ [[ 2 != \1 ]]
+ [[ 0 == \1 ]]
+ local fcmd
+ is_elem_of commit _vyatta_cfg_cmds
+ local elem=commit
+ local -a olist
+ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
++ olist=("${_vyatta_cfg_cmds[@]}")
+ for e in '"${olist[@]}"'
+ [[ confirm == \c\o\m\m\i\t ]]
+ for e in '"${olist[@]}"'
+ [[ comment == \c\o\m\m\i\t ]]
+ for e in '"${olist[@]}"'
+ [[ commit == \c\o\m\m\i\t ]]
+ return 0
+ fcmd=commit
+ case $fcmd in
+ vyatta_config_commit
+ vyatta_cli_shell_api sessionChanged
+ local noeval=
+ '[' sessionChanged == NOEVAL ']'
+ local outstr
++ /opt/vyatta/sbin/my_cli_shell_api -- sessionChanged
+ outstr=
+ '[' -n '' ']'
+ return 0
+ local comment=commit
+ local next=0
+ args=()
+ local -a args
+ export COMMIT_COMMENT=commit
+ COMMIT_COMMENT=commit
+ export COMMIT_VIA=cli
+ COMMIT_VIA=cli
+ /opt/vyatta/sbin/my_commit
+ unset COMMIT_VIA
+ unset COMMIT_COMMENT
++ history -a
[edit]
vyos@vyos# comment system host-name ""
+ vyatta_cfg_run comment system host-name ''
+ [[ comment == \s\e\t ]]
+ local cmd=comment
+ args=("$@")
+ local -a args
+ local -a filtered_cmds
+ get_prefix_filtered_list comment _vyatta_cfg_cmds filtered_cmds
+ declare -a olist
+ local pfx=comment
+ pfx=comment
+ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
++ olist=("${_vyatta_cfg_cmds[@]}")
+ local idx=0
+ for elem in '"${olist[@]}"'
+ local sub=confirm
+ [[ confirm == \c\o\n\f\i\r\m ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=
+ [[ comment == '' ]]
+ eval 'filtered_cmds[0]=$elem'
++ filtered_cmds[0]=comment
+ ((  idx++  ))
+ for elem in '"${olist[@]}"'
+ local sub=commit
+ [[ commit == \c\o\m\m\i\t ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=commit-confirm
+ [[ commit-confirm == \c\o\m\m\i\t\-\c\o\n\f\i\r\m ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=compare
+ [[ compare == \c\o\m\p\a\r\e ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=copy
+ [[ copy == \c\o\p\y ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=delete
+ [[ delete == \d\e\l\e\t\e ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=discard
+ [[ discard == \d\i\s\c\a\r\d ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=edit
+ [[ edit == \e\d\i\t ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=exit
+ [[ exit == \e\x\i\t ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=load
+ [[ load == \l\o\a\d ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=loadkey
+ [[ loadkey == \l\o\a\d\k\e\y ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=merge
+ [[ merge == \m\e\r\g\e ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=rename
+ [[ rename == \r\e\n\a\m\e ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=rollback
+ [[ rollback == \r\o\l\l\b\a\c\k ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=run
+ [[ run == \r\u\n ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=save
+ [[ save == \s\a\v\e ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=set
+ [[ set == \s\e\t ]]
+ [[ -n comment ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=show
+ [[ show == \s\h\o\w ]]
+ [[ -n comment ]]
+ continue
+ local found
+ is_elem_of comment _vyatta_cfg_cmds
+ local elem=comment
+ local -a olist
+ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
++ olist=("${_vyatta_cfg_cmds[@]}")
+ for e in '"${olist[@]}"'
+ [[ confirm == \c\o\m\m\e\n\t ]]
+ for e in '"${olist[@]}"'
+ [[ comment == \c\o\m\m\e\n\t ]]
+ return 0
+ found=0
+ stty echo
+ [[ 1 == \0 ]]
+ [[ 1 != \1 ]]
+ local fcmd
+ is_elem_of comment _vyatta_cfg_cmds
+ local elem=comment
+ local -a olist
+ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
++ olist=("${_vyatta_cfg_cmds[@]}")
+ for e in '"${olist[@]}"'
+ [[ confirm == \c\o\m\m\e\n\t ]]
+ for e in '"${olist[@]}"'
+ [[ comment == \c\o\m\m\e\n\t ]]
+ return 0
+ fcmd=comment
+ case $fcmd in
+ vyatta_config_comment comment system host-name ''
+ local cmd=comment
+ [[ 4 == \1 ]]
+ args=("$@")
+ local -a args
+ local 'comment='\'''\'''
+ args=("${args[@]:0:$[${#args[@]}-1]}")
+ expanded_api_args=()
+ local -a expanded_api_args
++ cli-shell-api getEditLevelStr
+ local editlvl=
+ vyatta_config_expand_compwords comment system host-name
+ local cmd=comment
++ vyatta_cfg_expand_top_level comment
++ local cmd=comment
++ filtered_cmds=()
++ local -a filtered_cmds
++ get_prefix_filtered_list comment _vyatta_cfg_cmds filtered_cmds
++ declare -a olist
++ local pfx=comment
++ pfx=comment
++ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
+++ olist=("${_vyatta_cfg_cmds[@]}")
++ local idx=0
++ for elem in '"${olist[@]}"'
++ local sub=confirm
++ [[ confirm == \c\o\n\f\i\r\m ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=
++ [[ comment == '' ]]
++ eval 'filtered_cmds[0]=$elem'
+++ filtered_cmds[0]=comment
++ ((  idx++  ))
++ for elem in '"${olist[@]}"'
++ local sub=commit
++ [[ commit == \c\o\m\m\i\t ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=commit-confirm
++ [[ commit-confirm == \c\o\m\m\i\t\-\c\o\n\f\i\r\m ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=compare
++ [[ compare == \c\o\m\p\a\r\e ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=copy
++ [[ copy == \c\o\p\y ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=delete
++ [[ delete == \d\e\l\e\t\e ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=discard
++ [[ discard == \d\i\s\c\a\r\d ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=edit
++ [[ edit == \e\d\i\t ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=exit
++ [[ exit == \e\x\i\t ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=load
++ [[ load == \l\o\a\d ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=loadkey
++ [[ loadkey == \l\o\a\d\k\e\y ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=merge
++ [[ merge == \m\e\r\g\e ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=rename
++ [[ rename == \r\e\n\a\m\e ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=rollback
++ [[ rollback == \r\o\l\l\b\a\c\k ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=run
++ [[ run == \r\u\n ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=save
++ [[ save == \s\a\v\e ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=set
++ [[ set == \s\e\t ]]
++ [[ -n comment ]]
++ continue
++ for elem in '"${olist[@]}"'
++ local sub=show
++ [[ show == \s\h\o\w ]]
++ [[ -n comment ]]
++ continue
++ local found
++ is_elem_of comment _vyatta_cfg_cmds
++ local elem=comment
++ local -a olist
++ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
+++ olist=("${_vyatta_cfg_cmds[@]}")
++ for e in '"${olist[@]}"'
++ [[ confirm == \c\o\m\m\e\n\t ]]
++ for e in '"${olist[@]}"'
++ [[ comment == \c\o\m\m\e\n\t ]]
++ return 0
++ found=0
++ local fcmd
++ [[ 1 == \1 ]]
++ [[ 1 == \1 ]]
++ fcmd=comment
++ echo comment
+ cmd=comment
+ expanded_api_args=("$cmd")
+ local _cli_shell_api_last_comp_val=
+ local _cli_shell_api_comp_help=
+ _cli_shell_api_comp_values=()
+ local -a _cli_shell_api_comp_values
+ _cli_shell_api_hitems=()
+ local -a _cli_shell_api_hitems
+ _cli_shell_api_hstrs=()
+ local -a _cli_shell_api_hstrs
+ path=("$cmd")
+ local -a path
+ for arg in '"${@:2}"'
+ _cli_shell_api_comp_values=()
+ _cli_shell_api_last_comp_val=
+ [[ -z system ]]
+ path=("${expanded_api_args[@]}" "$arg")
+ vyatta_cli_shell_api getCompletionEnv comment system
+ local noeval=
+ '[' getCompletionEnv == NOEVAL ']'
+ local outstr
++ /opt/vyatta/sbin/my_cli_shell_api -- getCompletionEnv comment system
+ outstr='_cli_shell_api_comp_values=('\''system'\'' ); _cli_shell_api_last_comp_val=false; _cli_shell_api_comp_help='\'''\''; _cli_shell_api_hitems=('\''system'\'' ); _cli_shell_api_hstrs=('\''System parameters'\'' ); '
+ '[' -n '_cli_shell_api_comp_values=('\''system'\'' ); _cli_shell_api_last_comp_val=false; _cli_shell_api_comp_help='\'''\''; _cli_shell_api_hitems=('\''system'\'' ); _cli_shell_api_hstrs=('\''System parameters'\'' ); ' ']'
+ '[' -n '' ']'
+ eval '_cli_shell_api_comp_values=('\''system'\'' ); _cli_shell_api_last_comp_val=false; _cli_shell_api_comp_help='\'''\''; _cli_shell_api_hitems=('\''system'\'' ); _cli_shell_api_hstrs=('\''System parameters'\'' ); '
++ _cli_shell_api_comp_values=('system')
++ _cli_shell_api_last_comp_val=false
++ _cli_shell_api_comp_help=
++ _cli_shell_api_hitems=('system')
++ _cli_shell_api_hstrs=('System parameters')
+ return 0
+ [[ 1 == \1 ]]
+ [[ false == \t\r\u\e ]]
+ arg=system
+ expanded_api_args+=("$arg")
+ for arg in '"${@:2}"'
+ _cli_shell_api_comp_values=()
+ _cli_shell_api_last_comp_val=
+ [[ -z host-name ]]
+ path=("${expanded_api_args[@]}" "$arg")
+ vyatta_cli_shell_api getCompletionEnv comment system host-name
+ local noeval=
+ '[' getCompletionEnv == NOEVAL ']'
+ local outstr
++ /opt/vyatta/sbin/my_cli_shell_api -- getCompletionEnv comment system host-name
+ outstr='_cli_shell_api_comp_values=('\''host-name'\'' ); _cli_shell_api_last_comp_val=false; _cli_shell_api_comp_help='\'''\''; _cli_shell_api_hitems=('\''host-name'\'' ); _cli_shell_api_hstrs=('\''System host name (default: vyos)'\'' ); '
+ '[' -n '_cli_shell_api_comp_values=('\''host-name'\'' ); _cli_shell_api_last_comp_val=false; _cli_shell_api_comp_help='\'''\''; _cli_shell_api_hitems=('\''host-name'\'' ); _cli_shell_api_hstrs=('\''System host name (default: vyos)'\'' ); ' ']'
+ '[' -n '' ']'
+ eval '_cli_shell_api_comp_values=('\''host-name'\'' ); _cli_shell_api_last_comp_val=false; _cli_shell_api_comp_help='\'''\''; _cli_shell_api_hitems=('\''host-name'\'' ); _cli_shell_api_hstrs=('\''System host name (default: vyos)'\'' ); '
++ _cli_shell_api_comp_values=('host-name')
++ _cli_shell_api_last_comp_val=false
++ _cli_shell_api_comp_help=
++ _cli_shell_api_hitems=('host-name')
++ _cli_shell_api_hstrs=('System host name (default: vyos)')
+ return 0
+ [[ 1 == \1 ]]
+ [[ false == \t\r\u\e ]]
+ arg=host-name
+ expanded_api_args+=("$arg")
+ [[ 4 != \3 ]]
+ expanded_api_args+=($comment)
++ eval '/opt/vyatta/sbin/my_comment system' host-name ''\'''\'''
+++ /opt/vyatta/sbin/my_comment system host-name ''
+ output=
+ vyatta_cfg_print_output ''
+ local output=
+ [[ ! -z '' ]]
++ history -a
[edit]
vyos@vyos# commit
+ vyatta_cfg_run commit
+ [[ commit == \s\e\t ]]
+ local cmd=commit
+ args=("$@")
+ local -a args
+ local -a filtered_cmds
+ get_prefix_filtered_list commit _vyatta_cfg_cmds filtered_cmds
+ declare -a olist
+ local pfx=commit
+ pfx=commit
+ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
++ olist=("${_vyatta_cfg_cmds[@]}")
+ local idx=0
+ for elem in '"${olist[@]}"'
+ local sub=confirm
+ [[ confirm == \c\o\n\f\i\r\m ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=comment
+ [[ comment == \c\o\m\m\e\n\t ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=
+ [[ commit == '' ]]
+ eval 'filtered_cmds[0]=$elem'
++ filtered_cmds[0]=commit
+ ((  idx++  ))
+ for elem in '"${olist[@]}"'
+ local sub=-confirm
+ [[ commit-confirm == \-\c\o\n\f\i\r\m ]]
+ eval 'filtered_cmds[1]=$elem'
++ filtered_cmds[1]=commit-confirm
+ ((  idx++  ))
+ for elem in '"${olist[@]}"'
+ local sub=compare
+ [[ compare == \c\o\m\p\a\r\e ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=copy
+ [[ copy == \c\o\p\y ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=delete
+ [[ delete == \d\e\l\e\t\e ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=discard
+ [[ discard == \d\i\s\c\a\r\d ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=edit
+ [[ edit == \e\d\i\t ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=exit
+ [[ exit == \e\x\i\t ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=load
+ [[ load == \l\o\a\d ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=loadkey
+ [[ loadkey == \l\o\a\d\k\e\y ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=merge
+ [[ merge == \m\e\r\g\e ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=rename
+ [[ rename == \r\e\n\a\m\e ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=rollback
+ [[ rollback == \r\o\l\l\b\a\c\k ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=run
+ [[ run == \r\u\n ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=save
+ [[ save == \s\a\v\e ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=set
+ [[ set == \s\e\t ]]
+ [[ -n commit ]]
+ continue
+ for elem in '"${olist[@]}"'
+ local sub=show
+ [[ show == \s\h\o\w ]]
+ [[ -n commit ]]
+ continue
+ local found
+ is_elem_of commit _vyatta_cfg_cmds
+ local elem=commit
+ local -a olist
+ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
++ olist=("${_vyatta_cfg_cmds[@]}")
+ for e in '"${olist[@]}"'
+ [[ confirm == \c\o\m\m\i\t ]]
+ for e in '"${olist[@]}"'
+ [[ comment == \c\o\m\m\i\t ]]
+ for e in '"${olist[@]}"'
+ [[ commit == \c\o\m\m\i\t ]]
+ return 0
+ found=0
+ stty echo
+ [[ 2 == \0 ]]
+ [[ 2 != \1 ]]
+ [[ 0 == \1 ]]
+ local fcmd
+ is_elem_of commit _vyatta_cfg_cmds
+ local elem=commit
+ local -a olist
+ eval 'olist=( "${_vyatta_cfg_cmds[@]}" )'
++ olist=("${_vyatta_cfg_cmds[@]}")
+ for e in '"${olist[@]}"'
+ [[ confirm == \c\o\m\m\i\t ]]
+ for e in '"${olist[@]}"'
+ [[ comment == \c\o\m\m\i\t ]]
+ for e in '"${olist[@]}"'
+ [[ commit == \c\o\m\m\i\t ]]
+ return 0
+ fcmd=commit
+ case $fcmd in
+ vyatta_config_commit
+ vyatta_cli_shell_api sessionChanged
+ local noeval=
+ '[' sessionChanged == NOEVAL ']'
+ local outstr
++ /opt/vyatta/sbin/my_cli_shell_api -- sessionChanged
+ outstr=
+ '[' -n '' ']'
+ return 0
+ local comment=commit
+ local next=0
+ args=()
+ local -a args
+ export COMMIT_COMMENT=commit
+ COMMIT_COMMENT=commit
+ export COMMIT_VIA=cli
+ COMMIT_VIA=cli
+ /opt/vyatta/sbin/my_commit
+ unset COMMIT_VIA
+ unset COMMIT_COMMENT
++ history -a
[edit]
vyos@vyos#

Details

Difficulty level
Unknown (require assessment)
Version
1.4-rolling
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Behavior change
Issue type
Bug (incorrect behavior)

Event Timeline

huh, is it possible that we just don't run commit hooks upon changing only comments?

edit: that's one thing, but also filenames: it's picky. 99-git-commit_vyos.sh is bad, but 99-gitcommit is good.

I think someone said on the forums or the slack that the documentation mentions the filename limitations

Scripts are run in alphabetical order. Their names must consist entirely of ASCII upper- and lower-case letters,ASCII digits, ASCII underscores, and ASCII minus-hyphens.No other characters are allowed.

https://docs.vyos.io/en/latest/automation/command-scripting.html?#executing-pre-hooks-post-hooks-scripts

Thanks! That’ll help me with what I’m working on :)From where does this limitation originate, anyway? Is there a way to at least add . to the acceptable characters list, so as to allow for foo.sh?  Would that break something that expects to skip over filenames with dots and other characters?

In T4917#140239, @b- wrote:

Thanks! That’ll help me with what I’m working on :)From where does this limitation originate, anyway? Is there a way to at least add . to the acceptable characters list, so as to allow for foo.sh?  Would that break something that expects to skip over filenames with dots and other characters?

Not sure exactly but it seems this part of code https://github.com/vyos/vyatta-cfg/blob/ec568ce7b432acda01f9639afb509287a0e3d760/src/commit/commit-algorithm.cpp#L846

b- triaged this task as Low priority.Feb 27 2023, 7:57 PM
In T4917#140239, @b- wrote:

Thanks! That’ll help me with what I’m working on :)From where does this limitation originate, anyway? Is there a way to at least add . to the acceptable characters list, so as to allow for foo.sh?  Would that break something that expects to skip over filenames with dots and other characters?

Not sure exactly but it seems this part of code https://github.com/vyos/vyatta-cfg/blob/ec568ce7b432acda01f9639afb509287a0e3d760/src/commit/commit-algorithm.cpp#L846

Hm, I forgot to update this, sorry! That helped! It's just how run-parts does it, it seems (unless you change the behavior using its flags), and I'm inclined to believe that changing the flags to be more inclusive of filenames might break existing setups. (In that right now you can e.g., rename a hook script to $script.disabled to disable it)