Menu

#77 'set logging' not working - w/ patch

v1.0_(example)
closed-accepted
None
5
2023-05-08
2023-05-07
ma-ti
No

Summary: set logging not working and log file not found. Patch logging.patch contains fix and tests.

What:
1) When trying to use set logging I get the following command not found error:

bashdb<0> set logging
/home/martin/opt/bashdb-5.0-1.1.2_install2/share/bashdb/command/set.sh: line 65: _Dbg_cmd_set_logging: command not found
bashdb<1> set logging on
/home/martin/opt/bashdb-5.0-1.1.2_install2/share/bashdb/command/set.sh: line 65: _Dbg_cmd_set_logging: command not found
bashdb<2> 

Fix for 1:

--- a/command/set.sh
+++ b/command/set.sh
@@ -62,7 +62,7 @@ _Dbg_do_set() {
            return $?
            ;;
        lo | log | logg | loggi | loggin | logging )
-           _Dbg_cmd_set_logging $@
+           _Dbg_do_set_logging $@
            ;;
        t|tr|tra|trac|trace|trace-|trace-c|trace-co|trace-com|trace-comm|trace-comma|trace-comman|trace-command|trace-commands )
            _Dbg_do_set_trace_commands $@

2) After replacing _Dbg_cmd_set_logging w/ _Dbg_do_set_logging I get following ambiguous redirect error:

bashdb<0> set logging on
bashdb<1> b 3
/home/martin/opt/bashdb-5.0-1.1.2_install2/share/bashdb/lib/msg.sh: line 87: $_Dbg_logfid: ambiguous redirect

Fixfor 2:

--- a/command/set.sh
+++ b/command/set.sh
@@ -62,7 +62,7 @@ _Dbg_do_set() {
            return $?
            ;;
        lo | log | logg | loggi | loggin | logging )
-           _Dbg_cmd_set_logging $@
+           _Dbg_do_set_logging $@
            ;;
        t|tr|tra|trac|trace|trace-|trace-c|trace-co|trace-com|trace-comm|trace-comma|trace-comman|trace-command|trace-commands )
            _Dbg_do_set_trace_commands $@

3) Pollish set logging does not print the usage info, fixed too.

Version: bashdb-5.0-1.1.2, installed from package
System: Debian & Cygwin

1 Attachments

Discussion

  • ma-ti

    ma-ti - 2023-05-07

    Fix for 2 is actually the following:

    --- a/lib/msg.sh
    +++ b/lib/msg.sh
    @@ -84,7 +84,7 @@ function _Dbg_errmsg_no_cr {
     # print message to output device
     function _Dbg_msg {
         if (( _Dbg_logging )) ; then
    -        builtin echo -e "$@" >>$_Dbg_logfid
    +        builtin echo -e "$@" >>$_Dbg_logging_file
         fi
         if (( ! _Dbg_logging_redirect )) ; then
             if [[ -n $_Dbg_tty  ]] && [[ $_Dbg_tty != '&1' ]] ; then
    @@ -98,7 +98,7 @@ function _Dbg_msg {
     # print message to output device without a carriage return at the end
     function _Dbg_msg_nocr {
         if (( _Dbg_logging )) ; then
    -        builtin echo -n -e "$@" >>$_Dbg_logfid
    +        builtin echo -n -e "$@" >>$_Dbg_logging_file
         fi
         if (( ! _Dbg_logging_redirect )) ; then
             if [[ -n $_Dbg_tty  ]] ; then
    @@ -120,7 +120,7 @@ function _Dbg_printf_nocr {
         typeset format=$1
         shift
         if (( _Dbg_logging )) ; then
    -        builtin printf "$format" "$@" >>$_Dbg_logfid
    +        builtin printf "$format" "$@" >>$_Dbg_logging_file
         fi
         if (( ! _Dbg_logging_redirect )) ; then
             if [[ -n $_Dbg_tty ]] ; then
    
     
  • Rocky Bernstein

    Rocky Bernstein - 2023-05-07

    Thanks - this is now applied in the bash-5.1 branch at commit 69de4e2

    A small additional change was added to configure.ac ensure the test program gets created.

    Please double check.

     
  • ma-ti

    ma-ti - 2023-05-08

    Looking good. Thx for the quick turn-around.

     
  • Rocky Bernstein

    Rocky Bernstein - 2023-05-08
    • status: open --> closed-accepted
    • assigned_to: Rocky Bernstein
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.