@@ -123,20 +123,20 @@ declare -g -a CCACHE_PASSTHROUGH_VARS=(
123123 CCACHE_PCH_EXTSUM
124124)
125125
126- # Discover ccache remote storage via DNS-SD (mDNS/Avahi) or DNS SRV records.
127- # Looks for _ccache._tcp services with TXT records: type=http|redis, path=/...
128- # Prefers Redis over HTTP when multiple services are found.
129- # Sets CCACHE_REMOTE_STORAGE on success, returns 1 if nothing found.
126+ # Format host:port, wrapping IPv6 addresses in brackets for URL compatibility (RFC 2732)
130127function ccache_format_host_port() {
131128 local host=" $1 " port=" $2 "
132- # Wrap IPv6 addresses in brackets for URL compatibility (RFC 2732)
133129 if [[ " ${host} " == * :* ]]; then
134130 echo " [${host} ]:${port} "
135131 else
136132 echo " ${host} :${port} "
137133 fi
138134}
139135
136+ # Discover ccache remote storage via DNS-SD (mDNS/Avahi) or DNS SRV records.
137+ # Looks for _ccache._tcp services with TXT records: type=http|redis, path=/...
138+ # Prefers Redis over HTTP when multiple services are found.
139+ # Sets CCACHE_REMOTE_STORAGE on success, returns 1 if nothing found.
140140function ccache_discover_remote_storage() {
141141 # Method 1: DNS-SD browse on local network (requires avahi-browse)
142142 if command -v avahi-browse & > /dev/null; then
@@ -342,7 +342,9 @@ function host_pre_docker_launch__setup_remote_ccache() {
342342 fi
343343 fi
344344
345- # Replace loopback addresses with host.docker.internal so the container can reach the host
345+ # Replace loopback addresses with host.docker.internal so the container can reach the host.
346+ # The regex above matches loopback only in the host position (after ://), so the global
347+ # string substitution below is safe — loopback strings in password/path are not matched.
346348 if [[ -n " ${CCACHE_REMOTE_STORAGE} " ]]; then
347349 if [[ " ${CCACHE_REMOTE_STORAGE} " =~ ://localhost[:/\| ] || \
348350 " ${CCACHE_REMOTE_STORAGE} " =~ ://127\. 0\. 0\. 1[:/\| ] || \
0 commit comments