cmake -E touch does not work properly if file owned by other user.
I cannot user cmake
on source files that belong to other user by I have access to them. For example, I am in the group that has access to these files.
I tried to compare this behavior to native touch
command and found difference:
veei@debian:~$ touch main.cpp
veei@debian:~$ cmake -E touch main.cpp ^C
veei@debian:~$ touch main.cpp
veei@debian:~$ echo $?
0
veei@debian:~$ cmake -E touch main.cpp
veei@debian:~$ echo $?
1
veei@debian:~$ ls -l main.cpp
-rw-rw-r-- 1 root veei 266 Dec 25 11:18 main.cpp
veei@debian:~$ id
uid=1000(veei) gid=1000(veei) groups=1000(veei),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),108(netdev),110(lpadmin),113(scanner),999(docker)
veei@debian:~$ cmake --version
cmake version 3.0.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
veei@debian:~$ uname -a
Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux
veei@debian:~$
I tried this even with the latest cmake
version on a different server:
kvirund@bylins:/home/stribog/mud/build$ ${OLDPWD}/cmake --build . -- VERBOSE=1
/home/kvirund/distr/cmake-3.7.1/bin/cmake -H/home/stribog/mud -B/home/stribog/mud/build --check-build-system CMakeFiles/Makefile.cmake 0
/home/kvirund/distr/cmake-3.7.1/bin/cmake -E cmake_progress_start /home/stribog/mud/build/CMakeFiles /home/stribog/mud/build/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Вход в каталог `/home/stribog/mud/build'
/usr/bin/make -f CMakeFiles/versioning.dir/build.make CMakeFiles/versioning.dir/depend
make[2]: Вход в каталог `/home/stribog/mud/build'
cd /home/stribog/mud/build && /home/kvirund/distr/cmake-3.7.1/bin/cmake -E cmake_depends "Unix Makefiles" /home/stribog/mud /home/stribog/mud /home/stribog/mud/build /home/stribog/mud/build /home/stribog/mud/build/CMakeFiles/versioning.dir/DependInfo.cmake --color=
make[2]: Выход из каталога `/home/stribog/mud/build'
/usr/bin/make -f CMakeFiles/versioning.dir/build.make CMakeFiles/versioning.dir/build
make[2]: Вход в каталог `/home/stribog/mud/build'
/home/kvirund/distr/cmake-3.7.1/bin/cmake -E touch /home/stribog/mud/src/version.cpp.in
make[2]: *** [CMakeFiles/versioning] Ошибка 1
make[2]: Выход из каталога `/home/stribog/mud/build'
make[1]: *** [CMakeFiles/versioning.dir/all] Ошибка 2
make[1]: Выход из каталога `/home/stribog/mud/build'
make: *** [all] Ошибка 2
kvirund@bylins:/home/stribog/mud/build$ ls -l /home/stribog/mud/src/version.cpp.in
-rw-rw-r-- 1 stribog mud 882 дек. 25 18:47 /home/stribog/mud/src/version.cpp.in
kvirund@bylins:/home/stribog/mud/build$ /home/kvirund/distr/cmake-3.7.1/bin/cmake -E touch /home/stribog/mud/src/version.cpp.in
kvirund@bylins:/home/stribog/mud/build$ echo $?
1
kvirund@bylins:/home/stribog/mud/build$ touch /home/stribog/mud/src/version.cpp.in
kvirund@bylins:/home/stribog/mud/build$ echo $?
0
kvirund@bylins:/home/stribog/mud/build$ id
uid=1008(kvirund) gid=1000(mud) группы=1000(mud),999(docker)
kvirund@bylins:/home/stribog/mud/build$ /home/kvirund/distr/cmake-3.7.1/bin/cmake --version
cmake version 3.7.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
kvirund@bylins:/home/stribog/mud/build$ uname -a
Linux bylins 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
kvirund@bylins:/home/stribog/mud/build$