• Kirill Smelkov's avatar
    gitlab-backup/restore: Don't allow ln ambiguity (which can lead to failures) · 7279754d
    Kirill Smelkov authored
    ln has several syntaxes. man ln 1 ln:
    
       SYNOPSIS
              ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
              ln [OPTION]... TARGET                  (2nd form)
              ln [OPTION]... TARGET... DIRECTORY     (3rd form)
              ln [OPTION]... -t DIRECTORY TARGET...  (4th form)
    
    so without -T or -t what is target and what is link name is ambiguous and
    ln tries to guess. Now imagine:
    
        ln -sf /path/to/new/hook    $H
    
    and let us consider that $H is already a symlink, pointing to some place
    which _exists_, but current user do not have access to. Then ln will
    complain:
    
        ln: accessing `$H': Permission denied
    
    and abort.
    
    Fix it by specifying ln form we use explicitly with -T.
    7279754d
gitlab-backup 13.4 KB