Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 05-27-2020, 06:41 AM   #1
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default REAPER 6.11 numbers reaper-menu.ini file incorrectly

As of 6.11 the reaper-menu.ini file is being sorted incorrectly.

The item_nnn identifier at the beginning of each line is being sorted by alpha instead of by number. While internally in REAPER it still works, this causes problems for anyone who has written software that expects the reaper-menu.ini file to be ordered the way it has always been ordered.

So instead of sorting 0,1,2,3,4 ... it sorts 0,1,10,11,12,...

cohler is offline   Reply With Quote
Old 05-27-2020, 09:01 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,762
Default

One shouldn't rely on a specific order of entries in a "classical" ini file.
Best way would be to read the file and order it in your script/program by yourself so you can be sure to have full control over the read data and its ordering.

This counts for all ini-files in Reaper, which can be unordered by the user by hand as well, not only by Reaper itself.
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-27-2020, 09:28 AM   #3
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 16,518
Default

MAM is correct, you shouldn't rely on any sorting in ini files, but thank you for pointing out that this changed, because it was unintentional. We'll restore the behavior for the next release.
schwa is offline   Reply With Quote
Old 05-27-2020, 10:37 AM   #4
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by schwa View Post
MAM is correct, you shouldn't rely on any sorting in ini files, but thank you for pointing out that this changed, because it was unintentional. We'll restore the behavior for the next release.
I wasn’t relying on any particular order. I was relying on the ONLY order that has ever existed for the file. Indeed it is the definition of the file. And the only order.

Clearly a bug. Thank you for fixing the bug.
cohler is offline   Reply With Quote
Old 05-27-2020, 11:06 AM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,762
Default

There is no such ONLY order. It just happened to be one used by Reaper but still, you shouldn't rely on it as ini files aren't designed as such.

So it's not a bug, it's how inifiles of that design work in any app who use them and you need to take care of that.

It would be a bug, if the file wouldn't work but it does.
It's just not your preferred order.

Keep in mind that Reaperusers may edit the file by hand, distorting the ONLY order. Your code needs to take care of these things as it's not uncommon in the Reapercommunity.
So make your code accept the file in any order to be safe of any possible circumstance that could occur. This makes your code rocksolid and saves you from doong edgecase-debugsessions.

Have you looked into using the SWS-functions who access ini-files? They may help you getting over potential order problems.
Just look for functions with ProfileString in their names.
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-27-2020, 11:16 AM   #6
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
There is no such ONLY order. It just happened to be one used by Reaper but still, you shouldn't rely on it as ini files aren't designed as such.

So it's not a bug, it's how inifiles of that design work in any app who use them and you need to take care of that.

It would be a bug, if the file wouldn't work but it does.
It's just not your preferred order.

Keep in mind that Reaperusers may edit the file by hand, distorting the ONLY order. Your code needs to take care of these things as it's not uncommon in the Reapercommunity.
So make your code accept the file in any order to be safe of any possible circumstance that could occur. This makes your code rocksolid and saves you from doong edgecase-debugsessions.

Have you looked into using the SWS-functions who access ini-files? They may help you getting over potential order problems.
Just look for functions with ProfileString in their names.
It’s definitely a bug. And REAPER will NOT work if you randomly change the line order of the file.

There obviously is a defined order. That’s why the lines are numbered.

Deny the obvious all you want, but it doesn’t change reality.

If it’s not a bug then why is @schwa fixing it???
cohler is offline   Reply With Quote
Old 05-27-2020, 11:30 AM   #7
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 16,518
Default

Not everything has to be a fight.

If you are parsing .ini files, you should be aware that entries can be in any order and there can be blank lines. This is true in general for any application that uses .ini files, and it is true for all REAPER .ini files...

... except this one file, reaper-menu.ini. REAPER does write this file in a particular sorted order as an optimization when parsing the file, and it's a bug that that sorting order changed, so thank you for reporting it.
schwa is offline   Reply With Quote
Old 05-27-2020, 11:56 AM   #8
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by schwa View Post
Not everything has to be a fight.

If you are parsing .ini files, you should be aware that entries can be in any order and there can be blank lines. This is true in general for any application that uses .ini files, and it is true for all REAPER .ini files...

... except this one file, reaper-menu.ini. REAPER does write this file in a particular sorted order as an optimization when parsing the file, and it's a bug that that sorting order changed, so thank you for reporting it.
Thank you. Yes, I am well aware, of everything you noted above. And I have already this morning rewritten my software to work around this bug in any case.

And I agree that not everything has to be a fight.

That is precisely why it's better not to accuse customers who have reported a rather obvious bug of being incorrect and claiming it's not a bug, but rather an "unintended change", and on and on with the blame-the-customer-first school of customer support.

I appreciate the fast response.
cohler is offline   Reply With Quote
Old 05-27-2020, 02:38 PM   #9
Icchan
Human being with feelings
 
Icchan's Avatar
 
Join Date: Dec 2011
Location: Finland
Posts: 793
Default

Quote:
Originally Posted by cohler View Post
That is precisely why it's better not to accuse customers who have reported a rather obvious bug of being incorrect and claiming it's not a bug, but rather an "unintended change", and on and on with the blame-the-customer-first school of customer support.
You have never gone to a class in basic programming paradigms and conventions now have you? I mean it's NEVER a good idea to trust the data to be in any way ordered UNLESS IT SPECIFICALLY IS GUARANTEED BY THE PROVIDER INTERFACE TO BE SO (which would be clearly stated in the .ini file or in REAPER docs or API help if that was the case) and you always sort the incoming data according to your own needs and then process it.

That's the basics of any data handling.

You're in the wrong in making an assumption, regardless if the change in sorting was "unintended behaviour", there's no guarantee for the sorting and it can change at any time...

First step to failure is making an assumption. I should know, i learned it the hard way. (Yes, I'm a programmer, even if not a professional one)

So don't take things personally, but learn from them. If you take something personally or start to feel entitled to something, you're on the wrong road. That's how fights start
Icchan is offline   Reply With Quote
Old 05-28-2020, 06:03 AM   #10
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by Icchan View Post
...it's NEVER a good idea to trust the data to be in any way ordered UNLESS IT SPECIFICALLY IS GUARANTEED BY THE PROVIDER INTERFACE TO BE SO
Agreed. And it clearly is so-documented. Like so many things in REAPER, which lacks detailed API documentation, it is self-documented in the coding and use of the reaper-menu.ini file itself, which as noted by @schwa is a very special ini file unlike most (or all) of the others, in that it does use a specific line order (indeed the lines are numbered!).

Again, as @schwa noted, it will be fixed, so it clearly is a bug.

If it wasn't a bug, it wouldn't need fixing, now would it? And I nor you would want the devs wasting their time fixing non-bugs would we? (last post on this subject)
cohler is offline   Reply With Quote
Old 05-28-2020, 06:44 AM   #11
White Tie
Pixel Pusher
 
White Tie's Avatar
 
Join Date: Mar 2007
Location: Blighty
Posts: 5,215
Default

Please don't ever get into theming.
__________________
The House of White Tie
White Tie is offline   Reply With Quote
Old 05-28-2020, 11:50 PM   #12
gmgmgm
Human being with feelings
 
Join Date: Jan 2013
Posts: 163
Default

Quote:
Originally Posted by White Tie View Post
Please don't ever get into theming.
That gave me such a chuckle.

White Tie, you really are a treasure.
gmgmgm is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.