Menu

#1607 SysTempFileName behaves differently on Win in 5.0.0 than in 4.2

None
wont-fix
nobody
None
none
1
2019-03-11
2019-03-09
No

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"

Related

Bugs: #1607

Discussion

  • Rick McGuire

    Rick McGuire - 2019-03-11
    • status: open --> wont-fix
    • Group: 5.0.0 --> None
     
    • Per Olov Jonsson

      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

      Am 11.03.2019 um 17:07 schrieb Rick McGuire bigrixx@users.sourceforge.net:

      status: open --> wont-fix
      Group: 5.0.0 --> None
      Comment:
      This 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.

      [bugs:#1607] SysTempFileName behaves differently on Win in 5.0.0 than in 4.2

      Status: wont-fix
      Group: None
      Created: Sat Mar 09, 2019 09:45 AM UTC by Per Olov Jonsson
      Last Updated: Sat Mar 09, 2019 09:45 AM UTC
      Owner: nobody

      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"

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/bugs/1607/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #1607

  • Rick McGuire

    Rick McGuire - 2019-03-11

    This 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.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB