CMake install script breaks Ubuntu 20.04 /bin
(Preface: I only tested this with the Ubuntu:20.04 docker container)
Bug Report
Description
In Ubuntu 20.04 (and iirc 19.04) /bin
is a symlink to /usr/bin
. When using the cmake install script offered by the official download website it replaces this symlink by an actual folder, hence destroying everything that relies on things existing in /bin
.
To Reproduce
$ docker run -it ubuntu:20.04 bash # launches bash in a docker container with ubuntu:20.04
$ apt update && apt install wget file # needed to (1) download the script (2) check /bin
$ wget \
-O cmakeInstallScript.sh \
https://github.com/Kitware/CMake/releases/download/v3.21.0-rc3/cmake-3.21.0-rc3-linux-x86_64.sh \
--no-check-certificate
$ file /bin
/bin: symbolic link to usr/bin
$ bash cmakeInstallScript.sh --skip-license # defaults to "/" as prefix
$ file /bin
/bin: directory
Further Information
- I only stumbled upon this while building a docker container but I guess this could also happen when running the script in an actual ubuntu:20.04? However, this would probably need
sudo
privileges? - In the docker session or while building an image (via
docker build
) everything is executed with root privileges in the container. - This came to my attention because after
cmake
was the only thing in/bin
it was not able to find a build program or anything at all when I tried to build something else.
Workaround
Set a safe prefix.
$ bash cmakeInstallScript.sh --skip-license --prefix=/usr