Repository navigation
Follow symlink starting points in omarchy-menu-file #12669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Bartok9
wants to merge
8
commits into
omacom:quattro
Choose a base branch
from
Bartok9:fix-menu-file-follow-symlinks
base: quattro
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ecb55a2
Follow symlink starting points in omarchy-menu-file
Bartok9 7dc2e18
Test that omarchy-menu-file follows symlink starting points
Bartok9 1cff89b
Fix menu-file symlink test path and byte-bound listing
Bartok9 b262555
Count menu-file path budget in C locale bytes
Bartok9 7b4db2a
Bound menu-select encoded options and clarify menu-file budget
Bartok9 1683136
Count menu-select options JSON size in C-locale bytes
Bartok9 4399b2f
Use find -H for menu-file symlink starts only
Bartok9 ce32b4e
Tighten menu-file symlink test for find -H only
Bartok9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" | ||
|
|
||
| tmp=$(mktemp -d) | ||
| trap 'rm -rf "$tmp"' EXIT | ||
|
|
||
| real="$tmp/real-videos" | ||
| link="$tmp/Videos" | ||
| nested_real="$tmp/elsewhere" | ||
| mkdir -p "$real" "$nested_real" | ||
| printf 'media' >"$real/clip.webm" | ||
| printf 'nested' >"$nested_real/nested.webm" | ||
| ln -s "$nested_real" "$real/nested-link" | ||
| ln -s "$real" "$link" | ||
|
|
||
| stub="$tmp/bin" | ||
| mkdir -p "$stub" | ||
| cat >"$stub/omarchy-menu-select" <<'STUB' | ||
| #!/bin/bash | ||
| # Consume stdin and print paths so the test can assert find -H starting-point behavior. | ||
| cat | ||
| STUB | ||
| chmod +x "$stub/omarchy-menu-select" | ||
|
|
||
| output=$(PATH="$stub:$PATH" "$ROOT/bin/omarchy-menu-file" "Select media" "$link" "webm") | ||
| [[ $output == *"$link/clip.webm"* ]] || fail "menu-file follows a symlink starting point" "$output" | ||
| # find -H must not walk nested symlinks inside the root (would list under -L). | ||
| [[ $output != *nested.webm* ]] || fail "menu-file must not follow nested symlinks inside roots" "$output" | ||
| pass "menu-file follows a symlink starting point without nested walks" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" | ||
|
|
||
| tmp=$(mktemp -d) | ||
| trap 'rm -rf "$tmp"' EXIT | ||
|
|
||
| stub="$tmp/bin" | ||
| mkdir -p "$stub" | ||
|
|
||
| cat >"$stub/omarchy-shell" <<'STUB' | ||
| #!/bin/bash | ||
| echo "omarchy-shell should not be reached for oversized options" >&2 | ||
| exit 99 | ||
| STUB | ||
| chmod +x "$stub/omarchy-shell" | ||
|
|
||
| # 80 options x ~1400 invalid bytes: ~112k characters after U+FFFD encode but | ||
| # ~337k bytes — fails under a character-length cap, passes with byte counting. | ||
| opts=() | ||
| i=1 | ||
| while [[ $i -le 80 ]]; do | ||
| name=$(python3 -c 'import sys; sys.stdout.buffer.write(b"n%03d-"%int(sys.argv[1])+b"\xff"*1400)' "$i") | ||
| opts+=("$name") | ||
| i=$((i + 1)) | ||
| done | ||
|
|
||
| set +e | ||
| err=$( | ||
| LC_ALL=C.UTF-8 PATH="$stub:$PATH" \ | ||
| "$ROOT/bin/omarchy-menu-select" "Pick" "${opts[@]}" 2>&1 | ||
| ) | ||
| rc=$? | ||
| set -e | ||
|
|
||
| [[ $rc -eq 1 ]] || fail "menu-select rejects oversized options under UTF-8 (exit $rc)" "$err" | ||
| [[ $err == *"options payload too large"* ]] || fail "menu-select oversized error message" "$err" | ||
| pass "menu-select rejects oversized encoded options by byte length under UTF-8" | ||
|
|
||
| cat >"$stub/omarchy-shell" <<'STUB' | ||
| #!/bin/bash | ||
| payload="$4" | ||
| done=$(printf '%s' "$payload" | perl -MJSON::PP=decode_json -e 'print decode_json(do { local $/; <STDIN> })->{doneFile}') | ||
| : >"$done" | ||
| exit 0 | ||
| STUB | ||
| chmod +x "$stub/omarchy-shell" | ||
|
|
||
| set +e | ||
| out=$(LC_ALL=C.UTF-8 PATH="$stub:$PATH" "$ROOT/bin/omarchy-menu-select" "Pick" "a" "b" 2>&1) | ||
| rc=$? | ||
| set -e | ||
| [[ $out != *"options payload too large"* ]] || fail "small menu should not hit byte budget" "$out" | ||
| [[ $rc -eq 1 ]] || fail "small menu empty selection exits 1" "status=$rc out=$out" | ||
| pass "menu-select small options pass byte budget under UTF-8" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new loop uses
[[ $i -le 80 ]], and both exit-code checks use[[ $rc -eq 1 ]]. The repository requires(( ))for numeric comparisons. Usewhile (( i <= 80 )); doand(( rc == 1 ))for those checks. This requirement must be satisfied before merging.File Used:
AGENTS.md(source)Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!