Skip to content

Commit

Permalink
init_buildsystem: Move hostname ip entry to the end of /etc/hosts
Browse files Browse the repository at this point in the history
spymemcached package is FTBFS because a test expects a reverse lookup of
127.0.0.1 to return localhost, but current /etc/hosts configuration
returns the hostname instead.

Let's move this `hostname/ip` entry to the end of /etc/hosts so the
reverse lookup of 127.0.0.1 returns localhost, which makes sense to be
the default case usually.

Signed-off-by: Ariel D'Alessandro <[email protected]>
  • Loading branch information
adalessandro authored and Ritesh Raj Sarraf committed Feb 1, 2022
1 parent 7253fc5 commit a68beef
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions init_buildsystem
Original file line number Diff line number Diff line change
Expand Up @@ -1175,11 +1175,7 @@ fi
test -e $BUILD_ROOT/.build/init_buildsystem.data || HOST=`hostname`
test -e $BUILD_ROOT/etc/hosts || echo "127.0.0.1 localhost" > $BUILD_ROOT/etc/hosts
if ! grep -F "127.0.0.1 $HOST" $BUILD_ROOT/etc/hosts > /dev/null ; then
# this makes a reverse lookup on 127.0.0.1 return the host name,
# which is bad, but 127.0.0.2 does not work on all unix systems
echo "127.0.0.1 $HOST" > $BUILD_ROOT/etc/hosts.new
test -f $BUILD_ROOT/etc/hosts && cat $BUILD_ROOT/etc/hosts >> $BUILD_ROOT/etc/hosts.new
mv $BUILD_ROOT/etc/hosts.new $BUILD_ROOT/etc/hosts
echo "127.0.0.1 $HOST" >> $BUILD_ROOT/etc/hosts
fi

rm -f $BUILD_ROOT/.rpmmacros $BUILD_ROOT/root/.rpmmacros
Expand Down

0 comments on commit a68beef

Please sign in to comment.