Notepad++ File Status Auto-Detection not working
-
this is the last working one
Language menu and Style configurator sorted alphabetically and use the same language name in the Style configurator as the language menu.
https://ci.appveyor.com/project/donho/notepad-plus-plus/build/1.0.1526
this is the first which breaks it
Switch to VS 2015
https://ci.appveyor.com/project/donho/notepad-plus-plus/build/1.0.1530
There were no build from 1.0.1527 to 1.0.1529 due to errors.
Cheers
Claudia -
But https://ci.appveyor.com/project/donho/notepad-plus-plus/build/1.0.1526 is a Pull request #3726 build, so not a direct successor of Switch to VS 2015 (https://ci.appveyor.com/project/donho/notepad-plus-plus/build/1.0.1530)
That would be https://ci.appveyor.com/project/donho/notepad-plus-plus/build/1.0.1521,
with
https://ci.appveyor.com/project/donho/notepad-plus-plus/build/1.0.1527
https://ci.appveyor.com/project/donho/notepad-plus-plus/build/1.0.1528failing.
-
sorry, but I don’t get your point.
I would assume that a build with a lower build number is never a successor of a build
with a higher build number.And what is your concern about the results I’ve posted?
Cheers
Claudia -
@Claudia-Frank The builds at appveyor not just contain the trunk checkins, but also pull requests which might contain something totally different. Sorry, I meant predecessor.
I created a branch from the 7.5.1 tag and modified the appveyor config to build VS2013 vs. VS2015 on the appveyor image 2015. So this should reveal if already the switch to VS2015 is causing the trouble.
See https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.114, build from https://github.com/chcg/notepad-plus-plus/commits/winxp_autodectection_investigation2
Since the checkin of the json parser(https://github.com/notepad-plus-plus/notepad-plus-plus/commit/b033d907b29f42f570c21b0bfc0ac60c257f08c4) it is no longer possible to build with VS2013 due to the lack of c++11/14 features needed.
-
-
binary with PlatformToolset=v120_xp works
but binary with …=v140_xp does not.
Hmmm, I see the binaries are different in size
but I assume you just changed the toolset version
and the rest was kept the same, wasn’t it.I already searched the web, and there are some reports that there are problems
on windows xp when using VS2015 onwards but it looks like all of them were solved
by setting the compatibility flag aka toolset. Strange.Cheers
Claudia -
To be fully compatible with Windows XP, the following compiler’s option may need to be specified:
/Zc:threadSafeInit-
This one relates to the “magic static” feature in C++ that depends on new TLS implementation available only from Windows Vista/7.
In case of Notepad++ plugin (i.e. a DLL file) the absence of this compiler’s option leads to crash (under Windows XP) while trying to use a static variable. In theory it should not have the same dramatic effect in an executable, but who knows? I think it’s worth trying to comile Notepad++ with this option specified. -
thank you very much for the hint.
If you wouldn’t mind to build one with this flag I would give it a try to see if it resolves the issue.
Cheers
Claudia -
There were 3 changes in the appveyor config:
-
VM image, as Visual Studio 2013 doesn’t contain vs2015
-
calling Microsoft Visual Studio 14.0\VC\vcvarsall.bat for vs2015 build
-
using notepadPlus.vs2015.vcxproj for building the vs2015 version.
-
couldn’t be avoided. The sourcecode itself is identical and either it is something with the vcxproj for vs2015 which causes the issue or the vcvarsall.bat + the toolset.
Maybe the build of scintilla could also have an influence.
I will do a rebuild with just the toolset changed and using the notepadPlus.vcxproj also for VS2015.
And another one with /Zc:threadSafeInit-
-
-
First test is available here:
https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.117VS2013 config with PlatformToolset=v140_xp
-
-
VS2015 build with /Zc:threadSafeInit- at https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.118
-
-
-
Looks like time to use additional logging then. I mean, logging around file status detection. (I briefly looked at the code, and it’s not obvious at the first glance what exactly can go wrong.)
-
I’ve found out the cause of the problem. In VS2015, the stupids from Microsoft have broken _wstat for Windows XP! According to a simple change inside the file “PowerEditor\src\ScitillaComponent\Buffer.cpp”:
int st = generic_stat(_fullPathName.c_str(), &buf); char s[512]; sprintf(s, "Buffer::checkFileState() -> %d, errno %d, FileName \"%S\"", st, errno, _fullPathName.c_str()); writeLog(_T("1.txt"), s);
one can notice that _wstat always returns -1 under Windows XP with errno 22 (EINVAL).
So the fix seems to be to replace _wstat with some native WinAPI function, since we can not rely on VS2015’s CRT anymore. -
See https://github.com/joncampbell123/dosbox-x/issues/403 and https://github.com/joncampbell123/dosbox-x/issues/438 which also suffers from this issue. From https://stackoverflow.com/questions/6566978/whats-the-difference-between-struct-stat64-and-struct-stati64-on-win32, maybe we are facing a 64bit issue, see https://msdn.microsoft.com/en-US/library/14h5k7ff.aspx. What happens on using _wstat64.
-
Yes, it could be that _USE_32BIT_TIME_T needs to be defined for Windows XP. On the other hand, it was reported that defining _USE_32BIT_TIME_T, in its turn, creates problems with std::chrono… Just madness.
-
Basically,
_wstat
is used there just to get the file modification time and check if it is read-only or not. There are 2 corresponding WinAPI functions that can be used instead, without being relying on_wstat
at all:GetFileTime
andGetFileAttributes
. Using them, any further breaking change in_wstat
will not affect Notepad++ at all! -
As far as I understand, an honour to implement the proposed change is mine :) As Notepad++ is the base for all its plugins, I consider such task as quite important. I don’t promise I do it quickly, but I already have an idea what exactly to do. Since _wstat is already called through a macro, the most straightforward change will be to call own function instead of _wstat via the very same macro, providing own structure returned by the function, and the structure will be filled by the WinAPI functions. So the code will remain similar at the surface, but will not rely on _wstat anymore.