winapps-org / winapps-org/winapps

App start fails with BAD_PORT message because grep returns multiple IPs

Open
#432 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.