curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Avoiding overwriting a symlinked target

From: Paul Gilmartin via curl-users <curl-users_at_lists.haxx.se>
Date: Sat, 1 Jan 2022 12:15:39 -0700

On Dec 30, 2021, at 10:54:52, Dirk Fieldhouse via curl-users <curl-users_at_lists.haxx.se> wrote:
>
> A utility comprising a single executable could normally be installed in
> most Unix-like cases by downloading it to /usr/local/bin (via eg, sudo
> curl ... -o /usr/local/bin/utility) and setting executable permission.
>
> A user following instructions like this [1] had the problem that the
> destination file already existed as a symbolic link to firejail. As a
> result the instructions caused the firejail binary to be clobbered and
> all the user's supposedly firejailed programs were apparently replaced
> by the downloaded utility, until firejail was re-installed.
> ...
> 1.
> <https://askubuntu.com/questions/1383688/after-installing-youtube-dl-on-ubuntu-21-10-with-the-instructions-on-github-many>
>
My circumvention for this has been:
    mkdir work
    curl ... -o /work/utility
    mv /work/utility /usr/local/bin/. # Replace the link, not its target.
    rmdir work

Drawbacks:
o It only works if I remember to do it.
o It's tedious.
o If I forget and do:
    mv /work/utility /usr/local/bin/utility
  ... it again replaces the target, not the link.

-- gil

-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-01-01