dinitctl: show the service path in the "status" command output#550
dinitctl: show the service path in the "status" command output#550mobin-2008 wants to merge 1 commit into
Conversation
|
Someone was already working on this (#511). It does look like that effort stalled, but could you confirm with them please before we proceed with this new PR, out of politeness. It would be good if you could communicate what you are intending to work on before you start doing it, that will help avoid this sort of situation. |
I asked him and I'm waiting for his response.
Yes. I should did more than assigning issue (#508) to myself. |
|
Let's give it 3 days to wait for an answer. In the meantime, can you please close this PR and re-open after that time (I assume you have properly self-reviewed, if not please do that before re-opening). |
|
I forgot to reopen this PR before force pushing my branch :( |
|
Create a new branch from your current one ( |
4a646c5 to
d03c4d5
Compare
|
As per the contribution guide, you should specify what testing has been done when opening a PR. Can you do that now please? Can you also confirm that you're otherwise following the process, and have self-reviewed? |
Use the existing functionality to show the service path of currently loaded service. Addresses davmac314#508
d03c4d5 to
c4be545
Compare
Changes tested against these cases:
Yes. |
It seems like you just pushed changes after opening the PR - that's not the process, and we've talked about that before! - and yet you are now saying, just a few minutes later, that you are following the process. Please read the CONTRIBUTING and PR-PROCESS guides, in full. This is the last time I will allow you grace for this.. |
|
|
||
| // Issue STATUS request | ||
| { | ||
| // Prepare to show the service path in the output later down |
There was a problem hiding this comment.
- "Service path" isn't a thing. You're talking about a service description file path. Don't make up terminology please.
Two questions:
- "Prepare to show" is not clear. What is this code actually doing?
- Why do you feel the output "later down" is significant enough that it needs to be mentioned here?
There was a problem hiding this comment.
- "Service path" isn't a thing. You're talking about a service description file path. Don't make up terminology please.
OK. Will be fixed.
Two questions:
* "Prepare to show" is not clear. What is this code actually doing?
It's preparing a variable (service_path) to be used for showing the service path in the output later down. The code shows how this preparation works.
* Why do you feel the output "later down" is significant enough that it needs to be mentioned here?
Because it feels weird to me that there is a random get_service_description_dir before issuing STATUS. This is here to mention it's going to be used for showing the service path in the output later down the code and you need to keep looking for its usage.
There was a problem hiding this comment.
It's preparing a variable (
service_path) to be used for showing the service path in the output later down.
What does "preparing" mean in this case? (Also, can you explain it without referring to a variable? Variables are everywhere and I can see the variables in the code).
The code shows how this preparation works.
It shouldn't be necessary to read the code to understand what a comment means. The comment is supposed to explain the code, not the other way around.
What is the specific purpose of the comment here? Eg Is it explaining something that you think is difficult to understand, or is it just summarising what the following section of code does to help navigating the code, or something else?
This is here to mention it's going to be used for showing the service path in the output later down the code and you need to keep looking for its usage
Isn't that normal though? There are heaps of places where some value is determined so that it can be used later - that's basically every variable assignment! - so does it really need to be explained in the comment? Do you see any other comments that do that?
Because it feels weird to me that there is a random get_service_description_dir before issuing STATUS
The comment doesn't explain why get_service_description_dir is called at all, though.
There was a problem hiding this comment.
Sorry, that's a bit of an overload of questions. Can we focus on these for now:
What does "preparing" mean in this case?
("Preparing a variable" means nothing to me. What do you mean exactly?)
and
What is the specific purpose of the comment here? Eg Is it explaining something that you think is difficult to understand, or is it just summarising what the following section of code does to help navigating the code, or something else?
There was a problem hiding this comment.
("Preparing a variable" means nothing to me. What do you mean exactly?)
The original comment was this:
// Get the service description directory to show the service path in the output later down
I thought it is a bad idea to repeat what the code does in this comment, so I replaced it with "prepare" which is also bad, because everything up to the issuing the STATUS request is just preparation.
What is the specific purpose of the comment here? Eg Is it explaining something that you think is difficult to understand, or is it just summarising what the following section of code does to help navigating the code, or something else?
To be faithful to the style of this function, I thought it needs a comment explaining the section below. I mean it does
just summarising what the following section of code does to help navigating the code
but now I think it doesn't need to a comment explaining it, I just misunderstood the style.
There was a problem hiding this comment.
I thought it is a bad idea to repeat what the code does in this comment
It is fine to explain what a block of code does (at a slightly higher level than the code itself) with a comment.
If the comment is summarising the section of code though, then it should focus on what this section of code does, not non-specific things such as that it is "preparing" something "to be output later down". Those words (quoted) don't give any useful information to someone reading the comment.
but now I think it doesn't need to a comment explaining it
It is fine and good to have a comment here, that summarises what the code is doing. That is why I asked: what does this code actually do? (I know what it does - but I want you to explain it, in a way that would be useful as a comment).
So again: what does this code actually do?
| } | ||
|
|
||
| cout << "Service: " << service_name << "\n" | ||
| cout << "Service: " << service_name << " (" << service_path << ")" << "\n" |
There was a problem hiding this comment.
Don't output it here. Output it with an appropriate heading (maybe 'File:') as with other status elements.
Feature design should really be discussed before working on it - that's also part of the documented process.
There was a problem hiding this comment.
I think adding File is good.
|
Please answer questions above and then I will complete the review. |
| return 1; | ||
| } | ||
|
|
||
| // Issue STATUS request |
There was a problem hiding this comment.
I think the purpose of indentation here is to split the function into two sections:
- Code preparing for issuing the
STATUSrequest (e.g. getting the service handle) - Issuing the
STATUSand generate the output by processing the response from the daemon and with help of things defined in outer indentation.
If that is correct I think anything that doesn't have anything to do with issuing request and processing it, should be defined in the outer layer, right?
There was a problem hiding this comment.
I think you mean the scoping (via { and '}')? Indentation by itself does nothing.
It's not really all that important here. It was initially used to limit the scope of some temporary variables but it doesn't really matter, the scope got too long anyway.
Now I see how half-baked this PR is, I try my best to fix it. I answered your questions and also asked a question for better understanding the current design. If the feedback is still negative, I would mark this PR as draft until it gets to the point of being up to the standard. |
There's still a question pending - see above. Once that's resolved I'll complete the review. Thanks. |
Use the existing functionality to show the service path of currently loaded service.
Fixes #508