https://bugs.winehq.org/show_bug.cgi?id=56464
Bug ID: 56464 Summary: vbscript: Join on array with "empty" items fails Product: Wine Version: 9.4 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: vbscript Assignee: wine-bugs@winehq.org Reporter: francisdb@gmail.com Distribution: ---
cat test.vbs
Dim u Dim arr, arr1 'first item not empty arr = array("test", u) WScript.Echo "Join arr = " & Join(arr,"") 'first item is empty arr1 = array(u, "test") WScript.Echo "Join arr1 = " & Join(arr1,"")
Wine
wine wscript test.vbs
0114:fixme:vbscript:Global_Join 0114:fixme:wscript:ActiveScriptSite_OnScriptError ()
Windows
cscript test.vbs
Microsoft (R) Windows Script Host Version 5.812 Copyright (C) Microsoft Corporation. All rights reserved.
Join arr = test Join arr1 = test
On a vpinball where wine vbscript is embedded we get a segfault: free(): double free detected in tcache 2
https://bugs.winehq.org/show_bug.cgi?id=56464
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|vbscript: Join on array |vbscript: Join() builtin is |with "empty" items fails |not implemented Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- This is not specific to empty variants, Join() is not implemented at all.
https://bugs.winehq.org/show_bug.cgi?id=56464
--- Comment #2 from francisdb francisdb@gmail.com --- Sorry about the confusion.
Looks like vpinball implements the join. If the join not being implemented is on purpose I guess this can be closed?
https://bugs.winehq.org/show_bug.cgi?id=56464
--- Comment #3 from francisdb francisdb@gmail.com --- In case somebody wants to implement this
https://github.com/vpinball/vpinball/blob/9cd01e63b6271b2cc59a180a7335093b2c...
But keep in mind that this fails when the first item is empty. (will be fixed on a later commit at the vpinball side)
https://bugs.winehq.org/show_bug.cgi?id=56464
--- Comment #4 from Nikolay Sivov bunglehead@gmail.com --- (In reply to francisdb from comment #2)
Sorry about the confusion.
Looks like vpinball implements the join. If the join not being implemented is on purpose I guess this can be closed?
It's not on purpose, no. We'll need it implemented, with some tests.
https://bugs.winehq.org/show_bug.cgi?id=56464
Jason Millard jsm174@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jsm174@gmail.com
--- Comment #5 from Jason Millard jsm174@gmail.com --- (In reply to francisdb from comment #3)
In case somebody wants to implement this
https://github.com/vpinball/vpinball/blob/ 9cd01e63b6271b2cc59a180a7335093b2cfde200/standalone/inc/wine/dlls/vbscript/ global.c#L2887-L2989
But keep in mind that this fails when the first item is empty. (will be fixed on a later commit at the vpinball side)
In vpinball's implementation of GlobalJoin, we were forgetting to NULL out the conv_str in the loop.
This is fixed now. I'm sure if this was implemented in Wine, it would be done the right way. I took bits and pieces from all the other global string functions to hopefully make the code similar.
https://bugs.winehq.org/show_bug.cgi?id=56464
--- Comment #6 from francisdb francisdb@gmail.com --- This is with the fix
https://github.com/vpinball/vpinball/blob/5b459c5c0fa0b50b0b5f475781b05b0cbc...
https://bugs.winehq.org/show_bug.cgi?id=56464
Vijay Kamuju infyquest@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |infyquest@gmail.com
--- Comment #7 from Vijay Kamuju infyquest@gmail.com --- its not implemented, please create a MR.
https://bugs.winehq.org/show_bug.cgi?id=56464
--- Comment #8 from francisdb francisdb@gmail.com --- https://gitlab.winehq.org/wine/wine/-/merge_requests/7052