Project

General

Profile

Bug #11897

rsync_bu: conffile without rsync keyword: "src_dir: unbound variable"

Added by Charles Atkinson 11 months ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Start date:
16/03/2021
Due date:
% Done:

0%

Close

Description

/opt/bung/lib/postprocess_rsync_conf.fun: line 39: src_dir: unbound variable

History

#1 Updated by Charles Atkinson 10 months ago

  • Status changed from New to In Progress
  • Description updated (diff)
Investigate
  • rsync_bu.sh's function initialise had
        # rsync
        postprocess_rsync_conf
        err_trap_rsync_conf
    
  • lib/postprocess_rsync_conf.fun
        # Ensure SRC has trailing /
        # ~~~~~~~~~~~~~~~~~~~~~~~~~
        # Required for rsync to work as intended
        if [[ ! ${src_dir:-} =~ $trailing_slash_regex ]]; then
            src_dir=$src_dir/
        fi
    
  • lib/err_trap_rsync_conf had
        # Nothing to do?
        # ~~~~~~~~~~~~~~
        if [[ ${src_dir:-} = '' ]]; then
            emsg+=$msg_lf"No backup configured (no rsync keyword)" 
            fct "${FUNCNAME[0]}" 'returning 1'
            return 1
        fi
    

Decided to fix by changing postprocess_rsync_conf.fun to return early when src_dir not set or empty

Next: implement and test in version 3.0.0

#2 Updated by Charles Atkinson 10 months ago

Implemented in pre-git bung 3.0.0 and hence part of the bung3 repo initial commit

Next: test

#3 Updated by Charles Atkinson 10 months ago

  • Status changed from In Progress to Closed

Tested (OK)

root@CW10:/etc/bung# /usr/bin/rsync_bu -c Bug#11897 -l /dev/tty
14:39:42 rsync_bu+Bug#11897 3.0.2 started on cw10.localdomain. PID: 28281, PPID: 27971
14:39:42 Command line: /usr/bin/rsync_bu -c Bug#11897 -l /dev/tty 
14:39:42 Converted LABEL=boot to /dev/sdb2
14:39:42 Converted UUID=89CC-7B85 to /dev/sdb1
14:39:42 ERROR: Error(s) in configuration file /etc/bung/Bug#11897:
    No backup configured (no rsync keyword)
14:39:42 There was at least one ERROR
14:39:42 Exiting with return value 2

Also available in: Atom PDF