RIPE-NCC / ripe-atlas-software-probe

GNU General Public License v3.0
252 stars 61 forks source link

Error during make, chown returns "No such file or directory" #108

Open CTassisF opened 3 months ago

CTassisF commented 3 months ago

Description:

I'm building ripe-atlas-software-probe manually and encountering an error during make:

chown: //probe/etc/ripe-atlas/mode: No such file or directory

Steps to reproduce:

$ docker run -it --rm alpine /bin/sh

# apk add --no-cache autoconf automake g++ gcc git libtool linux-headers make openssl-dev patch sed
# adduser -D ripe-atlas
# git clone --recursive https://github.com/RIPE-NCC/ripe-atlas-software-probe.git
# cd ripe-atlas-software-probe/
# autoreconf -iv
# ./configure --prefix=/probe
# make
Making all in bin
make[1]: Entering directory '/ripe-atlas-software-probe/bin'
  GEN      arch/generic/generic-ATLAS.sh
  GEN      arch/generic/generic-common.sh
  GEN      arch/generic/generic-reginit.sh
  GEN      paths.lib.sh
  GEN      common.sh
  GEN      common-pre.sh
  GEN      config.sh
  GEN      reginit.sh
  GEN      resolvconf
  GEN      ripe-atlas
make[1]: Leaving directory '/ripe-atlas-software-probe/bin'
Making all in config
make[1]: Entering directory '/ripe-atlas-software-probe/config'
  GEN      ../probe-busybox/include/atlas_path.h
make  all-am
make[2]: Entering directory '/ripe-atlas-software-probe/config'
  GEN      common/FIRMWARE_APPS_VERSION
chown ripe-atlas:ripe-atlas //probe/etc/ripe-atlas/mode
chown: //probe/etc/ripe-atlas/mode: No such file or directory
make[2]: *** [Makefile:777: common/FIRMWARE_APPS_VERSION] Error 1
make[2]: Leaving directory '/ripe-atlas-software-probe/config'
make[1]: *** [Makefile:401: all] Error 2
make[1]: Leaving directory '/ripe-atlas-software-probe/config'
make: *** [Makefile:456: all-recursive] Error 1
#

Interestingly, the build completes successfully if you run make a second time.

Possible cause:

It seems that this Makefile is trying to chown something inside the --prefix=/probe directory before it is created (before make install).

Running ./configure --prefix=/probe --disable-chown before make fixes the issue, but it also disables the low-privilege user functionality.

michel-stam commented 3 months ago

This is so weird. I thought I had replied with an answer.

Anyway:

Fix bug with chown when systemd is disabled

During compile, if systemd is disabled, the build breaks unless
--disable-chown is given during configure.

Problem is caused when --disable-systemd is passed (or not detected)
which also disables the installation hook where the chown should be
executed. This then folds the chown into the generation of the
FIRMWARE_APPS_VERSION file, which is done at an early point in the
build where installation directories have not been created yet.

Fix is in the development branch. Cheers!