#!/usr/bin/env bash # Crea una bottiglia finta con i casi difficili: symlink (anche rotto), nomi # lunghi (>100 char, per i record PAX "path"), UTF-8, spazi/apici, permessi # insoliti e mtime fissi. set -euo pipefail dir="${1:?uso: make_fake_bottle.sh }" bottle="$dir/Fake Bottle" rm -rf "$bottle" mkdir -p "$bottle/drive_c/Program Files/Game" "$bottle/dosdevices" cat > "$bottle/bottle.yml" <<'YML' Name: 'Fake Bottle' Runner: soda-9.0-1 Arch: win32 Windows: win10 Environment: Gaming YML printf 'hello world\n' > "$bottle/drive_c/Program Files/Game/game.exe" printf 'config\n' > "$bottle/drive_c/config.ini" printf 'binario\n' > "$bottle/drive_c/program" head -c 4096 /dev/urandom > "$bottle/drive_c/blob.bin" printf 'unicode\n' > "$bottle/drive_c/perché.txt" longname="$bottle/drive_c/$(python3 -c 'print("a"*110)').txt" printf 'long path\n' > "$longname" mkdir -p "$bottle/nested/deep/deeper" printf 'deep\n' > "$bottle/nested/deep/deeper/file.txt" ln -s "config.ini" "$bottle/drive_c/link_to_config" ln -s "/nonexistent/target" "$bottle/drive_c/broken_link" ln -s "../drive_c/config.ini" "$bottle/dosdevices/c_drive" chmod 750 "$bottle/nested" chmod 600 "$bottle/drive_c/config.ini" chmod 755 "$bottle/drive_c/program" # mtime fissi (con frazione) per verificare i record PAX mtime touch -d '2026-03-14 01:12:37.123456789' "$bottle/drive_c/config.ini" touch -d '2020-01-02 03:04:05' "$bottle/bottle.yml" echo "$bottle"