[Bug 267690] java/openjdk*: build fails silently (and hard in poudriere) due to bad usage of printf in bash

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 10 Nov 2022 12:54:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267690

            Bug ID: 267690
           Summary: java/openjdk*: build fails silently (and hard in
                    poudriere) due to bad usage of printf in bash
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: java@FreeBSD.org
          Reporter: michael.osipov@siemens.com
          Assignee: java@FreeBSD.org
             Flags: maintainer-feedback?(java@FreeBSD.org)

This was found during: https://github.com/freebsd/poudriere/issues/883

When trying to build java/openjdk8 with poudriere-devel I get the following
failure:
===============
A new configuration has been successfully created in
/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u342-b07.1/build/bsd-x86_64-normal-server-release
using configure arguments '--with-boot-jdk=/usr/local/bootstrap-openjdk8
--with-build-number=b07 --with-update-version=342 --with-vendor-name='OpenJDK
BSD Porting Team' --with-vendor-url=https://github.com/battleblow/jdk8u/
--with-vendor-bug-url=mumu --with-vendor-vm-bug-url=mumu
--disable-freetype-bundling --disable-zip-debug-info
--with-cacerts-file=/usr/ports/java/openjdk8/files/cacerts
--with-cups=/usr/local --with-debug-level=release --with-freetype=/usr/local
--with-freetype-include=/usr/local/include/freetype2 --with-jobs=20
--with-jvm-variants=server --with-milestone=fcs --with-package-path=/usr/local
--with-zlib=system --enable-unlimited-crypto --disable-debug-symbols
--with-giflib=system --x-includes=/usr/local/include
--x-libraries=/usr/local/lib --x-libraries=/usr/local/lib
--x-includes=/usr/local/include --prefix=/usr/local --localstatedir=/var
--mandir=/usr/local/man --infodir=/usr/local/share/info/
--build=amd64-portbld-freebsd12.3'.

Configuration summary:
* Debug level:    release
* JDK variant:    normal
* JVM variants:   server
* OpenJDK target: OS: bsd, CPU architecture: x86, address length: 64

Tools summary:
* Boot JDK:       openjdk version "1.8.0_144" OpenJDK Runtime Environment
(build 1.8.0_144-b01) OpenJDK 64-Bit Server VM (build 25.144-b01, mixed mode) 
(at /usr/local/bootstrap-openjdk8)
* Toolchain:      clang (clang/LLVM)
* C Compiler:     Version 10.0.1 (at /usr/bin/cc)
* C++ Compiler:   Version 10.0.1 (at /usr/bin/c++)

Build performance summary:
* Cores to use:   20
* Memory limit:   32601 MB

===========================================================================
=======================<phase: build          >============================
===== env: NO_DEPENDS=yes USER=nobody UID=65534 GID=65534
===>  Building for openjdk8-8.342.07.1_1
gmake[1]: Entering directory
'/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u342-b07.1'
(cd /wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u342-b07.1/make &&
/usr/local/bin/gmake 3 VERBOSE="3" LOG_LEVEL="warn" -R -I
/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u342-b07.1/make/common
"SPEC=/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u342-b07.1/build/bsd-x86_64-normal-server-release/spec.gmk"
-j20 -f SourceRevision.gmk create-source-revision-tracker)
gmake[2]: Entering directory
'/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u342-b07.1/make'
gmake[2]: *** No rule to make target '3'.  Stop.
gmake[2]: Leaving directory
'/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u342-b07.1/make'
gmake[1]: ***
[/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u342-b07.1//make/Main.gmk:207:
create-source-revision-tracker] Error 2
gmake[1]: Leaving directory
'/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u342-b07.1'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/java/openjdk8
=>> Cleaning up wrkdir
===>  Cleaning for openjdk8-8.342.07.1_1
build of java/openjdk8 | openjdk8-8.342.07.1_1 ended at Wed Nov  9 23:47:04 CET
2022
build time: 00:00:38
!!! build failure encountered !!!
===============

This failure cannot be reproduced when you are INSIDE of the poudriere jail or
running on any other host. This silently fails for 8, 11, 17, 18:
====================================================
A new configuration has been successfully created in
/usr/ports/java/openjdk11/work/jdk11u-jdk-11.0.16-8-1/build/bsd-x86_64-normal-server-release
using configure arguments '--with-boot-jdk=/usr/local/bootstrap-openjdk11
--disable-ccache --disable-javac-server --disable-hotspot-gtest
--with-jvm-features=shenandoahgc --with-alsa=/usr/local --with-cups=/usr/local
--with-fontconfig=/usr/local --with-freetype=system
--with-freetype-include=/usr/local/include/freetype2
--with-freetype-lib=/usr/local/lib --with-libjpeg=system --with-giflib=system
--with-giflib-include=/usr/local/include --with-giflib-lib=/usr/local/lib
--with-libpng=system --with-zlib=system --with-lcms=system
--x-includes=/usr/local/include --x-libraries=/usr/local/lib
--with-cacerts-file=/usr/ports/java/openjdk11/files/cacerts
--with-version-string=11.0.16+8-1 --with-native-debug-symbols=none
--with-debug-level=release --with-vendor-name='OpenJDK BSD Porting Team'
--with-vendor-url=https://github.com/battleblow/jdk11u/
--with-vendor-bug-url='https://bugs.freebsd.org/bugzilla/enter_bug.cgi?product=Ports/usr/ports/java/openjdk11/work/jdk11u-jdk-11.0.16-8-1/build/.configure-support/generated-configure.sh:
line 73037: printf: `%': invalid format character
==================================================
A new configuration has been successfully created in
/usr/ports/java/openjdk17/work/jdk17u-jdk-17.0.4-8-1/build/bsd-x86_64-server-release
using configure arguments '--with-boot-jdk=/usr/local/bootstrap-openjdk17
--disable-ccache --disable-javac-server --disable-hotspot-gtest
--with-alsa=/usr/local --with-cups=/usr/local --with-fontconfig=/usr/local
--with-freetype=system --with-freetype-include=/usr/local/include/freetype2
--with-freetype-lib=/usr/local/lib --with-libjpeg=system --with-giflib=system
--with-giflib-include=/usr/local/include --with-giflib-lib=/usr/local/lib
--with-harfbuzz=system --with-libpng=system --with-zlib=system
--with-lcms=system --x-includes=/usr/local/include --x-libraries=/usr/local/lib
--with-cacerts-file=/usr/ports/java/openjdk17/files/cacerts
--with-version-string=17.0.4+8-1 --with-native-debug-symbols=none
--with-debug-level=release --with-vendor-name='OpenJDK BSD Porting Team'
--with-vendor-url=https://github.com/battleblow/jdk17u/
--with-vendor-bug-url='https://bugs.freebsd.org/bugzilla/enter_bug.cgi?product=Ports/usr/ports/java/openjdk17/work/jdk17u-jdk-17.0.4-8-1/build/.configure-support/generated-configure.sh:
line 140713: printf: `%': invalid format character
==================================================
but build continues

Failure is:
> /build/.configure-support/generated-configure.sh: line 140713: printf: `%': invalid format character

These failures are caused by incorrect usage of printf. Instead of doing
'printf "%s\n" "$URL"' they do 'printf "$URL\n"'.

Affected files:
8:
common/autoconf/generated-configure.sh
common/autoconf/help.m4
11,17:
./make/autoconf/help.m4
./build/.configure-support/generated-configure.sh

Attached are two patches made with "make makepatch" for OpenJDK 8.

Build then works on host, in jail and with poudriere bulk/testport. Then ran a
simple program in the poudiere jail and all system properties are fine.

-- 
You are receiving this mail because:
You are the assignee for the bug.