-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server: Don't warn when no --serverinfo is provided #2951
Server: Don't warn when no --serverinfo is provided #2951
Conversation
When was there a change to make |
Can we at least change the PR title to match what the problem is (i.e. error on missing What I'm saying above is that I don't think this check should be needed in CServer - the check for empty argument should be done in main.cpp and start up shouldn't happen. |
The intention of 5b2c2de was to introduce logging for bad --serverinfo parameters. However, it also warns about bad serverinfo if no --serverinfo is given at all. This is confusing. Therefore, this commit removes the error when no --serverinfo has been given. Fixes: jamulussoftware#2947
92de75f
to
650483b
Compare
I think there was no change.
I agree that the title was confusing and I've changed the title and the commit message accordingly
Yeah, right, but that's a different, rather hypothetical issue, I'd say? |
@pljones Do you think this is ready? |
Reviewed. I still don't think the PR is valid. |
Ok. Due to this comment? |
Yes. |
We need to agree what happens next here. I'm proposing to drop from 3.10.0 until that's done. |
I think it's a regression which should be fixed. At least the message should say that serverinfo is be empty or invalid as intermediate fix. |
Yes, in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pljones actually, I think, the else is related to line 197
if ( iServInfoNumSplitItems >= 3 )
Ah yes, and empty serverinfo is valid for unregistered servers. And I'm quite sure that this isn't checked. Do you think that registered servers must provide a server info? |
It's valid not to supply // prepare the server info information
QStringList slServInfoSeparateParams;
int iServInfoNumSplitItems = 0;
if ( !strServerInfo.isEmpty() )
{
// split the different parameter strings
slServInfoSeparateParams = strServerInfo.split ( ";" );
// get the number of items in the split list
iServInfoNumSplitItems = slServInfoSeparateParams.count();
}
...
// parse the server info string according to definition:
// [this server name];[this server city];[this server country as QLocale ID] (; ... ignored)
// per definition, we expect at least three parameters
if ( iServInfoNumSplitItems >= 3 )
{
...
}
else
{
qWarning() << "Ignoring invalid serverinfo, please verify the parameter syntax.";
} There's nothing invalid about it. It simply isn't used if fewer than three entries are present and any extra ones (like the comment says) are ignored. The Once upon a time, a long long time ago, before the pandemic really got going, Ideally, now, we'd pass a parsed "ServerInfo" object (actually a However, for now, I'd be happy just to see the parameter actually validated in (It's probably worth checking the GUI doesn't allow |
I think after reading and thinking about that, that we should invest in improving that and not go with a halfway working version. So, the next step would be to find all places where serverinfo is set (GUI, JSONRPC, CLI) and then generate and pass the parsed object as you suggested. It should be doable. However, main.cpp doesn't create these kind of objects so far? Ultimately it's for sure a design choice. |
The problem with Currently, the "keep it small and simple" approach would just be to validate the parameter when we're passed But I don't think we should just revert that |
Commented on #2599. |
@pljones I know you think this is wrong to merge, but can you update this PR to have it in an acceptable state? I believe this is a regression and should be fixed in the next release. |
As a minimum, I think that if |
Yes. Sounds good:
|
I've taken the liberty of pushing to this branch to avoid raising a new PR. This solution isn't perfect. It could check each string isn't empty...
|
@ann0see are you happy with this approach? |
Not quite. If it is empty, I think it should be skipped without any output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment
5ddf84c
to
f9ef825
Compare
f9ef825
to
338959b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy now. Thanks
Short description of changes
The intention of 5b2c2de was to introduce logging for bad --serverinfo parameters. However, it also warns about bad serverinfo if no --serverinfo is given at all. This is confusing.
Therefore, this commit removes the error when no --serverinfo has been given.
CHANGELOG: Server: Improved --serverinfo argument validation
Context: Fixes an issue?
Fixes: #2947
Does this change need documentation? What needs to be documented and how?
No.
Status of this Pull Request
Ready.
What is missing until this pull request can be merged?
Reviews.
Checklist