winapps-org/winapps

App start fails with BAD_PORT message because grep returns multiple IPs

Open

#432 建立於 2025年2月23日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)Shell (15,020 star) (463 fork)batch import
good first issue

描述

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.

貢獻者指南

App start fails with BAD_PORT message because grep returns multiple IPs · winapps-org/winapps#432 | Good First Issue