winapps-org / winapps-org/winapps
App start fails with BAD_PORT message because grep returns multiple IPs
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 16k
- Forks
- 508
- Avg merge
- 13h 35m
- Merged PRs (30d)
- 3
Description
For reasons that are unclear to me, ip neigh returns two IPs with the MAC of my VM's only interface. As a result, the grep commands used to get the IP return a variable containing two IPs, separated by a newline. obviously this mangles the command of the netcat check, and feeding bash $IP $PORT || waThrowExit is going to always throw an exit, if not the right one.
More correct behavior would be to throw a (new to the codebase) BAD_IP error, or to iterate over the IPs, since the port value is actually fine.
My short term fix is to add -m1 to the grep command that matches on the VM's MAC. Of course, if the first IP is the bad one, this will not work.
I also suggest adding on ip '${RDP_IP}' immediately after the port in the BAD_PORT error notification in any case, because doing that is what led to me understanding the problem.
I realize the cause of this issue is not internal to the project, but it is a case of not catching bad input
The only thing I did that might have caused this is a force reset of my VM because it was hung. everything worked before i did that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the startup commands that use ip neigh, grep, and the netcat port check to derive the VM IP. Reproduce the case where the MAC match returns multiple IPs, then determine how the check should handle that input and ensure the resulting error identifies the IP as well as the port.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, shell
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100