Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

Fix prefix ownership detection for cloned and CRLF-stamped prefixes

NotProtonNote562f3bd73ef
diff --git a/dylib/feats/compat_run.sh b/dylib/feats/compat_run.sh
index e1ba6f6..908dc68 100755
--- a/dylib/feats/compat_run.sh
+++ b/dylib/feats/compat_run.sh
@@ -163,17 +163,23 @@ last_wine_build() {
updated_file="$STEAM_COMPAT_DATA_PATH/pfx/.update-timestamp"
[ -r "$updated_file" ] || return 0
read -r updated _ < "$updated_file" || true
+ # Wine ends the line with CRLF.
+ updated=${updated%"$(printf '\r')"}
case "$updated" in '' | *[!0-9]*) return 0 ;; esac
[ "$updated" = "$(stat -f %m "$CX_ROOT/share/wine/wine.inf" 2>/dev/null)" ] && return 0
had_build=other
had_display="another version of CrossOver"
for inf in "$np_support"/runners/crossover-*/CrossOver/share/wine/wine.inf; do
[ "$(stat -f %m "$inf" 2>/dev/null)" = "$updated" ] || continue
+ if [ "$had_build" != other ]; then
+ had_build=other
+ had_display="another version of CrossOver"
+ break
+ fi
had_build=${inf#"$np_support/runners/crossover-"}
had_build=${had_build%%/*}
had_display=$(awk -F '\t' -v b="$had_build" '$2 == b { print $4; exit }' \
"$np_support/tools" 2>/dev/null) || had_display=""
- break
done
}
diff --git a/dylib/tests/buildcheck.sh b/dylib/tests/buildcheck.sh
index 013232c..35bb165 100644
--- a/dylib/tests/buildcheck.sh
+++ b/dylib/tests/buildcheck.sh
@@ -38,7 +38,7 @@ launch() {
build=$1 updated=$2 record=$3
data=$(mktemp -d "$work/compatdata.XXXXXX")
mkdir -p "$data/pfx"
- [ -z "$updated" ] || printf '%s\n' "$updated" > "$data/pfx/.update-timestamp"
+ [ -z "$updated" ] || printf '%s\r\n' "$updated" > "$data/pfx/.update-timestamp"
[ -z "$record" ] || printf '%s' "$record" > "$data/notproton-build"
(
STEAM_COMPAT_DATA_PATH=$data
@@ -69,6 +69,10 @@ last run by another version of CrossOver" "$(launch 26.3.0.39832 1 "")"
is "updates the user disabled say nothing, so the prefix is claimed" "status=0
26.3.0.39832" "$(launch 26.3.0.39832 disable "")"
+clone 27.0.0.40921 202608211200
+is "a prefix either of two clones updated names neither" "status=1
+last run by another version of CrossOver" "$(launch 26.3.0.39832 "$(mtime 27.0.0.40921)" "")"
+
echo "== prefixes with a record =="
is "the record wins over the Wine that updated the prefix" "status=0
27.0.0.40921-fex" "$(launch 27.0.0.40921-fex "$(mtime 26.3.0.39832)" "27.0.0.40921-fex