While running the test for makestring.rex sample I found it failing on Win 10. I looked closer and it seems the SysTempFileName() function behaves differently in 5.0.0 than in 4.2.
Whereas in 5.0.0 a complete path to a temp file is returned in 4.2 only a file name was returned. See below.
Either SysTempFileName() need to be reverted to the earlier behaviour on Win for backwards compatibility or a remark will have to be made in the documentation that the behaviour changed. In that case also the sample makestring needs a correction.
For macOS the behaviour seems to be the same as before. Could not test on Ubuntu yet.
Trace output from makestring.rex
WIN10 ooRexx 5.0.0 64bit
229 - use strict arg template
>>> "tst_input.???"
231 - fileName = SysTempFileName(template)
>>> "C:\Users\po\tst_input.900"
232 - parse upper source os .
>K> "SOURCE" => "WindowsNT FUNCTION C:\Users\po\makestring2.REX"
>>> "WINDOWSNT FUNCTION C:\USERS\PO\MAKESTRING2.REX"
>>> "WINDOWSNT"
235 - select
236 - when os~abbrev(WIN)
>>> "1"
236 - then
236 - do
237 - tempDir = value("TEMP", , "ENVIRONMENT")
>>> "C:\Users\po\AppData\Local\Temp"
238 - if tempDir == ""
>>> "0"
239 - if tempDir == ""
>>> "0"
241 - if tempDir~right(1) \== '\'
>>> "1"
241 - then
241 - tempDir = tempDir'\'
>>> "C:\Users\po\AppData\Local\Temp\"
242 - fileName = tempDir || fileName
>>> "C:\Users\po\AppData\Local\Temp\C:\Users\po\tst_input.900"
243 - end
248 - return fileName
>>> "C:\Users\po\AppData\Local\Temp\C:\Users\po\tst_input.900"
Win10 ooRexx 4.2 64bit
229 - use strict arg template
>>> "tst_input.???"
231 - fileName = SysTempFileName(template)
>>> "tst_input.242"
232 - parse upper source os .
>>> "WINDOWSNT FUNCTION C:\PROGRAM FILES\OOREXX\SAMPLES\MAKESTRING2.REX"
>>> "WINDOWSNT"
235 - select
236 - when os~abbrev(WIN)
>>> "1"
236 - then
236 - do
237 - tempDir = value("TEMP", , "ENVIRONMENT")
>>> "C:\Users\po\AppData\Local\Temp"
238 - if tempDir == ""
>>> "0"
239 - if tempDir == ""
>>> "0"
241 - if tempDir~right(1) \== '\'
>>> "1"
241 - then
241 - tempDir = tempDir'\'
>>> "C:\Users\po\AppData\Local\Temp\"
242 - fileName = tempDir || fileName
>>> "C:\Users\po\AppData\Local\Temp\tst_input.242"
243 - end
248 - return fileName
>>> "C:\Users\po\AppData\Local\Temp\tst_input.242"
MacOS
in getTempFileName
229 - use strict arg template
>>> "tst_input.???"
231 - fileName = SysTempFileName(template)
>>> "/var/tmp/tst_input.758YweQeO"
232 - parse upper source os .
>K> "SOURCE" => "DARWIN FUNCTION /Users/po/makestring2.REX"
>>> "DARWIN FUNCTION /USERS/PO/MAKESTRING2.REX"
>>> "DARWIN"
235 - select
236 - when os~abbrev(WIN)
>>> "0"
244 - otherwise
245 - nop
246 - end
248 - return fileName
>>> "/var/tmp/tst_input.758YweQeO"
Anonymous
Ok fine with me, indeed the new behaviour is better but still needs a remark in the documentation since it will break existing code, like makestring.rex.
I will amend makestring.rex with this in mind.
Hälsningar/Regards/Grüsse,
P. O. Jonsson
Von meinem iPhone gesendet
Related
Bugs:
#1607This was an intentional change so that the functions would function the same on both platform. For the purposes of generating a temporary file name, it sort of defeats the purpose of the function to return a name without the full path since the generated name is supposed to come with a guarantee that no file with that name exists.