Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
# vi: set ft=ruby :

def get_host_ip
# This example uses `ifconfig` and `grep` to find inet interface and host IP address
host_ip = `ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`.strip
# This uses `route` to find the host's default IP address
# and pipes it through to `awk` and `ifconfig`
Comment on lines +5 to +6
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s trailing whitespace at the end of these comment lines; please remove it to avoid churn in diffs and whitespace-only changes.

Copilot uses AI. Check for mistakes.
# to extract the IP address of the host machine.
host_ip = `route -n get default | awk '/interface:/{print $2}' | xargs ifconfig | awk '/inet / {print $2}'`.strip

Comment on lines +5 to +9
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command can still produce multiple IPv4 addresses for the chosen interface (e.g., if the interface has aliases), and .strip won’t collapse internal newlines—so host_ip may contain multiple lines and still trigger the SMB mount error this change is trying to avoid. Consider using a command that guarantees a single address (e.g., ipconfig getifaddr <iface> on macOS) or explicitly selecting/filtering one address (first line and excluding 169.254/loopback), and handle the empty-output case with a clear failure message.

Suggested change
# This uses `route` to find the host's default IP address
# and pipes it through to `awk` and `ifconfig`
# to extract the IP address of the host machine.
host_ip = `route -n get default | awk '/interface:/{print $2}' | xargs ifconfig | awk '/inet / {print $2}'`.strip
# This uses `route` to find the host's default network interface
# and then `ipconfig getifaddr` to get a single IPv4 address
# for that interface on macOS.
interface = `route -n get default | awk '/interface:/{print $2}'`.strip
host_ip = ""
unless interface.empty?
host_ip = `ipconfig getifaddr #{interface}`.strip
end
if host_ip.nil? || host_ip.empty?
raise "Unable to determine host IP address for SMB mount. Please configure smb_host_ip manually in the Vagrantfile."
end

Copilot uses AI. Check for mistakes.
return host_ip
end

Expand Down