[OpenSmalltalk/opensmalltalk-vm] 59d036: Fix access to files with long file names on win32/...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[OpenSmalltalk/opensmalltalk-vm] 59d036: Fix access to files with long file names on win32/...

GitHub
 
  Branch: refs/heads/Cog
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: 59d0365754f86754546641662518135eb0770c04
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/59d0365754f86754546641662518135eb0770c04
  Author: Nicolas Cellier <[hidden email]>
  Date:   2017-10-29 (Sun, 29 Oct 2017)

  Changed paths:
    M platforms/win32/plugins/FilePlugin/sqWin32File.h

  Log Message:
  -----------
  Fix access to files with long file names on win32/win64

Long path were already handled with a prefix '\\?\' thanks to ALLOC_WIN32_PATH macro defined in platforms/win32/plugins/FilePlugin/sqWin32File.h
Unfortunately, when concatenating a file path shorter than MAX_PATH with a file name making the total longer than MAX_PATH,
using the macro REALLOC_WIN32_PATH, there were no '\\?\' prepended, and the file access did fail...

This commit does fix the REALLOC_WIN32_PATH to handle the case when path become longer than limit after growth.


  Commit: b4511352aa319c926e16640e7e8d4bc46cd45331
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/b4511352aa319c926e16640e7e8d4bc46cd45331
  Author: Nicolas Cellier <[hidden email]>
  Date:   2017-10-29 (Sun, 29 Oct 2017)

  Changed paths:
    M platforms/win32/plugins/FilePlugin/sqWin32File.h
    M platforms/win32/vm/sqWin32Directory.c

  Log Message:
  -----------
  Fix the win32 long path name realloc fix:

1) put the 32767 protection into the REALLOC_WIN32_PATH macro
2) correct the size of alloca when we prepend path with \\?\ (alloca is forgiving, but let's not create future hard to find bugs!)
3) correct the offset where we were copying the filename part which did not take 4 prepended char into account


  Commit: f32c8bb4101ce232e3e47d6857d651828fb29a9b
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/f32c8bb4101ce232e3e47d6857d651828fb29a9b
  Author: Nicolas Cellier <[hidden email]>
  Date:   2017-10-30 (Mon, 30 Oct 2017)

  Changed paths:
    M platforms/win32/plugins/FilePlugin/sqWin32File.h
    M platforms/win32/vm/sqWin32Directory.c

  Log Message:
  -----------
  Fix win32 long path name with a simpler solution a la Esteban

Having two macros ALLOC_WIN32_PATH and REALLOC_WIN32_PATH that do almost the same thing smells.
It is a lot simpler to concatenate native utf8 path and file names, then call ALLOC_WIN32_PATH once
like Esteban Lorenzano did propose, rather than doing the work on converted WCHAR win32Path.

Some more details:
The concatenated fullPath does not require a trailing null char because MultiByteToWideChar() invoked by ALLOC_WIN32_PATH cares of it
The lastString cache is now handled in utf8 too, without trailing null either- hence we don't use strcmp()


  Commit: 8781f36beec601e9117add479456f7f167d892d7
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/8781f36beec601e9117add479456f7f167d892d7
  Author: Nicolas Cellier <[hidden email]>
  Date:   2017-10-31 (Tue, 31 Oct 2017)

  Changed paths:
    M platforms/win32/vm/sqWin32Directory.c

  Log Message:
  -----------
  Fix win32 long filename for Pharo too

Fix a forgotten win32PathLength in a PharoVM specific code...


  Commit: 673162cd01b2aff70ac216010a77b340f4209475
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/673162cd01b2aff70ac216010a77b340f4209475
  Author: Nicolas Cellier <[hidden email]>
  Date:   2017-10-31 (Tue, 31 Oct 2017)

  Changed paths:
    M platforms/win32/plugins/FilePlugin/sqWin32File.h
    M platforms/win32/vm/sqWin32Directory.c

  Log Message:
  -----------
  Merge pull request #162 from OpenSmalltalk/FIX_WIN32_LONG_FILENAME

Fix win32 long filename


Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/945819f714fa...673162cd01b2