Project

General

Profile

Bug #11678

Improve FWD support on Windows

Added by Teodor Gorghe 4 months ago. Updated 7 days ago.

Status:
Review
Priority:
Normal
Assignee:
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

hotel_gui_win.patch Magnifier (105 KB) Teodor Gorghe, 08/07/2026 10:16 AM

hotel_win.patch Magnifier (107 KB) Teodor Gorghe, 08/14/2026 02:26 AM

dbash.sh Magnifier (12.2 KB) Constantin Asofiei, 11/16/2026 01:05 PM


Related issues

Related to Runtime Infrastructure - Bug #10609: FWD compilation issues on Windows New
Related to Conversion Tools - Bug #11266: Filename of extension too long in Windows during import New
Related to Runtime Infrastructure - Bug #11515: Patching NCURSES Using Static Linking on Ubuntu 24.04.4 LTS (Noble Numbat) Review

History

#1 Updated by Teodor Gorghe 4 months ago

Currently, FWD compiles without any change, but only with a specific version of mingw gcc version (4.9.0, from 2015), old version of libffi and msys.

The issues are the following:
  • make utility needs to choose which shell to use. Since it was prioritized to use GNU utilities, it will search for sh first and if not found, it will use the shell (cmd.exe). FWD fails to build with sh.exe make because in the make file, files paths are mixed (Z:\trunk/src/native needs to be Z:/trunk/src/native works both on sh.exe and cmd.exe shell).
  • buildadmin task fails on network drives: systemProperty('gwt.watchFileChanges', 'false') needs to added to disable GWT file changes scan.

After I make the changes for FWD to fully build on Windows, I will document the updated steps, which will be: download msys2, install dependencies for FWD using one command (msys2 uses a package manager), no need for adjusting PATH var.

Eugenie told in the about this:

Some considerations. I think we need to consider the case when consumer of the Windows building do not know anything about Linux (and even do not even want to know). So the Windows installation should be completely within Windows style standards.

On Windows, usually, users uses prebuilt binaries. In our case, the zip files generated by ant dist is enough, but our sample project is highly coupled with FWD source code.
Standard way to build apps on Windows is using msvc compiler, which comes bundled in Visual Studio Build Tools, but the project sample is a format generated by VS IDE, called solution (vsproject files).
The alternative is using GNU tools, which we are at right now, and I think it is the best way because we stay independent from IDE build environments.

#2 Updated by Șerban Bursuc 4 months ago

  • Related to Bug #10609: FWD compilation issues on Windows added

#3 Updated by Șerban Bursuc 4 months ago

  • Related to Bug #11266: Filename of extension too long in Windows during import added

#4 Updated by Șerban Bursuc 4 months ago

#11266 is the biggest issue right now - Hotel GUI only compiles if placed in C:\h now. A few months ago it could compile under C:\hotel. At this pace in a short amount of time FWD won't be able to compile at all.

#5 Updated by Eugenie Lyzenko 4 months ago

Teodor Gorghe wrote:

Currently, FWD compiles without any change, but only with a specific version of mingw gcc version (4.9.0, from 2015), old version of libffi and msys.

The recent binaries are also available here: https://www.mingw-w64.org/downloads/, some countries need VPN to access this. I used the revision 15.2.0 installed 6 month ago and FWD is building fine. But on my systems nether *.ps1 work correct. Is there a serious reason we drop using *.CMD and prefer PowerShell?

#6 Updated by Eugenie Lyzenko 4 months ago

I'm still have no running Hotel server on Windows:

26/07/31 14:02:02.568-0700 | WARNING | com.goldencode.p2j.main.ServerDriver | ThreadName:main | The default character set is windows-1252, but currently only UTF-8 is supported.
26/07/31 14:02:02.568-0700 |    INFO | com.goldencode.p2j.main.StandardServer | ThreadName:main | FWD v4.0.0_p2j_trunk_16681 Server starting initialization.
26/07/31 14:02:02.568-0700 |    INFO | com.goldencode.p2j.main.StandardServer | ThreadName:main | ServerDriver: 4 arguments =_   [_      'server.xml',_      'net:connection:secure=true',_      'net:server:secure_port=3333',_      'net:server:insecure_port=3433'_   ]_   Product Version FWD v4.0.0_p2j_trunk_16681_   JVM Version 17.0.18_   JVM Memory: free = 506691016; total = 536870912; max = 8589934592;_   JVM Available CPUs: 8_   JVM Properties =_   {_      java.specification.version = '17',_      sun.cpu.isalist = 'amd64',_      sun.jnu.encoding = 'Cp1252',_      java.class.path = 'c:\opt\hotel_gui\deploy\lib\fwdspi.jar;c:\opt\hotel_gui\deploy\lib\hotel.jar;c:\opt\hotel_gui\deploy\lib\p2j.jar;c:\opt\hotel_gui\deploy\lib\fwdaopltw.jar;',_      java.vm.vendor = 'Oracle Corporation',_      sun.arch.data.model = '64',_      user.variant = '',_      java.vendor.url = 'https://java.oracle.com/',_      user.timezone = 'America/Los_Angeles',_      java.vm.specification.version = '17',_      os.name = 'Windows 10',_      sun.java.launcher = 'SUN_STANDARD',_      user.country = 'US',_      sun.boot.library.path = 'C:\jdk17\bin',_      sun.java.command = 'com.goldencode.p2j.main.ServerDriver server.xml net:connection:secure=true net:server:secure_port=3333 net:server:insecure_port=3433',_      jdk.debug = 'release',_      sun.cpu.endian = 'little',_      user.home = 'C:\Users\evl',_      user.language = 'en',_      java.specification.vendor = 'Oracle Corporation',_      java.version.date = '2026-01-20',_      java.home = 'C:\jdk17',_      file.separator = '\',_      java.vm.compressedOopsMode = 'Zero based',_      line.separator = '__',_      java.vm.specification.vendor = 'Oracle Corporation',_      java.system.class.loader = 'com.goldencode.p2j.classloader.MultiClassLoader',_      java.specification.name = 'Java Platform API Specification',_      user.script = '',_      sun.management.compiler = 'HotSpot 64-Bit Tiered Compilers',_      java.locale.provider = 'SPI,CLDR,COMPAT',_      java.runtime.version = '17.0.18+8-LTS-264',_      user.name = 'evl',_      path.separator = ';',_      os.version = '10.0',_      java.runtime.name = 'Java(TM) SE Runtime Environment',_      file.encoding = 'Cp1252',_      java.vm.name = 'Java HotSpot(TM) 64-Bit Server VM',_      java.vendor.url.bug = 'https://bugreport.java.com/bugreport/',_      java.io.tmpdir = 'C:\Users\evl\AppData\Local\Temp\',_      java.version = '17.0.18',_      user.dir = 'C:\opt\hotel_gui\deploy\server',_      os.arch = 'amd64',_      java.vm.specification.name = 'Java Virtual Machine Specification',_      sun.os.patch.level = '',_      native.encoding = 'Cp1252',_      java.library.path = '../lib/',_      java.vm.info = 'mixed mode, sharing',_      java.vendor = 'Oracle Corporation',_      java.vm.version = '17.0.18+8-LTS-264',_      ANTLR_USE_DIRECT_CLASS_LOADING = 'true',_      java.specification.maintenance.version = '1',_      sun.io.unicode.encoding = 'UnicodeLittle',_      java.class.version = '61.0'_   }_   JVM Environment =_   {_      USERDOMAIN_ROAMINGPROFILE = 'DESKTOP-IQGBAQQ',_      PROCESSOR_LEVEL = '6',_      SESSIONNAME = 'Console',_      ALLUSERSPROFILE = 'C:\ProgramData',_      PROCESSOR_ARCHITECTURE = 'AMD64',_      PSModulePath = 'C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules',_      SystemDrive = 'C:',_      ANT_OPTS = '"-Xmx4g"',_      USERNAME = 'evl',_      ProgramFiles(x86) = 'C:\Program Files (x86)',_      FPS_BROWSER_USER_PROFILE_STRING = 'Default',_      PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',_      DriverData = 'C:\Windows\System32\Drivers\DriverData',_      test = 'n',_      spi = '-Djava.locale.provider=SPI,CLDR,COMPAT -Djava.library.path=../lib/',_      ProgramData = 'C:\ProgramData',_      ProgramW6432 = 'C:\Program Files',_      HOMEPATH = '\Users\evl',_      PROCESSOR_IDENTIFIER = 'Intel64 Family 6 Model 158 Stepping 13, GenuineIntel',_      ProgramFiles = 'C:\Program Files',_      PUBLIC = 'C:\Users\Public',_      usage[15] = '-b      = launch a program associated with a process account',_      windir = 'C:\WINDOWS',_      pwd = 'C:\opt\hotel_gui',_      =:: = '::\',_      fspawn = 'C:\opt\hotel_gui\deploy\spawner',_      LOCALAPPDATA = 'C:\Users\evl\AppData\Local',_      USERDOMAIN = 'DESKTOP-IQGBAQQ',_      FPS_BROWSER_APP_PROFILE_STRING = 'Internet Explorer',_      LOGONSERVER = '\\DESKTOP-IQGBAQQ',_      JAVA_HOME = 'C:\jdk17',_      PROMPT = '$P$G',_      serverCmd = '"java -Xmx8192m -server   @classes.txt -Djava.locale.provider=SPI,CLDR,COMPAT -Djava.library.path=../lib/ -XX:GCTimeRatio=19 -XX:MaxTenuringThreshold=7 -XX:StringTableSize=1000003 --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.naming/javax.naming=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED -Djava.system.class.loader=com.goldencode.p2j.classloader.MultiClassLoader com.goldencode.p2j.main.ServerDriver   server.xml net:connection:secure=true net:server:secure_port=3333 net:server:insecure_port=3433 1>stdout.log 2>server.log"',_      statcode = 'n',_      ANT_HOME = 'C:\ant11015',_      OneDrive = 'C:\Users\evl\OneDrive',_      =C: = 'C:\opt\hotel_gui\deploy\server',_      APPDATA = 'C:\Users\evl\AppData\Roaming',_      open_api = '--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.naming/javax.naming=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED',_      perf = '-XX:GCTimeRatio=19 -XX:MaxTenuringThreshold=7 -XX:StringTableSize=1000003',_      CommonProgramFiles = 'C:\Program Files\Common Files',_      Path = 'C:\jdk17\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\jdk17\bin;C:\jdk17\bin\server;C:\ant11015\bin;C:\Program Files\jEdit;C:\WINDOWS\System32\OpenSSH\;C:\mingw64\bin;C:\Program Files (x86)\Bazaar;C:\Users\evl\AppData\Local\Microsoft\WindowsApps;',_      OS = 'Windows_NT',_      COMPUTERNAME = 'DESKTOP-IQGBAQQ',_      PROCESSOR_REVISION = '9e0d',_      CommonProgramW6432 = 'C:\Program Files\Common Files',_      ComSpec = 'C:\WINDOWS\system32\cmd.exe',_      SystemRoot = 'C:\WINDOWS',_      TEMP = 'C:\Users\evl\AppData\Local\Temp',_      HOMEDRIVE = 'C:',_      USERPROFILE = 'C:\Users\evl',_      TMP = 'C:\Users\evl\AppData\Local\Temp',_      CommonProgramFiles(x86) = 'C:\Program Files (x86)\Common Files',_      NUMBER_OF_PROCESSORS = '8'_   }
26/07/31 14:02:02.568-0700 |    INFO | com.goldencode.p2j.main.StandardServer | ThreadName:main | BootstrapConfig sharedFile = server.xml; privateFile = none; isServer = true; configuraton values =_   {_      NET:ROUTER:THREADS = 2_      NET:CONNECTION:SECURE = true_      NET:SERVER:SECURE_PORT = 3333_      NET:SERVER:INSECURE_PORT = 3433_      SECURITY:SERVER:ID = standard_      DIRECTORY:BACKEND:TYPE = xml_      DIRECTORY:XML:FILENAME = directory.xml_      DIRECTORY:XML:MUST_EXIST = true_   }
26/07/31 14:02:02.568-0700 | WARNING | com.goldencode.p2j.security.SecurityCache | ThreadName:main | No custom server extension defined in P2J directory
26/07/31 14:02:02.568-0700 | WARNING | com.goldencode.p2j.security.SecurityCache | ThreadName:main | No custom client extension defined in P2J directory
26/07/31 14:02:02.568-0700 | WARNING | com.goldencode.p2j.security.SecurityCache | ThreadName:main | Security audit log is disabled
26/07/31 14:02:02.568-0700 |    INFO | com.goldencode.p2j.util.logging.CentralLoggerServer | ThreadName:main, ThreadId:00000003, User:standard | Configs received: com.goldencode.p2j.util.logging.CentralLoggerServer$Configs isServerSide: false, hasConsole: false, filePath: c:/opt/hotel_gui/deploy/logs/fwd_%m_%tY%tm%td_%tH%tM%tS_%uos_%pid_%uf_%g.log, level: INFO, fileLimit: 500000, fileCount: 4. WRITE_TO_SLF4J_API: false
26/07/31 14:02:02.568-0700 |    INFO | com.goldencode.p2j.main.StandardServer | ThreadName:main, ThreadId:00000003, User:standard | No exported entry points defined in the P2J directory
26/07/31 14:02:02.791-0700 |    INFO | com.goldencode.p2j.schema.SchemaConfig | ThreadName:main, ThreadId:00000003, User:standard | Using default schema profile.
26/07/31 14:02:03.662-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 56 ms to scan 1 urls, producing 10 keys and 24 values
26/07/31 14:02:03.717-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 0 ms to scan 1 urls, producing 4 keys and 4 values
26/07/31 14:02:03.736-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 19 ms to scan 1 urls, producing 8 keys and 10 values
26/07/31 14:02:03.756-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 20 ms to scan 1 urls, producing 10 keys and 29 values
26/07/31 14:02:03.903-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 131 ms to scan 1 urls, producing 265 keys and 1302 values
26/07/31 14:02:04.421-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 0 ms to scan 1 urls, producing 14 keys and 29 values
26/07/31 14:02:04.439-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 18 ms to scan 1 urls, producing 6 keys and 17 values
26/07/31 14:02:04.439-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 0 ms to scan 1 urls, producing 16 keys and 60 values
26/07/31 14:02:04.513-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 18 ms to scan 1 urls, producing 37 keys and 186 values
26/07/31 14:02:04.570-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 0 ms to scan 1 urls, producing 2 keys and 26 values
26/07/31 14:02:04.719-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 149 ms to scan 1 urls, producing 473 keys and 2207 values
26/07/31 14:02:05.273-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 110 ms to scan 1 urls, producing 362 keys and 1561 values
26/07/31 14:02:05.589-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 0 ms to scan 1 urls, producing 37 keys and 78 values
26/07/31 14:02:05.626-0700 |    INFO | org.reflections.Reflections | ThreadName:main, ThreadId:00000003, User:standard | Reflections took 19 ms to scan 1 urls, producing 29 keys and 116 values
26/07/31 14:02:05.626-0700 | WARNING | com.goldencode.p2j.convert.MatchPhraseDictionary | ThreadName:main, ThreadId:00000003, User:standard | Could not find match phrase list!
26/07/31 14:02:06.126-0700 | WARNING | com.goldencode.artifacts.ArtifactManager | ThreadName:main, ThreadId:00000003, User:standard | No files found in the file set.
26/07/31 14:02:06.960-0700 |    INFO | com.goldencode.p2j.persist.ConversionPool | ThreadName:main, ThreadId:00000003, User:standard | Runtime conversion pool initialized in 4188 ms.
26/07/31 14:02:06.960-0700 | WARNING | com.goldencode.p2j.scheduler.Scheduler [Scheduler.initialize()] | ThreadName:main, ThreadId:00000003, User:standard | No scheduler configured.
26/07/31 14:02:07.016-0700 |    INFO | com.goldencode.p2j.persist.TemporaryDatabaseManager | ThreadName:main, ThreadId:00000003, User:standard | Using public (shared) temporary database.
26/07/31 14:02:07.016-0700 |    INFO | com.goldencode.p2j.persist.DatabaseManager | ThreadName:main, ThreadId:00000003, User:standard | Using H2 database version 1.4.200 (2019-10-14)
26/07/31 14:02:07.145-0700 |    INFO | com.goldencode.p2j.persist.meta.MetadataManager | ThreadName:main, ThreadId:00000003, User:standard | Metadata server modules: [Myconnection, Connect, Index, DatabaseFeature, Sequence, FieldTrig, Lock, Field, Area, Usertablestat, Tenant, Filelist, FileTrig, Tablestat, File, Trans, IndexField, Startup, Db]
26/07/31 14:02:07.623-0700 |  SEVERE | com.goldencode.p2j.persist.dialect.H2Helper | ThreadName:main, ThreadId:00000003, User:standard | Error setting FWD-specific collation;  please ensure 'fwdspi.jar' is installed in Java extension directory
26/07/31 14:02:07.623-0700 |  SEVERE | com.goldencode.p2j.main.CommonDriver | ThreadName:main, ThreadId:00000003, User:standard | System exits with code -13 caused by:
com.goldencode.p2j.cfg.ConfigurationException: Failed to initialize hook com.goldencode.p2j.main.StandardServer$7
    at com.goldencode.p2j.main.ServerHookManager.hookInitialize(ServerHookManager.java:170)
    at com.goldencode.p2j.main.StandardServer.bootstrap(StandardServer.java:1218)
    at com.goldencode.p2j.main.ServerDriver.start(ServerDriver.java:566)
    at com.goldencode.p2j.main.CommonDriver.process(CommonDriver.java:522)
    at com.goldencode.p2j.main.ServerDriver.process(ServerDriver.java:233)
    at com.goldencode.p2j.main.ServerDriver.main(ServerDriver.java:1062)
Caused by: java.lang.RuntimeException: Error initializing persistence services for database 'hotel'.
    at com.goldencode.p2j.persist.Persistence.initializeTenant(Persistence.java:4279)
    at com.goldencode.p2j.persist.Persistence.<init>(Persistence.java:1034)
    at com.goldencode.p2j.persist.PersistenceFactory.getInstance(PersistenceFactory.java:193)
    at com.goldencode.p2j.persist.meta.LockTableUpdater.<init>(LockTableUpdater.java:198)
    at com.goldencode.p2j.persist.DatabaseManager.initDb(DatabaseManager.java:1902)
    at com.goldencode.p2j.persist.DatabaseManager.initialize(DatabaseManager.java:1730)
    at com.goldencode.p2j.persist.Persistence.initialize(Persistence.java:1088)
    at com.goldencode.p2j.main.StandardServer$7.initialize(StandardServer.java:1481)
    at com.goldencode.p2j.main.ServerHookManager.hookInitialize(ServerHookManager.java:147)
    ... 5 more
Caused by: com.goldencode.p2j.persist.PersistenceException: Error initializing embedded database
Caused by: org.h2.jdbc.JdbcSQLDataException: Invalid value "en_US_iso88591_fwd_basic" for parameter "collation"; SQL statement:
set collation "en_US_iso88591_fwd_basic" [90008-200]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:590)
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:429)
    at org.h2.message.DbException.get(DbException.java:205)
    at org.h2.message.DbException.getInvalidValueException(DbException.java:280)
    at org.h2.command.Parser.parseSetCollation(Parser.java:7427)
    at org.h2.command.Parser.parseSet(Parser.java:7197)
    at org.h2.command.Parser.parsePrepared(Parser.java:989)
    at org.h2.command.Parser.parse(Parser.java:848)
    at org.h2.command.Parser.parse(Parser.java:820)
    at org.h2.command.Parser.prepareCommand(Parser.java:753)
    at org.h2.engine.Session.prepareLocal(Session.java:669)
    at org.h2.engine.Session.prepareCommand(Session.java:606)
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1260)
    at org.h2.jdbc.JdbcStatement.executeUpdateInternal(JdbcStatement.java:164)
    at org.h2.jdbc.JdbcStatement.executeBatch(JdbcStatement.java:768)
    at com.goldencode.p2j.persist.dialect.H2Helper.executeDDL(H2Helper.java:626)
    at com.goldencode.p2j.persist.dialect.H2Helper.prepareDatabase(H2Helper.java:290)
    at com.goldencode.p2j.persist.Persistence.initializeTenant(Persistence.java:4263)
    at com.goldencode.p2j.persist.Persistence.<init>(Persistence.java:1034)
    at com.goldencode.p2j.persist.PersistenceFactory.getInstance(PersistenceFactory.java:193)
    at com.goldencode.p2j.persist.meta.LockTableUpdater.<init>(LockTableUpdater.java:198)
    at com.goldencode.p2j.persist.DatabaseManager.initDb(DatabaseManager.java:1902)
    at com.goldencode.p2j.persist.DatabaseManager.initialize(DatabaseManager.java:1730)
    at com.goldencode.p2j.persist.Persistence.initialize(Persistence.java:1088)
    at com.goldencode.p2j.main.StandardServer$7.initialize(StandardServer.java:1481)
    at com.goldencode.p2j.main.ServerHookManager.hookInitialize(ServerHookManager.java:147)
    at com.goldencode.p2j.main.StandardServer.bootstrap(StandardServer.java:1218)
    at com.goldencode.p2j.main.ServerDriver.start(ServerDriver.java:566)
    at com.goldencode.p2j.main.CommonDriver.process(CommonDriver.java:522)
    at com.goldencode.p2j.main.ServerDriver.process(ServerDriver.java:233)
    at com.goldencode.p2j.main.ServerDriver.main(ServerDriver.java:1062)

This is Windows 10 in VirtualBox. Note exotic line.separator value in log file. It is neither \r\n not \n.

#7 Updated by Eugenie Lyzenko 4 months ago

Small update. The server is starting with explicit command:

java -XX:+HeapDumpOnOutOfMemoryError -XX:GCTimeRatio=19 -XX:MaxTenuringThreshold=7 -XX:StringTableSize=1000003  -Xmx8192m -server    -Djava.locale.providers=SPI,CLDR,COMPAT --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.naming/javax.naming=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED -classpath ../lib/p2j.jar;../lib/hotel.jar;../lib/fwdspi.jar;../lib/fwdaopltw.jar com.goldencode.p2j.main.FwdLauncher   server.xml net:connection:secure=true net:server:secure_port=3333 net:server:insecure_port=3433

While the Swing client does not work:

...
26/07/31 16:17:04.987-0700 |   FINER | com.goldencode.p2j.net.SessionManager [SessionManager.createQueue()] | PID:2584, ThreadName:main-evl | host = localhost; port = 3333; secure = true;
26/07/31 16:17:05.110-0700 |  SEVERE | com.goldencode.p2j.main.ClientCore | PID:2584, ThreadName:main-evl | The client stopped working throwing an unexpected exception:
java.net.SocketException: Socket is closed
    at java.base/sun.security.ssl.SSLSocketImpl.getOutputStream(SSLSocketImpl.java:1234)
    at com.goldencode.p2j.net.NetSocketWrapper.<init>(NetSocketWrapper.java:132)
    at com.goldencode.p2j.net.NetSocket$1.create(NetSocket.java:120)
    at com.goldencode.p2j.net.SessionManager.connect(SessionManager.java:1345)
    at com.goldencode.p2j.net.SessionManager.createQueue(SessionManager.java:1206)
    at com.goldencode.p2j.net.LeafSessionManager.connectDirect(LeafSessionManager.java:256)
    at com.goldencode.p2j.net.SessionManager.connectDirect(SessionManager.java:713)
    at com.goldencode.p2j.main.ClientCore.initialize(ClientCore.java:329)
    at com.goldencode.p2j.main.ClientCore.start(ClientCore.java:550)
    at com.goldencode.p2j.main.ClientDriver.start(ClientDriver.java:293)
    at com.goldencode.p2j.main.CommonDriver.process(CommonDriver.java:522)
    at com.goldencode.p2j.main.ClientDriver.process(ClientDriver.java:175)
    at com.goldencode.p2j.main.ClientDriver.main(ClientDriver.java:381)
26/07/31 16:17:05.111-0700 |  SEVERE | com.goldencode.p2j.main.CommonDriver | PID:2584, ThreadName:main-evl | System exits with code -13 caused by:
java.lang.NullPointerException: Cannot invoke "com.goldencode.p2j.main.MainEntry.standardEntry(String)" because "is.main" is null
    at com.goldencode.p2j.main.ClientCore.start(ClientCore.java:553)
    at com.goldencode.p2j.main.ClientDriver.start(ClientDriver.java:293)
    at com.goldencode.p2j.main.CommonDriver.process(CommonDriver.java:522)
    at com.goldencode.p2j.main.ClientDriver.process(ClientDriver.java:175)
    at com.goldencode.p2j.main.ClientDriver.main(ClientDriver.java:381)

#8 Updated by Teodor Gorghe 4 months ago

I have started doing some small fixes.

Currently, the changes are not being committed, because I have a small thing which needs to be addressed, regarding automatic resolution of jvm.dll dependency.

On newer JDK (17+), that jvm.dll comes from JAVA_HOME\bin\server. In our build script, we use JAVA_HOME\lib\server, which is the path for linux based system. We use dynamic linking spawn.exe, which is required to add a PATH var entry to find this jvm.dll. I am trying to add this automatically in ClientSpawner or find a more elegant solution to that.

I have some fixes for the Windows scripts in the hotel_gui project, which I will commit soon.

#9 Updated by Teodor Gorghe 4 months ago

Eugenie Lyzenko wrote:

Small update. The server is starting with explicit command:

[...]

While the Swing client does not work:

[...]

I think the missing -Djava.library.path=../lib might be the culprit here.

#10 Updated by Eugenie Lyzenko 4 months ago

Teodor Gorghe wrote:

I have started doing some small fixes.

Currently, the changes are not being committed, because I have a small thing which needs to be addressed, regarding automatic resolution of jvm.dll dependency.

On newer JDK (17+), that jvm.dll comes from JAVA_HOME\bin\server. In our build script, we use JAVA_HOME\lib\server, which is the path for linux based system. We use dynamic linking spawn.exe, which is required to add a PATH var entry to find this jvm.dll. I am trying to add this automatically in ClientSpawner or find a more elegant solution to that.

I have some fixes for the Windows scripts in the hotel_gui project, which I will commit soon.

Note for Windows we instruct to directly put jvm.dll on the Windows system path while set up JDK for Windows OS.

#11 Updated by Teodor Gorghe 4 months ago

Attaching the hotel_gui_win.patch which is needed since most of the Windows scripts are not working.

Also, committed the changes for FWD to work better on Windows, on 11678/r16694.

#12 Updated by Teodor Gorghe 3 months ago

  • % Done changed from 0 to 100
  • reviewer Eugenie Lyzenko added

Eugenie, please review the changes in the 11678a/r16694 and the ones for hotel_gui, attached in #11678-11.
It improves FWD compilation on Windows and also makes the setup easy for hotel_gui, like on linux equivalent. It shouldn't break your environment.

#13 Updated by Teodor Gorghe 3 months ago

  • Status changed from New to WIP

#14 Updated by Teodor Gorghe 3 months ago

  • Assignee set to Teodor Gorghe
  • Status changed from WIP to Review

#15 Updated by Eugenie Lyzenko 3 months ago

Teodor Gorghe wrote:

Eugenie, please review the changes in the 11678a/r16694 and the ones for hotel_gui, attached in #11678-11.
It improves FWD compilation on Windows and also makes the setup easy for hotel_gui, like on linux equivalent. It shouldn't break your environment.

What about 11678a revision 16695? Also need to be reviewed?

#16 Updated by Teodor Gorghe 3 months ago

Yes, 11678a/r16695 needs to be reviewed.

#17 Updated by Eugenie Lyzenko 3 months ago

Teodor Gorghe wrote:

Yes, 11678a/r16695 needs to be reviewed.

What Windows version do you use to test this build?

#18 Updated by Teodor Gorghe 3 months ago

A Windows 10 VM.

#19 Updated by Eugenie Lyzenko 3 months ago

Teodor Gorghe wrote:

A Windows 10 VM.

OK. In general I think the changes are reasonable. But I want to start using Hotel GUI on Windows before I can tell everything is OK.

And here I have issues. The 11678a/r16695 can not be built with gradlew all --info:

...
make -f C:/opt/11678a_16695/src/native/makefile.spawn
make[1]: Entering directory 'C:/opt/11678a_16695/build/native'
"Checking FWD gcc environment at start of: C:/opt/11678a_16695/src/native/makefile.spawn" 
"Initial CFLAGS: -DFWD_VERSION="\"4.0.0_p2j_11678a_16695\"" -IC:/jdk17/include -IC:/jdk17/include/win32 -IC:/opt/11678a_16695/src/native -Wall -fpic" 
"Initial JVM_LIBPATH: C:/jdk17/lib" 
rm -f ../../build/native/spawn.exe
process_begin: CreateProcess(NULL, rm -f ../../build/native/spawn.exe, ...) failed.
make (e=2): The system cannot find the file specified.
make[1]: [C:/opt/11678a_16695/src/native/makefile.spawn:309: clean] Error 2 (ignored)
gcc -DFWD_VERSION="\"4.0.0_p2j_11678a_16695\"" -IC:/jdk17/include -IC:/jdk17/include/win32 -IC:/opt/11678a_16695/src/native -Wall -fpic -g -Wall -s -LC:/jdk17/lib -DNDEBUG -D_UNICODE  -m64 -IC:/jdk17/include -IC:/jdk17/include/win32 -IC:/opt/11678a_16695/src/native C:/opt/11678a_16695/src/native/winspawn.c -o ../../build/native/spawn.exe -m64
make[1]: Leaving directory 'C:/opt/11678a_16695/build/native'
make -f C:/opt/11678a_16695/src/native/makefile.win_utils
make[1]: Entering directory 'C:/opt/11678a_16695/build/native'
"Checking FWD gcc environment at start of: C:/opt/11678a_16695/src/native/makefile.win_utils" 
"Initial CFLAGS: -DFWD_VERSION="\"4.0.0_p2j_11678a_16695\"" -IC:/jdk17/include -IC:/jdk17/include/win32 -IC:/opt/11678a_16695/src/native -Wall -fpic" 
"Initial JVM_LIBPATH: C:/jdk17/lib" 
rm -f ../../build/native/get_text_metrics.exe
process_begin: CreateProcess(NULL, rm -f ../../build/native/get_text_metrics.exe, ...) failed.
make (e=2): The system cannot find the file specified.
make[1]: *** [C:/opt/11678a_16695/src/native/makefile.win_utils:194: clean] Error 2
make[1]: Leaving directory 'C:/opt/11678a_16695/build/native'
make: *** [makefile:312: win_utils] Error 2
...

So the Window version is still not working for now.

#20 Updated by Teodor Gorghe 3 months ago

  • Status changed from Review to WIP
  • % Done changed from 100 to 90

As the logs tell, there is no rm or cp in your machine, which tells to me that having POSIX shell, doesn't guarantee that these utilities are installed in the system. Your system uses a make binary which uses a GNU shell by default, without having these two binaries.

I think the best way is to revert this section to trunk, using the cmd.exe /c del /q for delete and cmd.exe /c copy /B /V ... /B for copy. Quoting these paths makes them shell agnostic.

I will tell when it is done for review.

#21 Updated by Teodor Gorghe 3 months ago

  • Status changed from WIP to Review
  • % Done changed from 90 to 100

Done in 11678a/r16696.

#22 Updated by Eugenie Lyzenko 3 months ago

Teodor Gorghe wrote:

Done in 11678a/r16696.

OK.

I think for the cases we can use regular Windows tools or utilities that are part of the OS we need to prefer this way. To simplify the system setup process.

#23 Updated by Roger Borrello 3 months ago

Teodor, there is a update to tools/docker/docker_build.sh that will include server in /opt/fwd-deploy. Can I add it to 11678a? It does need to lay on top of trunk_16699, so a rebase would need to be done.

#24 Updated by Eugenie Lyzenko 3 months ago

Teodor Gorghe wrote:

Eugenie, please review the changes in the 11678a/r16694 and the ones for hotel_gui, attached in #11678-11.

How can I apply this patch to the Hotel GUI? Is it the patch to be used on Ubuntu, right?

I tried (patch -p < hotel_gui_win.patch) for recent Hotel GUI(revision 474) running inside root of the application but most of the files are not updating. Can you please make an archive with only modified but just patched versions, to just apply on top of the Hotel GUI?

And BTW the revision 16696 is now building fine on Windows.

#25 Updated by Teodor Gorghe 3 months ago

Roger, I will rebase the branch to contain these changes.

For hotel_gui, I have just patched it the host (using patch -p1 -i hotel_win.patch). You have a copy of it into an internal server.

#26 Updated by Roger Borrello 3 months ago

Teodor Gorghe wrote:

Roger, I will rebase the branch to contain these changes.

Let me know when this is done... I want to add my updates. Last I checked it was still revision 16696.

#27 Updated by Roger Borrello 3 months ago

Roger Borrello wrote:

Teodor Gorghe wrote:

Roger, I will rebase the branch to contain these changes.

Let me know when this is done... I want to add my updates. Last I checked it was still revision 16696.

I will do this and report back on any conflicts I cannot resolve.

#28 Updated by Roger Borrello 3 months ago

Branch was rebased to trunk_16702 and is now at revision 16704.

#29 Updated by Roger Borrello 3 months ago

Roger Borrello wrote:

Teodor, there is a update to tools/docker/docker_build.sh that will include server in /opt/fwd-deploy. Can I add it to 11678a? It does need to lay on top of trunk_16699, so a rebase would need to be done.

Committed to revision 16705.

Added server dist to Docker images where appropriate. Also, build images without PG when PG requested so as to have a complete set.

#30 Updated by Teodor Gorghe 3 months ago

Committed revision 16707 on task branch 11678a:
  • Fixed version mismatches between FWD convert and server and added fwdspi to server libs.

This was done due to #11673-67.

#31 Updated by Eugenie Lyzenko 3 months ago

Teodor,

The Hotel GUI from devsrv01 still has config issue:

C:\opt\hotel_gui>prepare_hotel.cmd
Enter your application name (only letters or digits, first character a letter): hotel
Enter your project name (can be different from the application) (only letters or digits, first character a letter): [hotel] hotel_gui
Edit the regex which matches all your include files (enter for default): [*.[fhi]] *.[fhi]
Edit the regex which matches all your program files (enter for default): [(*.[pPwW]|*.cls|*.htm|*html)] *.[pPwW]
Edit the root package name - Java format (enter for default): [com.goldencode.hotel] com.goldencode.hotel
Enter the PROPATH from your progress.ini file used for the application build (enter for default): [.:] .:common:
Enter the PROPATH from your progress.ini file used for the application runtime (enter for default): [.:] .;common;
Enter the ADM version: [ADM2.2] ADM2.2
Enter the legacy database name(s), separated by a comma (default DB first): hotel
Enter the database import file for "hotel": [hotel] hotel
Enter the database type of "hotel" (h2 or postgres): [h2] h2
Edit the DB host name for your imported database "hotel": [localhost] localhost
Edit the H2 database path for your imported database "hotel": [../db/] ../db
Enter the SQL admin for your imported database "hotel": [fwd_admin] fwd_admin
Enter the SQL admin password for your imported database "hotel": [admin] admin
Enter the SQL user for your imported database "hotel": [fwd_user] fwd_user
Enter the SQL user password for your imported database "hotel": [user] user
Enter the collation scheme for your imported database "hotel": [en_US@iso88591_fwd_basic] en_US@iso88591_fwd_basic
Enter the C3P0 Max Pool Size for your imported database "hotel": [20] 20
Does your ABL application currently run on the Windows OS (answer yes/no): [no] no
Enter the date format from your progress.ini (enter for default): [mdy] mdy
Enter the number group separator from your progress.ini (enter for default): [,] ,
Enter the number decimal separator from your progress.ini (enter for default): [.] .
Enter the procedure name containing the entry point for your application: start.p
Enter the hostname for the embedded web server: [localhost] localhost
Enter the port to use for web client access: [7443] 7443
Enter the directory filename, including path (relative to the server.xml file location.) (enter for default): [directory.xml] directory.xml
Do you want a sample AppCDS setup (answer yes/no): [no] yes
Wrote prepare_template.json
...
The argument 'C:\opt\hotel_gui\json_template.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
...
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

#32 Updated by Teodor Gorghe 3 months ago

Forgot to include json_template.ps1 and json_template.cmd in the patch.
Updated patch.

#33 Updated by Constantin Asofiei 3 months ago

  • reviewer Constantin Asofiei added

#34 Updated by Roger Borrello 2 months ago

Teodor, what is the state of the 11678a branch? My docker_build.sh needs to merge to trunk.

#35 Updated by Teodor Gorghe 2 months ago

Needs to be reviewed.

#36 Updated by Roger Borrello 2 months ago

Teodor Gorghe wrote:

Needs to be reviewed.

OK. I was going to rebase with the latest trunk, but there is conflict in build.gradle.

#37 Updated by Teodor Gorghe 2 months ago

I am rebasing it right now.

#38 Updated by Teodor Gorghe 2 months ago

Ok. I have rebased 11678a to trunk revision 16765. Latest revision is now 16772.

#39 Updated by Roger Borrello about 2 months ago

Teodor Gorghe wrote:

Ok. I have rebased 11678a to trunk revision 16765. Latest revision is now 16772.

No review yet?

#40 Updated by Constantin Asofiei about 2 months ago

I'm OK with the changes. Eugenie - please look at the windows native code changes.

#41 Updated by Eugenie Lyzenko about 2 months ago

Constantin Asofiei wrote:

I'm OK with the changes. Eugenie - please look at the windows native code changes.

OK. I have two questions:

1. In winspawn.c function LoadJvm()

...
BOOL LoadJvm()
{
...
   // jvm.dll imports VCRUNTIME140[_1].dll, which the JDK ships in bin and not in bin\server. Those
   // are usually installed in the system directory too, this covers a machine where they are not.
   wcscpy(szBin, szJvm);
   _PathRemoveFileSpecW(szBin);
   _PathRemoveFileSpecW(szBin); <--------- EVL
   SetDllDirectoryW(szBin);

..

The exactly same call is doubled. Is there a reason? One call is not enough?

2. The changes in Windows makefiles. Are you tested the building on native Windows system?

Beside these two notes I'm OK with rest of changes.

#42 Updated by Teodor Gorghe about 2 months ago

Eugenie Lyzenko wrote:

OK. I have two questions:

1. In winspawn.c function LoadJvm()

[...]

The exactly same call is doubled. Is there a reason? One call is not enough?

Check Windows documentation for PathRemoveFileSpecW:

Example how it works (pseudocode):

szJvm = 'C:\Program Files\Java\jdk-17\bin\java.exe'; // which has been obtained using SearchPathW.
// First call of PathRemoveFileSpecW
PathRemoveFileSpecW(szJvm);
// szJvm becomes 'C:\Program Files\Java\jdk-17\bin'

So, the example showed how the first part of LoadJvm works.

Then, the server\jvm.dll is being appended (because jvm.dll is located at C:\Program Files\Java\jdk-17\bin\server\jvm.dll:

// szJvm is C:\Program Files\Java\jdk-17\bin
PathAppendW(szJvm, 'server\jvm.dll');
// szJvm now is C:\Program Files\Java\jdk-17\bin\server\jvm.dll

So, that is the path for the jvm.dll, and we keep that path saved in szJvm. We initialize a new "string" variable called szBin and we copy the contents from szJvm. We go back to previous path (before appending server\jvm.dll):

wcscpy(szBin, szJvm); // copy szJvm char[] to szBin (value being 'C:\Program Files\Java\jdk-17\bin\server\jvm.dll').
PathRemoveFileSpecW(szBin); // szBin <- 'C:\Program Files\Java\jdk-17\bin\server'
PathRemoveFileSpecW(szBin); // szBin <- 'C:\Program Files\Java\jdk-17\bin'

The next step for that is to add C:\Program Files\Java\jdk-17\bin path to the DLL search path because jvm.dll depends from VCRUNTIME140.dll.

SetDllDirectoryW(szBin); // 'VCRUNTIME140.dll' is located at 'C:\Program Files\Java\jdk-17\bin', add 'C:\Program Files\Java\jdk-17\bin' to dll search path.

Then, I think it is obvious, loads the jvm.dll and then links the _JNI_CreateJavaVM to the actual JNI_CreateJavaVM function.

This change was done because I have completely remove the need for Windows JVM static link when building the spawn executable.

Eugenie Lyzenko wrote:

2. The changes in Windows makefiles. Are you tested the building on native Windows system?

Yes, they were being tested both in the old setup environment, which you may already use, and the new one, which I have designed, and it should simplify a lot the setup of FWD on Windows.
As I have told earlier, when you have tested this branch, it shouldn't require additional configuration steps for existing Windows setups.

I have used a Windows 10 VM.

#43 Updated by Teodor Gorghe about 2 months ago

Another reason why this was introduced, alongside with the ClientBuilder change, was to remove the requirement to have the jvm.dll in the Windows PATH variable, for runtime.

#44 Updated by Eugenie Lyzenko about 2 months ago

Teodor Gorghe wrote:

Example how it works (pseudocode):
[...]
So, the example showed how the first part of LoadJvm works.

Then, the server\jvm.dll is being appended (because jvm.dll is located at C:\Program Files\Java\jdk-17\bin\server\jvm.dll:
[...]

So, that is the path for the jvm.dll, and we keep that path saved in szJvm. We initialize a new "string" variable called szBin and we copy the contents from szJvm. We go back to previous path (before appending server\jvm.dll):
[...]

The next step for that is to add C:\Program Files\Java\jdk-17\bin path to the DLL search path because jvm.dll depends from VCRUNTIME140.dll.
[...]

Then, I think it is obvious, loads the jvm.dll and then links the _JNI_CreateJavaVM to the actual JNI_CreateJavaVM function.

This change was done because I have completely remove the need for Windows JVM static link when building the spawn executable.

OK. I was confused by the API name: PathRemoveFileSpecW because the server is a directory name in this case. Why not to use substring with \ char search?

At least I think additional comment in C code is necessary to explain this logic to simplify the further code maintain.

#45 Updated by Teodor Gorghe about 2 months ago

Eugenie Lyzenko wrote:

OK. I was confused by the API name: PathRemoveFileSpecW because the server is a directory name in this case. Why not to use substring with \ char search?

At least I think additional comment in C code is necessary to explain this logic to simplify the further code maintain.

I would prefer to use the Windows API because it is way easier to maintain and you know, on C, String.substring('\\') is not just 1 line of code.
Done in revision 16773.

#46 Updated by Greg Shah about 2 months ago

Our guidance in general would be this:

  • If possible, use CRT calls and put things in common code.
  • If because of the structure of the code (or other similar reason), it doesn't make sense to move something to common code, we still would prefer CRT calls all other things being equal.
  • If there is some strong reason platform-specific code is better or if it is absolutely required, then it is OK to use platform specific (e.g. Windows API) calls.

Also: we really DO NOT want C++ nonsense used in our native code. Use the CRT for this kind of thing.

The reason for the bias here is that the CRT is portable and is better understood by developers than the average Windows API call. Thus it gives us more options and the code reads better.

I'm not going to put a hard requirement on the CRT for this usage, but the fact that we are having this discussion means that the 2 back-to-back calls are confusing. The reader really needs to think about why this code may be correct and it totally depends on the system-level paths that come from the JDK install. That is fragile (it could break easily with different JDKs) and confusing.

SO: at a minimum, please put comments around this code to explain why it is called twice.

#47 Updated by Teodor Gorghe about 2 months ago

Greg Shah wrote:

I'm not going to put a hard requirement on the CRT for this usage, but the fact that we are having this discussion means that the 2 back-to-back calls are confusing. The reader really needs to think about why this code may be correct and it totally depends on the system-level paths that come from the JDK install. That is fragile (it could break easily with different JDKs) and confusing.

SO: at a minimum, please put comments around this code to explain why it is called twice.

Ok, I understand.

The main reason why I have used the PathRemoveFileSpecW is because I want to avoid bugs on C, which are a bit tricky to analyze (for example, double backslash case, etc).
I will port that by hand, there is no C runtime equivalent for that.

The comments are already there, I have added them in the last revision.

About JVM install path, it uses system's path to search for java.exe (the ClientBuilder enforces the java version for the used JDK for FWD server, from JAVA_HOME).

Prior 11678a, there was a bug in the makefiles, where the path for jvm.dll was wrong. I have checked on latest OpenJDK Windows variants (17, 21, 25) and the location for the dll is on server\bin, not in server\lib.

#48 Updated by Roger Borrello about 2 months ago

Teodor, when you have a chance, can you rebase 11678a? There are some conflicts in build.gradle that I might make a mess of.

#49 Updated by Teodor Gorghe about 2 months ago

Rebased 11678a to trunk revision 16794.

Committed revision 16803 on task branch 11678a:
  • Removed PathRemoveFileSpecW usage from winspawn.exe.
  • Made the resolution of jvm.dll configurable, from spawn.ini. The precedence is now the following: config, *java.exe* from @JAVA_HOME, PATH variable).

#50 Updated by Teodor Gorghe about 2 months ago

I had the hotel_gui UI version and I have noticed bugs related with resource path.

Back to WIP because I see lots of HTML-BROWSER widget issues, which I am fixing it right now.

#51 Updated by Teodor Gorghe about 2 months ago

Committed revision 16804 on task branch 11678a:
  • Fix for HTML-BROWSER widget to work on Windows.

#52 Updated by Roger Borrello 21 days ago

  • Related to Bug #11515: Patching NCURSES Using Static Linking on Ubuntu 24.04.4 LTS (Noble Numbat) added

#53 Updated by Roger Borrello 21 days ago

Teodor, I've commit tools/script/setup_ncurses6x.sh as branch 11678a revision 16806.

Can you rebase the branch, and make sure the % done is accurate? It sounded like you had a few more things going.

#54 Updated by Teodor Gorghe 20 days ago

I have rebased 11678a, which is now based on trunk revision 16826. Last commit is at revision 16836.

#55 Updated by Teodor Gorghe 20 days ago

Roger Borrello wrote:

Teodor, I've commit tools/script/setup_ncurses6x.sh as branch 11678a revision 16806.

Can you rebase the branch, and make sure the % done is accurate? It sounded like you had a few more things going.

It is done, it needed to have the HTML-BROWSER fixed, so for at least, hotel_gui to work.

#56 Updated by Greg Shah 9 days ago

Constantin/Eugenie: Is any further review needed?

#57 Updated by Eugenie Lyzenko 9 days ago

Greg Shah wrote:

Constantin/Eugenie: Is any further review needed?

I will re-check from scratch and review with Claude to answer this question. My current local 11678a is outdated.

#58 Updated by Eugenie Lyzenko 9 days ago

Code review for 11678a revision 16845. At least it makes sense to check them, and fix ones related to *.java and *.c code:

  • [MAJOR] security postbuild.ps1 (spawn.ini install branch) / winspawn.c.LoadJvm: An existing spawn.ini in the destination is kept unchanged (only owner/ACL reset); its new [JVM] path= key is checked only for being absolute and existing, then loaded by LoadLibraryExW in launchP2JClient (mode 0) under the privileged spawner account. Trigger: the script requires SpawnDir to pre-exist; a folder an admin creates under C:\ inherits Authenticated Users:(OI)(CI)(IO)(M), so a local user can plant spawn.ini with [JVM] path=C:\Users\x\evil.dll before install; the script prints "already installed, kept as it is" and the DLL is loaded on the next web login. Same root cause: pre-existing files are never removed, so a planted SpawnDir\java.exe + SpawnDir\server\jvm.dll is picked up by SearchPathW (app folder searched first) when [JVM] path is unset. Both the key and the installer are new in this branch. Validate/reject a pre-existing spawn.ini (at least its [JVM] path) and remove or flag foreign content in SpawnDir.
  • [MAJOR] security postbuild.ps1.Set-SpawnerAcl: The icacls sequence (/setowner Administrators, /inheritance:r /remove Users, /grant:r for named accounts) never removes explicit ACEs of other principals. Trigger: a non-admin who could write SpawnDir pre-creates spawn.exe/p2j.jar/aspectjrt.jar/slf4j-api.jar/srv-certs.store/spawn.ini with an explicit <attacker>:(F) ACE; Copy-Item -Force overwrites contents but keeps the DACL (files are never deleted first), and the ACE survives hardening, so the attacker can later replace binaries run by the privileged spawner. The script's own comment ("anyone able to create a file in the destination beforehand stays in control") names this threat but only the owner half is fixed; postbuild.sh (chown + chmod) has no such gap. Rebuild the DACL from scratch (SetAccessRuleProtection($true,$false) + intended rules only) or delete targets before copying.
  • [MAJOR] functional HtmlBrowserWidget.setResourceBase: A Windows path containing a space (e.g. C:\Program Files\app) or a literal % (e.g. C:\a%b) is rewritten to /C:/Program Files/app and passed to the single-arg new URI(javaValue), which throws ("Illegal character in path" / "Malformed escape pair") before the getScheme() == null fallback new URI("file", null, javaValue, null, null) — which would quote correctly — is reached; the user gets "The supplied value is not a valid resource path.". Not a regression (trunk rejected spaces too), but the change misses the most common Windows case it targets (Program Files / user-profile paths). Verified with a standalone Java test.
  • [MINOR] functional HtmlBrowserWidget.setResourceBase: A UNC path \\server\share\dir is now converted to //server/share/dir; URI parsing takes server as authority and only uri.getPath() = /share/dir is stored, so WebHtmlBrowser silently serves local resources from \share\dir on the current drive. On trunk the backslash form failed visibly with "not a valid resource path"; the forward-slash form already lost the authority silently on trunk, so this extends an existing flaw. Reject inputs with uri.getAuthority() != null or preserve the authority.
  • [MINOR] security postbuild.ps1.Set-SpawnerAcl: icacls failures only print "WARNING!" (native commands are not covered by $ErrorActionPreference='Stop') and the script never checks elevation (no #Requires -RunAsAdministrator / IsInRole). Trigger: a non-elevated user runs it into a user-owned SpawnDir (e.g. C:\fwd\spawn): /setowner fails with a warning, the other steps and all copies succeed, exit status 0, and spawn.exe/jars/spawn.ini (encryption keys) remain owned by the non-admin, who keeps implicit WRITE_DAC. Check elevation up front unless -SkipAcl and fail on icacls errors.
  • [MINOR] functional winspawn.c.LoadJvm: Default Oracle JDK 17/21 installers put C:\Program Files\Common Files\Oracle\Java\javapath (symlinks to java.exe) on the system PATH; SearchPathW(NULL, L"java.exe", ...) returns the unresolved link, so the derived javapath\server\jvm.dll does not exist, the jvm.dll-on-PATH fallback also fails (nothing consults JAVA_HOME, the server passes PATH through unchanged), and mode 0 exits -110 unless [JVM] path= is set. Not a regression (trunk required jvm.dll on PATH), but the new lookup misses the most common Oracle layout. Resolve with GetFinalPathNameByHandleW before deriving bin\server\jvm.dll.
  • [MINOR] functional winspawn.c.LoadJvm: With [JVM] path=<jdk>\bin\server\jvm.dll set (the documented remedy), <jdk>\bin not on the PATH inherited via CreateEnvironmentBlock, and no VC++ redistributable in System32, LoadLibraryExW(szJvm, NULL, LOAD_WITH_ALTERED_SEARCH_PATH) cannot resolve VCRUNTIME140.dll (shipped in <jdk>\bin by Oracle/Temurin/Microsoft/Zulu JDKs; MinGW-built spawn.exe loads no VC runtime itself), so mode 0 exits -110. The code comment even names this cause. Preload <jvm dir>\..\vcruntime140.dll (and vcruntime140_1.dll) or AddDllDirectory the parent, as the JDK's LoadMSVCRT() does.
  • [MINOR] functional build.gradle.archiveSpawner: The spawner zip never contains spawn.ini (nativeCompile copies only the makefile to build/native, makefile.spawn emits only spawn.exe, and no build file references spawn.ini), while postbuild.ps1 looks for it only in $PSScriptRoot or next to $SpawnProg. Every first install from fwd_deploy-spawner_*.zip prints "WARNING! ... spawn.ini was not found." and installs no template for [Encryption] / [JVM] path (runtime defaults are equivalent). Add spawn.ini to the from('src/native') includes.
  • [MINOR] functional docker_build.sh (context setup rsync): The --delete added in rev 16844 to rsync -av --delete "${zip_files[]}" "${contextdir}/${target_path}/dist" is a no-op because the sources are individual files (reproduced in a scratch dir). Nothing else cleans @context/p2j/dist, so zips from earlier runs are copied into every image's COPY ${FWD_DIR}/ layer (bloat only — deploy_fwd.sh selects the zip by version). Use rsync -a --delete --include='*.zip' --exclude='*' "${dist}/" ".../dist/" or empty the directory first.
  • [MINOR] functional postbuild.ps1 (header / param block): The header documents a 5th positional argument <path-to slf4j-impl.jar> (-Slf4jImpl) that is declared but never read (not needed: the spawner classpath uses only slf4j-api), and Show-Usage does not list it, so header and usage disagree. The header and the comment near the FWD-lib handling also reference install_spawner.ps1 / install_spawner.sh, which do not exist in the tree. Mark the argument as ignored or drop it, and remove the stale caller references.
  • [MINOR] style HtmlBrowserWidget header: The -#- -I- --Date-- history ruler line was widened; it must be left untouched.
  • [MINOR] style WebHtmlBrowser header: The -#- -I- --Date-- history ruler line was widened; it must be left untouched.
  • [MINOR] style makefile.launcher header: History ruler line dashes were lengthened; it must be left untouched.
  • [MINOR] style makefile.spawn header: History ruler line was changed; it must be left untouched.
  • [MINOR] style WebHtmlBrowser.openUrl: In the resPath ternary, ? and : start the continuation lines; they must end the preceding line (c.resourceBase == null ? / pwd :).
  • [MINOR] style winspawn.c.init / LoadJvm / ReadKey: Pointer declarations WCHAR *pName, WCHAR *pFile, unsigned char *key attach the asterisk to the name; the style puts it on the type (WCHAR* pName), as the existing fpCreateJavaVM* lines do.
  • [MINOR] style winspawn.c (globals): HINSTANCE hDllShlwapi = NULL, hDllUserenv = NULL, hDllJvm = NULL; extends a combined declaration; declare hDllJvm separately.
  • [MINOR] style winspawn.c.init / LoadJvm: Unrelated whitespace-only edits (trailing spaces removed from the "MUST be stored in the same folder..." comment and the "Key length" fwprintf line) touch lines not otherwise changed.
  • [MINOR] style winspawn.c.LoadJvm: The if (nPath == 0 || ... continuation lines are padded with extra spaces before the trailing ||, giving irregular operator alignment.
  • [MINOR] style docker_build.sh / setup_ncurses6x.sh: Added lines exceed 110 columns — the dev "all" and fwdpgrt_image_name docker_build_image calls (132/135 chars) and the setup_ncurses6x.sh usage line for -f (164 chars).
  • [MINOR] style docker_build.sh: Comment typo "Set DEPLOY_TYPE t0o server" — should be "to".

#59 Updated by Teodor Gorghe 7 days ago

Thanks Eugenie!

Some of them are real, and some are really minor that it doesn't matter. I'll commit the change soon.

Roger, please take an eye on these:
  • [MINOR] functional docker_build.sh (context setup rsync): The --delete added in rev 16844 to rsync -av --delete "${zip_files[@]}" "${contextdir}/${target_path}/dist" is a no-op because the sources are individual files (reproduced in a scratch dir). Nothing else cleans context/p2j/dist, so zips from earlier runs are copied into every image's COPY ${FWD_DIR}/ layer (bloat only — deploy_fwd.sh selects the zip by version). Use rsync -a --delete --include='*.zip' --exclude='*' "${dist}/" ".../dist/" or empty the directory first.
  • [MINOR] style docker_build.sh / setup_ncurses6x.sh: Added lines exceed 110 columns — the dev "all" and fwdpgrt_image_name docker_build_image calls (132/135 chars) and the setup_ncurses6x.sh usage line for -f (164 chars).
  • [MINOR] style docker_build.sh: Comment typo "Set DEPLOY_TYPE t0o server" — should be "to".

#61 Updated by Roger Borrello 7 days ago

Teodor Gorghe wrote:

Thanks Eugenie!

Some of them are real, and some are really minor that it doesn't matter. I'll commit the change soon.

Roger, please take an eye on these:
  • [MINOR] functional docker_build.sh (context setup rsync): The --delete added in rev 16844 to rsync -av --delete "${zip_files[@]}" "${contextdir}/${target_path}/dist" is a no-op because the sources are individual files (reproduced in a scratch dir). Nothing else cleans context/p2j/dist, so zips from earlier runs are copied into every image's COPY ${FWD_DIR}/ layer (bloat only — deploy_fwd.sh selects the zip by version). Use rsync -a --delete --include='*.zip' --exclude='*' "${dist}/" ".../dist/" or empty the directory first.
  • [MINOR] style docker_build.sh / setup_ncurses6x.sh: Added lines exceed 110 columns — the dev "all" and fwdpgrt_image_name docker_build_image calls (132/135 chars) and the setup_ncurses6x.sh usage line for -f (164 chars).
  • [MINOR] style docker_build.sh: Comment typo "Set DEPLOY_TYPE t0o server" — should be "to".

These are all committed in revisions 16865 and 16866. I also rebased to the latest trunk. Please take a look at build.gradle to make sure I resolved the conflicts in the header correctly.

#62 Updated by Constantin Asofiei 7 days ago

The changes from dbash.sh attached here need to be integrated.

#63 Updated by Roger Borrello 7 days ago

Constantin Asofiei wrote:

The changes from dbash.sh attached here need to be integrated.

Close... I utilized the current version from the container and gcd_systems projects, which just had the location of the new switch --name in a little different location.

Committed in revision 16868. The branch was rebased to trunk 16853.

#64 Updated by Roger Borrello 7 days ago

Branch 11678a was rebased to trunk 16854 and is at revision 16869.

Also available in: Atom PDF