Skip to content

Abort more noisily #13

Merged
merged 1 commit into from
Aug 17, 2022
Merged

Abort more noisily #13

merged 1 commit into from
Aug 17, 2022

Commits on Aug 17, 2022

  1. Abort more noisily

    cmirror may abort on various error conditions. There was a complaint,
    that the error mesasge might be overlooked because of the normal
    diagnostic output:
    
        buczek@theinternet:~$ cmirror /tmp/a /tmp/b --delete
        theinternet.molgen.mpg.de: creating empty ./1
        theinternet.molgen.mpg.de: creating empty ./10
        theinternet.molgen.mpg.de: creating empty ./2
        theinternet.molgen.mpg.de: creating empty ./3
        theinternet.molgen.mpg.de: creating empty ./4
        theinternet.molgen.mpg.de: creating empty ./5
        theinternet.molgen.mpg.de: creating empty ./6
        theinternet.molgen.mpg.de: creating empty ./7
        theinternet.molgen.mpg.de: creating empty ./8
        theinternet.molgen.mpg.de: creating empty ./9
        theinternet.molgen.mpg.de: rm -r ./xx
        rm: cannot remove './xx/aa': Permission denied
        buczek@theinternet:~$
    
    To make this more clear, an additional diagnostic output was requested
    to show that cmirror didn't finish its job:
    
        buczek@theinternet:~$ cmirror /tmp/a /tmp/b --delete
        theinternet.molgen.mpg.de: creating empty ./1
        theinternet.molgen.mpg.de: creating empty ./10
        theinternet.molgen.mpg.de: creating empty ./2
        theinternet.molgen.mpg.de: creating empty ./3
        theinternet.molgen.mpg.de: creating empty ./4
        theinternet.molgen.mpg.de: creating empty ./5
        theinternet.molgen.mpg.de: creating empty ./6
        theinternet.molgen.mpg.de: creating empty ./7
        theinternet.molgen.mpg.de: creating empty ./8
        theinternet.molgen.mpg.de: creating empty ./9
        theinternet.molgen.mpg.de: rm -r ./xx
        rm: cannot remove './xx/aa': Permission denied
        cmirror aborted
        buczek@theinternet:~$
    
    Implementation:
    
    - Add code to `die()` to optionally show the additional
      message. This can be selected by a global flag
    
    - Let the master set that flag unless `--quiet` is selected
    
    - Add code to `die()` so that it can be called with `die(NULL)` to show
      only the optional additional message but no specific error message.
    
    - Replace `_exit(1)` with `die(NULL)` n places where it was used to
      abort the parent process after a child process, which as the duty to
      emit the error messages for its operation, has failed.
    donald committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    96ff047 View commit details
    Browse the repository at this point in the history