Fix regression causing older versions of NotePad++ to crash#13382
Conversation
|
@lukaszgo1 requesting your review as well. |
lukaszgo1
left a comment
There was a problem hiding this comment.
Please clarify the comment with the (8.1.9.2 version. The rest looks okay.
| if self.appModule.is64BitProcess: | ||
| appVerMajor, appVerMinor, *__ = self.appModule.productVersion.split(".") | ||
| if int(appVerMajor) >= 8 and int(appVerMinor) >= 3: | ||
| # appVerMinor could be either one digit (e.g. in 8.3), two digits (e.g. in 8.21), or even three (8.1.9.2) |
There was a problem hiding this comment.
I'm not sure this comment is accurate. In the example in which the version is (8.1.9.2 appVerMinor would be one digit - 1.
There was a problem hiding this comment.
This is incorrect. appVerMinor would be 192.
In any case, your suggestion is way nicer.
There was a problem hiding this comment.
This is incorrect. appVerMinor would be 192.
Sorry for insisting, but I've started doubting that I understand how split works ;) so had to check and it turns out I'm right.
From the Python repl:
C:\Users\Lukasz>py
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> appVer = "8.1.9.2"
>>> appVerMajor, appVerMinor, *__ = appVer.split(".")
>>> appVerMajor
'8'
>>> appVerMinor
'1'
>>> __
['9', '2']
Note that everything after the second dot is unpacked into a temporary __ variable and is not used in the comparisons.
Co-authored-by: Łukasz Golonka <lukasz.golonka@mailbox.org>
| appVerMajor, appVerMinor, *__ = self.appModule.productVersion.split(".") | ||
| if int(appVerMajor) >= 8 and int(appVerMinor) >= 3: | ||
| # appVerMinor could be either one digit (e.g. in 8.3), two digits (e.g. in 8.21), or even three (8.1.9.2) | ||
| appVerMinor = appVerMinor.ljust(3, '0') |
There was a problem hiding this comment.
This is not needed anymore.
|
See test results for failed build of commit 7db6398658 |
lukaszgo1
left a comment
There was a problem hiding this comment.
Please update the PR description to describe the new approach. Thanks for fixing up my mess! LGTM.
I am still confused about the issue here. |
No - the new behavior should apply to versions 8.3 and above only.
Versions of Notepad++ are exposed differently on their web page and in in its UI, and differently when querying NPP binary for the version info programmatically. For example when @LeonarddeR said version 8.1.9.2:
Since the new behavior should apply only to the versions 8.3 and above we're interested in the first digit of the minor version only, as that would cover all versions regardless of how long the minor part is. |
|
I just inspected my It appears that the "File version" is set correctly to "8.1.4.0" whereas the "Product version" is "8.14". Is it simple to get and use the file version instead here? Otherwise, can we add a comment outlining this difference and why we are comparing the leading digit of the integer? |
Those are not the version values that @lukaszgo1 is referring to.
An idiosyncratic system, to be sure, but hopefully this clarifies why the unusual comparison logic is necessary. |
|
Thanks @rdipardo |
That is an interesting thought. While this should not be done for 2022.1 it would be pretty nice to use VS_FIXEDFILEINFO when retrieving file version as that gives us the versions in a reliable format and not as a string which we need to split our selves. |
Link to issue number:
Fixes regression caused by #13364
Closes #13397
Summary of the issue:
The version matching to apply the new NP++ 8.3+ behavior was incorrect, as it doesn't work for versions like 8.2.1 and 8.1.9.2.
Description of how this pull request fixes the issue:
Only match against the first character of the minor version.
Testing strategy:
Tested on version 8.1.9.2, 8.2.1, 8.3 and 8.3.1 of NP++
Known issues with pull request:
None known
Change log entries:
None needed
Code Review Checklist: