Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions .xum/skills/verify-xum/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ newest-run link live there. Use a checkout of your own, not a shared repository.
(the default on Debian and Ubuntu, which give each user a private group), git makes a clone's
folder, `.git` and `.git/worktrees/<name>` 0775, so every command refuses. Run
`chmod g-w,o-w` on the folder the message names (it names one at a time), or use a checkout made
under umask 022. Bun on PATH must be the version in `package.json` `packageManager`. Launch
refuses another Bun.
under umask 022. A writable folder you do not own (root's, for example) cannot be fixed that way:
the message then says to use a checkout under folders you own. Bun on PATH must be the version in
`package.json` `packageManager`. Launch refuses another Bun.

```bash
.xum/skills/verify-xum/scripts/verify-xum.sh launch
Expand Down
16 changes: 11 additions & 5 deletions .xum/skills/verify-xum/scripts/verify-xum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ group_is_ours() {
# replacement again and undoes the quoting.
refusal_fix() { # refusal_fix <fix> <folder>
[[ -n $1 ]] || return 0
printf ': %s%q%s' "${1%%@DIR@*}" "$2" "${1#*@DIR@}"
if [[ $1 == *@DIR@* ]]; then printf ': %s%q%s' "${1%%@DIR@*}" "$2" "${1#*@DIR@}"; else printf ': %s' "$1"; fi
}

# A run's state.env is sourced, so the run folder and the home above it must be real folders (no
Expand All @@ -114,8 +114,12 @@ require_safe_ancestors() { # require_safe_ancestors <path> [<what it is, for mes
owner=$(stat -c %u "$dir")
mode=$(stat -c %a "$dir")
[[ $owner == 0 || $owner == "$(id -u)" ]] || die "$dir, above $what, is owned by user $owner"
(((8#$mode & 8#022) == 0 || (8#$mode & 8#1000) != 0)) \
|| die "$dir, above $what, is writable by group or others and not sticky (mode $mode)$(refusal_fix "$fix" "$dir")"
if ! (((8#$mode & 8#022) == 0 || (8#$mode & 8#1000) != 0)); then
# Only the owner can chmod it: for a root-owned folder (a group-writable /usr/local, for
# example) the fix is to move the checkout.
[[ $owner == "$(id -u)" || -z $fix ]] || fix="use a checkout under folders you own"
die "$dir, above $what, is writable by group or others and not sticky (mode $mode)$(refusal_fix "$fix" "$dir")"
fi
done
}

Expand Down Expand Up @@ -469,8 +473,10 @@ cmd_launch() {
mkdir -m 700 "$VERIFY_XUM_RUN/tmp"
require_private_dir "$VERIFY_XUM_RUN/tmp"
log="$VERIFY_XUM_RUN/server.log"
# Milliseconds: a stamp from earlier in the launch's own second is a stale build.
t0=$(date +%s%3N)
# Milliseconds: a stamp from earlier in the launch's own second is a stale build. From node,
# like the stamp itself (scripts/build-main-watch.js writes Date.now()): uutils date 0.8 ignores
# the width in %3N and prints nanoseconds, so no stamp would ever be newer.
t0=$(node -p 'Date.now()')

local env_without_live_xum=(env -i PATH="$PATH" HOME="$HOME" USER="${USER:-}" LANG="${LANG:-C.UTF-8}"
TERM=dumb TMPDIR="$VERIFY_XUM_RUN/tmp" XUM_MOCK_AI=1 XUM_DISABLE_TELEMETRY=1
Expand Down
Loading