Jump to content

C++ proposition


Jief_Machak
 Share

823 posts in this topic

Recommended Posts

4 hours ago, Jief_Machak said:

I understand. So the best, I think, it's for GetBest to return a XImage, and not a XImage*. That will generate a copy in case of a PNG icon but we won't notice a performance difference.

Who will delete it?

Link to comment
Share on other sites

A static memory bound variable is deleted when it leaves scope. So anything that is not a pointer or reference to a dynamic memory bound variable will be deleted automatically always. The object pointed to by a pointer or reference will be deleted if it is static memory bound as well but the pointer and reference will now be in an unspecified state, they are certainly not pointing to valid memory. This is why you should never return the address of a local variable because it will be gone by the time the caller gets the address.

Link to comment
Share on other sites

As a way to remember, if you didn't allocate it with new, you don't delete it.

So if GetBest return an XImage, the caller will do something like

XImage img = theme.GetBest(...)

No explicit allocation involved. Without optimization, the object create for the return value of GetBest will be deleted after the line. img will be destroyed at the end of the { } block if it's a local var ; or, if img is a member of another object, when that object is destroyed.

That is the interest of it : it cannot be forgotten to be deleted ! :thumbsup_anim:

 

 

Link to comment
Share on other sites

Windows compilation is not working

c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(360): error C3861: getCharPtr: 䨪
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(363): error C2668: length_of_utf_string:  맮 ॣ㦥 㭪樨
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(253): note:   "size_t length_of_utf_string(const wchar_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(252): note:        "size_t length_of_utf_string(const char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(251): note:        "size_t length_of_utf_string(const char16_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(250): note:        "size_t length_of_utf_string(const char *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(363): note:  ⪥ ᮯ⠢ ᯨ᮪ 㬥⮢ "(unknown-type)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(379): error C2672: "XStringAbstract__ncompare":   ᮮ⢥ ॣ㦥 㭪
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(379): error C2784: int XStringAbstract__ncompare(const S *,const O *,size_t,bool):  㤠  뢥 㬥 蠡  "const S *"  "unknown-type"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\XStringAbstract.h(112): note:  .  "XStringAbstract__ncompare"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(381): error C2668: get_char32_from_string:  맮 ॣ㦥 㭪樨
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(234): note:   "const wchar_t *get_char32_from_string(const wchar_t *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(233): note:        "const char32_t *get_char32_from_string(const char32_t *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(232): note:        "const char16_t *get_char32_from_string(const char16_t *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(231): note:        "const char *get_char32_from_string(const char *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(381): note:  ⪥ ᮯ⠢ ᯨ᮪ 㬥⮢ "(unknown-type, char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(388): error C2672: "XStringAbstract__ncompare":   ᮮ⢥ ॣ㦥 㭪
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(388): error C2784: int XStringAbstract__ncompare(const S *,const O *,size_t,bool):  㤠  뢥 㬥 蠡  "const S *"  "unknown-type"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\XStringAbstract.h(112): note:  .  "XStringAbstract__ncompare"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(390): error C2668: get_char32_from_string:  맮 ॣ㦥 㭪樨
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(234): note:   "const wchar_t *get_char32_from_string(const wchar_t *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(233): note:        "const char32_t *get_char32_from_string(const char32_t *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(232): note:        "const char16_t *get_char32_from_string(const char16_t *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(231): note:        "const char *get_char32_from_string(const char *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(390): note:  ⪥ ᮯ⠢ ᯨ᮪ 㬥⮢ "(unknown-type, char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(394): error C2672: "XStringAbstract<char,XString8>::strncpy":   ᮮ⢥ ॣ㦥 㭪
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(394): error C2784: void XStringAbstract<char,XString8>::strncpy(const O *,size_t):  㤠  뢥 㬥 蠡  "const O *"  "unknown-type"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\XStringAbstract.h(813): note:  .  "XStringAbstract<char,XString8>::strncpy"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(399): error C2668: get_char32_from_string:  맮 ॣ㦥 㭪樨
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(234): note:   "const wchar_t *get_char32_from_string(const wchar_t *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(233): note:        "const char32_t *get_char32_from_string(const char32_t *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(232): note:        "const char16_t *get_char32_from_string(const char16_t *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(231): note:        "const char *get_char32_from_string(const char *,char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(399): note:  ⪥ ᮯ⠢ ᯨ᮪ 㬥⮢ "(unknown-type, char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(359): error C2027: ᯮ짮 । ⨯ "_xstringarray__char_type<Type1,void>"

 

Link to comment
Share on other sites

Oh, I just thought of something, file encoding of the source alters the representation of how a string can be represented especially with MSVC because it's s h i t choices for dependence for the character types. If the files are in UTF-8 but do not have a byte order mark, MSVC will assume that it is in your current locale (which I'm assuming is Russian, probably near moscow or close in the northeast, for you). What encoding are you saving the file in? Looks like it might be in a specific locale but it should probably be in UTF-8 or 16 with a byte order mark. When I work in MSVC I have to usually end up opening some files and resaving them with the option to set the localization (it's a drop down on the save dialog save button) to get some files to work correctly, I remember someone was writing comments with, i think, korean or something at one point.

 

EDIT: It's a dropdown in 2015 (maybe 2017) or newer, it is in the file menu as like save encoding or something close in previous versions.

 

EDIT2: Although, actually, that error is because the types of a template can't be deduced. I already explained that this was a problem before.... https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-2/compiler-error-c3861?view=vs-2019

Edited by apianti
Link to comment
Share on other sites

Thanks but I don't know what to do.

About encodings. I installed VS2019 without choosing language but my Windows set to Russian (yes, you guessed). And now I don't know where to set a language for diagnostic messages when I compile in Power Shell with cbuild.bat script.

About 3861. Can you correct the types of templates?

Link to comment
Share on other sites

Look in the general discussion, this is not the case... In non-windows OS, most files are usually saved in UTF-8 by default which does have ASCII overlap but does not match localized encodings because they include the trailer bit in UTF-8. The problem with UTF-8 is that it almost never includes a byte order mark, so windows thinks it is the current locale encoding not UTF-8. You should make sure files are saved in UTF-8 with BOM (byte order mark) so that they are actually the same on every platform. It can't transform into a correct identifier if it thinks it is another encoding to start.

Link to comment
Share on other sites

11 hours ago, Slice said:

Thanks but I don't know what to do.

About encodings. I installed VS2019 without choosing language but my Windows set to Russian (yes, you guessed). And now I don't know where to set a language for diagnostic messages when I compile in Power Shell with cbuild.bat script.

About 3861. Can you correct the types of templates?

 

Maybe check this out, and some other similar questions on stackoverflow. There seems to be an issue with encoding in powershell and unicode, lol.... windows...

https://stackoverflow.com/a/49481797

Link to comment
Share on other sites

ascii code < 127 doesn't have any "trailer bit". All chars used in program, except literals and comments, should not be sensitive to code page or utf8.

Code page 866, share the same 127 first chars with code page 437, which share the same first 127 ascii chars.

No "trailing bit" or order mark needed, because it's one byte chars.

 

Sorry, but, no, that's not the explanation of why it doesn't compile.

Link to comment
Share on other sites

17 hours ago, apianti said:

 

Maybe check this out, and some other similar questions on stackoverflow. There seems to be an issue with encoding in powershell and unicode, lol.... windows...

https://stackoverflow.com/a/49481797

Thanks, this is that I really wanted. Now I set UTF-8 as system locale and got normal messages in the PowerShell

c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(360): error C3861: getCharPtr: идентификатор не найден
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(363): error C2668: length_of_utf_string: неоднозначный вызов перегруженной функции
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(253): note: может быть "size_t length_of_utf_string(const wchar_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(252): note: или       "size_t length_of_utf_string(const char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(251): note: или       "size_t length_of_utf_string(const char16_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(250): note: или       "size_t length_of_utf_string(const char *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(363): note: при попытке сопоставить список аргументов "(unknown-type)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(379): error C2672: "XStringAbstract__ncompare": не найдена соответствующая перегруженная функция
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(379): error C2784: int XStringAbstract__ncompare(const S *,const O *,size_t,bool): не удалось вывести аргумент шаблон для "const S *" из "unknown-type"
c

Now I can comment what is wrong.

XStringArray.h(360)

auto separator = _xstringarray__char_type<Type2>::getCharPtr(Separator);

error C3861: getCharPtr: identifier is not found

 

XStringArray.h(363)

size_t separatorLength = length_of_utf_string(separator);

error C2668: length_of_utf_string: ambiguous call of overloaded function

because Type2 can be const wchar*, const char32_t*, const char16_t*, const char*

 

and so on.

@Jief_Machak

It looks like XString is too complex for our purpose and for VS2019 as well. 

Link to comment
Share on other sites

5 hours ago, Jief_Machak said:

ascii code < 127 doesn't have any "trailer bit". All chars used in program, except literals and comments, should not be sensitive to code page or utf8.

Code page 866, share the same 127 first chars with code page 437, which share the same first 127 ascii chars.

No "trailing bit" or order mark needed, because it's one byte chars.

 

Sorry, but, no, that's not the explanation of why it doesn't compile.

 

I don't even know what this means, it's complete non-sense. There was literally this in the general discussion. I don't know if you know this but if there are more than 127 characters (every character set besides ASCII), then the trailer bit is set because it is the 128 bit. So every single code page in windows uses the trailer bit but does not know whether or not it is actually a trailer bit for UTF-8 unless it has a byte order mark or the locale is set to UTF-8. This is what I was explaining to slice (also this is a reason why strings are not coming out correctly - they appear to be encoded wrong in source). The reason it doesn't compile is because the template types can't be deduced, I am pretty sure I said this was a problem a while ago.....

 

1 hour ago, Slice said:

Thanks, this is that I really wanted. Now I set UTF-8 as system locale and got normal messages in the PowerShell


c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(360): error C3861: getCharPtr: идентификатор не найден
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(363): error C2668: length_of_utf_string: неоднозначный вызов перегруженной функции
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(253): note: может быть "size_t length_of_utf_string(const wchar_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(252): note: или       "size_t length_of_utf_string(const char32_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(251): note: или       "size_t length_of_utf_string(const char16_t *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_foundation\unicode_conversions.h(250): note: или       "size_t length_of_utf_string(const char *)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(363): note: при попытке сопоставить список аргументов "(unknown-type)"
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(379): error C2672: "XStringAbstract__ncompare": не найдена соответствующая перегруженная функция
c:\users\sergey\desktop\work\clover\rEFIt_UEFI\cpp_unit_test\../cpp_foundation/XStringArray.h(379): error C2784: int XStringAbstract__ncompare(const S *,const O *,size_t,bool): не удалось вывести аргумент шаблон для "const S *" из "unknown-type"
c

Now I can comment what is wrong.

XStringArray.h(360)

auto separator = _xstringarray__char_type<Type2>::getCharPtr(Separator);

error C3861: getCharPtr: identifier is not found

 

XStringArray.h(363)

size_t separatorLength = length_of_utf_string(separator);

error C2668: length_of_utf_string: ambiguous call of overloaded function

because Type2 can be const wchar*, const char32_t*, const char16_t*, const char*

 

and so on.

@Jief_Machak

It looks like XString is too complex for our purpose and for VS2019 as well. 

 

Cool. Yeah, it can't determine the type of the template arguments, so then it can't determine the type of the overloaded function arguments when used in the template...

 

Link to comment
Share on other sites

10 minutes ago, apianti said:

it's complete non-sense

Ah apianti, and your tactful sense... we miss you.

 

So, what I said is : for char whose code is below 127 are identical in utf8 and in code page 866, 437, and most likely almost all of them.

So, an 'A', is 0x41 in UTF8 as well as in these code page. No "trailing bit". And byte order doesn't matter because it's one byte.

If you google "trailing bit" unicode; there is no result. Is it a concept you invented ?

Link to comment
Share on other sites

7 minutes ago, Jief_Machak said:

Ah apianti, and your tactful sense... we miss you.

 

So, what I said is : for char whose code is below 127 are identical in utf8 and in code page 866, 437, and most likely almost all of them.

So, an 'A', is 0x41 in UTF8 as well as in these code page. No "trailing bit". And byte order doesn't matter because it's one byte.

If you google "trailing bit" unicode; there is no result. Is it a concept you invented ?

 

Call it like I see it. No, the bits at the beginning of each UTF-8 code point are referred to as leading/trailing bits. It is a common term. I found plenty of results with that google search but ok... Byte order absolutely matters check it out. 

The copyright character in windows codepage 1252 (western language default) is 0xA9. In UTF-8, this character is 0xA9C2, 0xA9 alone is invalid in UTF-8. It contains the highest bit set because it is larger than 127...

trailingbit.thumb.png.9b190afcb91aa9520136e836818005a8.png

Link to comment
Share on other sites

1 minute ago, Jief_Machak said:

So basically, you contradict my statement about char whose code is below 127 with an example char whose code is... 0xA9.

 

Did you know A9 is > 127 ?:hysterical:

 

As I said, we missed you...

 

Yes, I was saying your statement was non-sense because why do you think there are only 127 characters? You can put any character in any encoding in there............ I really don't understand you.

Link to comment
Share on other sites

Hi @Pene!

 

I am not using it currently. I actually don't even have macOS on my main machine at the current moment, I was thinking about getting a new SSD and cleaned this one because I can't really do much recovering from a surgery.... again, lol. Weird thing is I was not having any issues with my old machine (z77 extreme4, 2500k) or this one with clover or OC. But someone else just asked me about it happening the reverse for them, they're having good quick boot in clover but not in OC. We always seem to have fairly similar hardware, I currently have the asrock Z390 Extreme4, 9700K, was about to buy a 970evoplus 1tb (have a 960evo). Do you still have a rx580? That's what I have, and the other user, they have a skylake though. I also have other computers though I don't want to mess with them because they are used by others or for something. I am in the process of recommissioning my old main machine since I moved some parts into this one, so it is currently out of action.... I can look through what's going on though and see if I see anything plus I guess in the next few days here I will end up trying to get macOS going again, and I do normally use filevault.

Link to comment
Share on other sites

6 minutes ago, apianti said:

Hi @Pene!

 

I am not using it currently. I actually don't even have macOS on my main machine at the current moment, I was thinking about getting a new SSD and cleaned this one because I can't really do much recovering from a surgery.... again, lol. Weird thing is I was not having any issues with my old machine (z77 extreme4, 2500k) or this one with clover or OC. But someone else just asked me about it happening the reverse for them, they're having good quick boot in clover but not in OC. We always seem to have fairly similar hardware, I currently have the asrock Z390 Extreme4, 9700K, was about to buy a 970evoplus 1tb (have a 960evo). Do you still have a rx580? That's what I have, and the other user, they have a skylake though. I also have other computers though I don't want to mess with them because they are used by others or for something. I am in the process of recommissioning my old main machine since I moved some parts into this one, so it is currently out of action.... I can look through what's going on though and see if I see anything plus I guess in the next few days here I will end up trying to get macOS going again, and I do normally use filevault.

Sorry to hear about another surgery, hope you're all good now... Hope you have a quick recovery and good health, it's what matters most.

 

I'm not having the issue personally, I don't use FileVault at all, was just basically sick of seeing that issue open like forever, lol, and remembered you added some stuff related to FileVault some time ago, that's why I wondered if you can reproduce it.

 

No, I have no AMD card atm. Using Nvidia in Windows and Intel on macOS.

 

About samsung nvme, you should probably double check that the model you mention is not problematic with macOS. Some Samsung's are known to be really problematic with Mac, don't remember about the model you mention. Personally, regarding nvme, I had much better experience with models you can reformat to 4K. I used to have some really nasty issues with 512k nvme's so I decided to stick to 4k (these issues may or may not be solved with Catalina though, never dared to check again...)

 

  • Thanks 1
Link to comment
Share on other sites

42 minutes ago, Pene said:

Sorry to hear about another surgery, hope you're all good now... Hope you have a quick recovery and good health, it's what matters most.

 

Yeah, I'm cool. I tore my abdomen from my right groin up into rib cage, I had to have a mesh inserted to fix the herniation. Surgery wasn't anything compared to having to deal with that this entire year since it happened in january...

 

42 minutes ago, Pene said:

I'm not having the issue personally, I don't use FileVault at all, was just basically sick of seeing that issue open like forever, lol, and remembered you added some stuff related to FileVault some time ago, that's why I wondered if you can reproduce it.

 

Yeah, I keep hearing others say that they are having issues with some time delay but I don't see any commonality among them at all. I am trying to think about what else could be causing it but ACPI issues... I don't even have a guess at another answer currently actually.

 

EDIT: Actually, seeing that the problem is that image codec driver but the code base for that driver was integrated into OC guessing the driver is missing something... I'm unsure what parts. Funny, that's the reason they used to take control of AptioFix, because it was integrated into clover, it couldn't be used or contributed by others (except it could)... then they integrated all this stuff into OC, and now it can't be used by others, lol......

 

42 minutes ago, Pene said:

No, I have no AMD card atm. Using Nvidia in Windows and Intel on macOS.

 

Yeah I want to switch to an NVIDIA because CUDA processing, I had a class and it really sucked having to do it over ssh to a massive gpu rig at the school. Plus I realized how much you can optimize data experiments with a gpu, it's crazy. I've had this RX 580 nitro+ since launch because it was one of the models that macOS specifically supported from sapphire in that external thunderbolt enclosure.

 

42 minutes ago, Pene said:

About samsung nvme, you should probably double check that the model you mention is not problematic with macOS. Some Samsung's are known to be really problematic with Mac, don't remember about the model you mention. Personally, regarding nvme, I had much better experience with models you can reformat to 4K. I used to have some really nasty issues with 512k nvme's so I decided to stick to 4k (these issues may or may not be solved with Catalina though, never dared to check again...)

 

Nah, I wouldn't be using that for macOS. But it is a newer revision of the 970evo, basically just has faster transfer rates. I will actually use my 960evo for macOS, I just made this only windows so I can clone it then install macOS back onto it. I just got ahead of myself since I use windows a lot more because of certain software and I'm like stuck where I am...

Edited by apianti
  • Like 1
Link to comment
Share on other sites

11 hours ago, Pene said:

I used to have some really nasty issues

Hi @Pene, What kind of issues did you have with a 512bytes/sector SSD

Let me explain mine I have a 512 bytes SSD. Works fine with HFS and APFS, except with APFS encrypt. Imagine a 512GB SSD, partitioned in 2, so, around 256GB each partition. I zeroed every sector of the first partition. Now I create an APFS container with an APFS encrypted volume in the second partition. I fill that partition (with a dd if=/dev/random) for example. After a while, some sector are written in the first half of the SDD : outside the container !! Does anyone ever saw something like that ?

 

PS : did you see my post on github about replacing loginui.efires to be able to boot catalina/FV, and about the fact that loginui.efires is way bigger with Catalina. That could give a clue of what's going on.

  • Like 1
Link to comment
Share on other sites

12 hours ago, Jief_Machak said:

Hi @Pene, What kind of issues did you have with a 512bytes/sector SSD

Let me explain mine I have a 512 bytes SSD. Works fine with HFS and APFS, except with APFS encrypt. Imagine a 512GB SSD, partitioned in 2, so, around 256GB each partition. I zeroed every sector of the first partition. Now I create an APFS container with an APFS encrypted volume in the second partition. I fill that partition (with a dd if=/dev/random) for example. After a while, some sector are written in the first half of the SDD : outside the container !! Does anyone ever saw something like that ?

I had seen somewhat similar behavior with several (different) NVME 512b SSDs, when I was using HighSierra/Mojave (never dared to check again with Catalina), I was using regular APFS though:

After some time (1-3 months), data starts being destroyed, in all kinds of methods. For example I had macOS and Windows partitions, first Windows data started to be destroyed, i.e. corrupted files (files actually started to contain junk data), then eventually the APFS partition got destroyed as well.

I suspected it may be some macOS bug with TRIM on NVME&512b, but never confirmed it. It also crossed my mind that perhaps it happens only with larger drives using 512b - all my drives were 1TB (which were still rather rare back then), hence maybe fewer reports about it (?)

I will mention I never had it on SATA SSDs, all being 512b as well.

 

For the record, it happened with both drives you see in my signature, and some others as well, so it is not brand/controller/firmware specific, as they were very different drives (but all were NVME 1TB).

To my surprise, I found very few reports about such issues. At first I wasn't sure what it is, so I reformatted, and issue repeated again after a few months. At some point I also switched from Z370 to Z390 (replaced motherboard), and also replaced the drive to a different brand, but the same thing happened again after a few months.

 

The very few reports I did find about similar issues on very specific hardware (totally different than mine), mentioned that 4K-formatting the drives (via Linux, for drives that support it) solves the issue. I gave it a try - as the Plextor M9Pe supports reformatting to 4K - and indeed I never had the issue again, for almost 2 years now, so it seems it is somehow related (Just to be safe and protect my data, I also disabled the Samsung from being detected in macOS, as it doesn't support 4K, and use it for Windows only). In the meantime I upgraded to Catalina, but as mentioned, never tried to reformat again to 512b to see if it still happens.

 

Which drive are you experiencing it on? Are you sure it happens only with APFS encrypt? Maybe it's just a matter of time till in happens in other cases?

 

(About loginui.efires: I did see that, but honestly I have 0 idea about FileVault, never even tried it, so I'm not sure what to do with it).

Edited by Pene
Link to comment
Share on other sites

 Share

×
×
  • Create New...