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 (463 fork)batch import
good first issue

仓库指标

Star
 (15,020 star)
PR 合并指标
 (平均合并 12小时 59分钟) (30 天内合并 3 个 PR)

描述

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.

贡献者指南