Page 1 of 1

Ringhio bug?

Posted: Tue Oct 29, 2013 10:07 am
by TomSoniq
Hi!

I've discovered some strange ringhio behaviour which can be reproduced by running the code below like this:
  • Start the Notify program for the first time
    Two popups should be displayed.
    Now open Prefs/Notifications
    You should find two new registered applications: "TestApp-Something" and "TestApp"
    Untick TestApp only but leave TestApp-Something enabled, save settings.
    Start the Notify program again
    This time the second popup should be disabled but it isn't! Both still show up.
    Now do it the other way round: Untick TestApp-Something but tick TestApp
    Start the Notify program again
    This time only the first popup should be disabled but instead none of them shows up.
This also happens when the two notifications are sent from two separate, different executables.
Setting REGAPP_UniqueApplication to TRUE in both instances doesn't change anything either.
It seems as if TestApp automagically inherits the Notification settings from TestApp-Something instead of using its own.
Can you please tell me if this is a bug or if it's intentional? ;)

Code: Select all

;/* NotifyTest
gcc -o Notify Notify.c
quit
*/

#include <stdio.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/application.h>

struct Library *ApplicationBase = NULL;
struct ApplicationIFace *IApplication = NULL;
uint32 AppID = 0;

int OpenLibs(void) {
	if((DOSBase = IExec->OpenLibrary("dos.library", 52))) {
		if((IDOS  = (APTR)IExec->GetInterface(DOSBase, "main", 1L, NULL))) {
			if((ApplicationBase = IExec->OpenLibrary("application.library", 52))) {
				if((IApplication  = (APTR)IExec->GetInterface(ApplicationBase, "application", 2L, NULL))) {
					return 1;
				}
			}
		}
	}
	return 0;
}

void CloseLibs(void) {
	if(IApplication) IExec->DropInterface((struct Interface *)IApplication);
	if(ApplicationBase) IExec->CloseLibrary(ApplicationBase);
	if(IDOS) IExec->DropInterface((struct Interface *)IDOS);
	if(DOSBase) IExec->CloseLibrary(DOSBase);
}

int main(void) {
	if(OpenLibs()) {
		AppID = IApplication->RegisterApplication("TestApp-Something",
			REGAPP_UniqueApplication, FALSE,
			REGAPP_HasIconifyFeature, TRUE,
		TAG_END);
		if(AppID) {
			printf("TestApp-Something application registered.\n");
			IDOS->Delay(50);
			IApplication->Notify(AppID,
				APPNOTIFY_Title, "TestApp-Something Testing!",
				APPNOTIFY_Text, "One, Two!",
			TAG_END);
			printf("TestApp-Something notification sent.\n");
			IApplication->UnregisterApplication(AppID, NULL);
			printf("TestApp-Something application unregistered.\n");
		}

		AppID = IApplication->RegisterApplication("TestApp",
			REGAPP_UniqueApplication, FALSE,
			REGAPP_HasIconifyFeature, TRUE,
		TAG_END);
		if(AppID) {
			printf("TestApp application registered.\n");
			IDOS->Delay(50);
			IApplication->Notify(AppID,
				APPNOTIFY_Title, "TestApp Testing!",
				APPNOTIFY_Text, "Three, Four!",
			TAG_END);
			printf("TestApp notification sent.\n");
			IApplication->UnregisterApplication(AppID, NULL);
			printf("TestApp application unregistered.\n");
		}
		CloseLibs();
	}
}

Re: Ringhio bug?

Posted: Wed Oct 30, 2013 10:37 am
by TomSoniq
Long story short:

Two registered applications, one called TestApp-Something, the other one TestApp

Disabling TestApp in Ringhio Prefs does nothing.
Disabling TestApp-Something in Ringhio Prefs disables them both.

Any ideas? ;)

Re: Ringhio bug?

Posted: Thu Oct 31, 2013 10:35 am
by trixie
@TomSoniq

Easy to guess: Ringhio prefs disregards the rest of the application name as soon as it finds a non-alphanumeric character, like "-". Perhaps it uses some kind of IsAlpha() test when dealing with the name.

Re: Ringhio bug?

Posted: Thu Oct 31, 2013 10:49 am
by TomSoniq
Tried removing the dash: Same thing
Called second instance TestApp-Different: Everything ok.

So it seems as if the Ringhio server only does the string compare until the length of the shorter string is reached.

Registering an application called Ami is fun. To make it shut up you have to disable AmiUpdate, AmiDock, etc.. in Ringhio prefs. :?

Re: Ringhio bug?

Posted: Thu Oct 31, 2013 11:47 am
by trixie
@TomSoniq
So it seems as if the Ringhio server only does the string compare until the length of the shorter string is reached.
Surely looks like bogus string comparison. Now all we have to do is keep posting in this thread until somebody in charge notices it and files a bug report. Your turn, Tom :-)

Re: Ringhio bug?

Posted: Thu Oct 31, 2013 11:57 am
by ZeroG
@TomSoniq
Maybe you should send a pm / email to m3x, as far as i know ringhio is his project.

Re: Ringhio bug?

Posted: Thu Oct 31, 2013 1:17 pm
by kas1e
@all
Noted BZ for ringio prefs with name "bogus string comparison". Creating of that BZ entry automatically send mail to max as well.