• Kirill Smelkov's avatar
    gitlab-backup: Use find in a way, that does not hide errors · 64a16570
    Kirill Smelkov authored
    In 495bd2fa (gitlab-backup: Unpack *.tar.gz before storing them in git)
    we used find(1) to find *.tar.gz and unpack/repack them on
    backup/restore. However `find -exec ...` does not stop on errors and
    does not report them. Compare:
    
        ---- 8< ---- x.sh
        #!/bin/bash -e
    
        echo AAA
        find . -exec false ';'
        echo BBB
        ---- 8< ----
    
        ---- 8< ---- y.sh
        #!/bin/bash -e
    
        echo XXX
        find . | \
        while read F; do
            false
        done
        echo YYY
        ---- 8< ----
    
        $ ./x.sh
        AAA
        BBB
        $ echo $?
        0
    
        $ ./y.sh
        XXX
        $ echo $?
        1
    
    So we switch to second style where find passes entries to processing
    program via channel. This second new style is also more clean, in my view,
    because listing and processing parts are now more better structured.
    
    /cc @kazuhiko
    64a16570
gitlab-backup 5.93 KB