Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,17 @@ jobs:
--baseDN dc=example,dc=com --sampleData 5000 --cli --acceptLicense --no-prompt \
--propertiesFilePath /tmp/opendj-setup.properties.bcfks --doNotStart

# start-ds sweeps the native libraries the BC FIPS loader leaves in tmp/ and nothing
# else: the rest of tmp/ belongs to tools that may still be running, setup among them
# (issue #1030). Without these two probes a sweep back to "tmp/*" passes every cell.
mkdir -p opendj-server-legacy/target/package/opendj/tmp/bc-fips-jni_123
touch opendj-server-legacy/target/package/opendj/tmp/keep.me

opendj-server-legacy/target/package/opendj/bin/start-ds

test ! -e opendj-server-legacy/target/package/opendj/tmp/bc-fips-jni_123
test -e opendj-server-legacy/target/package/opendj/tmp/keep.me

opendj-server-legacy/target/package/opendj/bin/status --hostname localhost --bindDN "cn=Directory Manager" --bindPassword password --trustAll
opendj-server-legacy/target/package/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "dc=example,dc=com" --searchScope base "(objectClass=*)" 1.1
opendj-server-legacy/target/package/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "ou=people,dc=example,dc=com" --searchScope sub "(uid=user.*)" dn | grep ^dn: | wc -l | grep -q 5000
Expand Down Expand Up @@ -397,7 +406,14 @@ jobs:
opendj-server-legacy\target\package\opendj\upgrade.bat
opendj-server-legacy\target\package\opendj\bat\import-ldif.bat --offline --ldifFile test.ldif --backendID=example2
opendj-server-legacy\target\package\opendj\bat\rebuild-index.bat --offline --bindDN "cn=Directory Manager" --bindPassword password --baseDN "dc=example2,dc=com" --rebuildAll
# The same probe as the Unix FIPS step, for start-ds.bat: the sweep takes the BC FIPS
# directories and leaves everything else in tmp\ alone (issue #1030). The runner's
# install path has no space in it, so this does not settle the quoting of the for /D line.
New-Item -ItemType Directory -Force opendj-server-legacy\target\package\opendj\tmp\bc-fips-jni_123 | Out-Null
New-Item -ItemType File -Force opendj-server-legacy\target\package\opendj\tmp\keep.me | Out-Null
opendj-server-legacy\target\package\opendj\bat\start-ds.bat
if (Test-Path opendj-server-legacy\target\package\opendj\tmp\bc-fips-jni_123) { throw "start-ds.bat left a bc-fips-jni_* directory behind" }
if (-not (Test-Path opendj-server-legacy\target\package\opendj\tmp\keep.me)) { throw "start-ds.bat removed a tmp file that is not its own" }
opendj-server-legacy\target\package\opendj\bat\rebuild-index.bat --bindDN "cn=Directory Manager" --bindPassword password --baseDN "dc=example2,dc=com" --rebuildAll --trustAll
opendj-server-legacy\target\package\opendj\bat\ldapsearch.bat --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "dc=example2,dc=com" --searchScope sub "(uid=user.*)" dn | find /c '"dn:"' | findstr "10000"
opendj-server-legacy\target\package\opendj\bat\stop-ds.bat
Expand All @@ -412,6 +428,19 @@ jobs:
if ($LASTEXITCODE -ne 0) { throw "net stop 'OpenDJ Server' failed with exit code $LASTEXITCODE" }
opendj-server-legacy\target\package\opendj\bat\windows-service.bat --disableService

# A test step that fails leaves its instances behind. The server-side story of a
# failed start lives in logs/server.out and logs/errors, and nothing else prints it
# (setup only has the client-side view, see issue #1030).
- name: Dump the server logs of a failed test
if: failure()
shell: bash
run: |
for f in opendj-server-legacy/target/package/opendj*/logs/server.out opendj-server-legacy/target/package/opendj*/logs/errors; do
[ -f "$f" ] || continue
echo "===== $f"
cat "$f"
done

- name: Upload artifacts OpenDJ Server
uses: actions/upload-artifact@v7
with:
Expand Down
12 changes: 9 additions & 3 deletions opendj-server-legacy/resource/bin/start-ds
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
# Copyright 2006-2009 Sun Microsystems, Inc.
# Portions Copyright 2011-2014 ForgeRock AS.
# Portions Copyright 2025 3A Systems LLC.
# Portions Copyright 2025-2026 3A Systems LLC.


# Capture the current working directory so that we can change to it later.
Expand Down Expand Up @@ -73,10 +73,16 @@ PID_FILE=${INSTANCE_ROOT}/logs/server.pid
LOG_FILE=${INSTANCE_ROOT}/logs/server.out
STARTING_FILE=${INSTANCE_ROOT}/logs/server.starting

# Cleanup the tmp directory
# Remove the native libraries the BC FIPS loader extracts into the tmp directory
# on every start, so that they do not pile up. Nothing else in there is ours to
# remove: the tmp directory is java.io.tmpdir for every tool, and a tool may
# still be running - setup starts the server through this script and keeps its
# own log open (issue #1030). The logs a failed dsreplication or status run
# leaves there (opendj-replication-*.log, opendj-status-*.log) are the
# operator's to read and to remove; starting the server no longer takes them.
OPENDJ_TMP_DIR="${INSTANCE_ROOT}/tmp"
if [ -d "${OPENDJ_TMP_DIR}" ]; then
rm -rf ${OPENDJ_TMP_DIR}/*
rm -rf "${OPENDJ_TMP_DIR}"/bc-fips-jni_*
fi

# See if the provided set of arguments were sufficient for us to be able to
Expand Down
20 changes: 11 additions & 9 deletions opendj-server-legacy/resource/bin/start-ds.bat
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,18 @@ echo %SCRIPT%: CLASSPATH=%CLASSPATH% >> %LOG%

echo %SCRIPT%: PATH=%PATH% >> %LOG%

rem cleanup the tmp directory
set CUR_DIR=%CD%
rem Remove the native libraries the BC FIPS loader extracts into the tmp
rem directory on every start, so that they do not pile up. Nothing else in
rem there is ours to remove: the tmp directory is java.io.tmpdir for every
rem tool, and a tool may still be running - setup starts the server through
rem this script and keeps its own log open (issue #1030). The logs a failed
rem dsreplication or status run leaves there (opendj-replication-*.log,
rem opendj-status-*.log) are the operator's to read and to remove; starting
rem the server no longer takes them.
set OPENDJ_TMP_DIR=%INSTANCE_ROOT%\tmp
rem The paths must be quoted: an unquoted parenthesis (e.g. from
rem "C:\Program Files (x86)") terminates the ( ) block at parse time.
dir /b /s /a "%OPENDJ_TMP_DIR%" | findstr .>nul && (
cd /d "%OPENDJ_TMP_DIR%"
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q>NUL 2>&1 || del "%%i" /s/q>NUL 2>&1)
cd /d "%CUR_DIR%"
)
rem %%~i drops the quotes cmd would hand back if it ever kept them: an install path with a
rem space would otherwise split the rmdir argument, and the redirect would hide it.
for /D %%i in ("%OPENDJ_TMP_DIR%\bc-fips-jni_*") do rmdir "%%~i" /s/q>NUL 2>&1

"%OPENDJ_JAVA_BIN%" -client %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configFile "%INSTANCE_ROOT%\config\config.ldif" --checkStartability %*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* Copyright 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2016 ForgeRock AS.
* Portions Copyright 2026 3A Systems, LLC.
*/
package org.opends.guitools.uninstaller;

Expand Down Expand Up @@ -129,8 +130,8 @@ protected void initializeParser()
@Override
protected void guiLaunchFailed() {
System.err.println(
tempLogFile.isEnabled() ? ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS.get(tempLogFile.getPath())
: ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED.get());
hasTempLogFile() ? ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS.get(getTempLogFile().getPath())
: ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED.get());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,11 @@ private void putSummary(UninstallProgressStep status, Arg0 msg)
/** Actually performs the uninstall in this thread. The thread is blocked. */
@Override
public void run() {
// The uninstall begins here, as the install begins in Installer.run(): the errors below go
// to the error logger, and only the log file puts a publisher on it. Without it a failed
// uninstall in the wizard leaves no record anywhere (issue #1030). The command line
// uninstaller is given no supplier - its launcher has created the log already.
openTempLogFile();
status = STARTED;
logger.info(LocalizableMessage.raw("run of the Uninstaller started"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;

import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
Expand Down Expand Up @@ -76,9 +77,17 @@ public abstract class Application implements ProgressNotifier, Runnable {
private final ErrorPrintStream err = new ErrorPrintStream();
private final OutputPrintStream out = new OutputPrintStream();

/** Temporary log file where messages will be logged. */
/**
* Temporary log file where messages will be logged, once {@link #openTempLogFile()} has
* asked for it. It stays {@code null} until then: creating it costs a file - and the
* directory it lives in - that nothing removes unless the operation succeeds, so the roads
* which attempt nothing must not create one (issue #1030).
*/
protected TempLogFile tempLogFile;

/** Supplies the temporary log file, see {@link #openTempLogFile()}. */
private Supplier<TempLogFile> tempLogFileSupplier;

/**
* Creates an application by instantiating the Application class
* denoted by the System property
Expand Down Expand Up @@ -685,14 +694,44 @@ protected void applicationPrintStreamReceived(String message)
}

/**
* Sets the temporary log file where messages will be logged.
* Sets where the temporary log file of this application comes from, without creating it.
* <p>
* The wizard and the CLI hand the supplier over as they start: the file itself is created by
* {@link #openTempLogFile()}, on the road that runs the operation, so that a run which does
* nothing - a quit at any step of the wizard, a server which turns out to be installed
* already - leaves no log behind (issue #1030).
* <p>
* There is deliberately no setter taking the file itself: a caller holding a supplier could
* then resolve it on the spot, and the log would be created before anything is attempted
* again.
*
* @param tempLogFile
* temporary log file where messages will be logged.
* supplies the temporary log file where messages will be logged.
*/
public void setTempLogFile(final TempLogFile tempLogFile)
public void setTempLogFile(final Supplier<TempLogFile> tempLogFile)
{
this.tempLogFile = tempLogFile;
this.tempLogFile = null;
this.tempLogFileSupplier = tempLogFile;
}

/**
* Creates the temporary log file of this application, unless it has one already.
* <p>
* Called where the operation begins and not before: from that point on the log is worth
* keeping, because there is something which can fail and be reported.
* <p>
* An application nobody handed a supplier to has no log of its own: the command line
* uninstaller is built that way, and its launcher creates the log before running it.
*
* @return the temporary log file of this application, or {@code null} if it was given none.
*/
protected TempLogFile openTempLogFile()
{
if (tempLogFile == null && tempLogFileSupplier != null)
{
tempLogFile = tempLogFileSupplier.get();
}
return tempLogFile;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public final class Installation
/** The relative path where the database files are. */
private static final String DATABASES_PATH_RELATIVE = "db";
/** The relative path where the log files are. */
private static final String LOGS_PATH_RELATIVE = "logs";
public static final String LOGS_PATH_RELATIVE = "logs";
/** The relative path where the LDIF files are. */
private static final String LDIFS_PATH_RELATIVE = "ldif";
/** The relative path where the backup files are. */
Expand Down
Loading
Loading