Skip to content

Commit d18d2ee

Browse files
committed
Fix rkati not using find emulator when checking stamp file
It was not recording shells as find emulator commands when writing the stamp file. This was causing extraneous reanalysis because the find emulator results that were ran the first time differ from running the find command as a regular shell command, which happened the second time.
1 parent cc552f5 commit d18d2ee

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

src-rs/func.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,11 @@ fn shell_func(args: &[Arc<Value>], ev: &mut Evaluator, out: &mut dyn BufMut) ->
667667
out.put_slice(&output);
668668
if should_store_command_result(&cmd) {
669669
COMMAND_RESULTS.lock().push(CommandResult {
670-
op: CommandOp::Shell,
670+
op: if fc.is_some() {
671+
CommandOp::Find
672+
} else {
673+
CommandOp::Shell
674+
},
671675
shell,
672676
shellflag: Bytes::from_static(shellflag),
673677
cmd,
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
set -euo pipefail
2+
3+
mk="$@"
4+
5+
# This tests behavior for a bug in the find emulator:
6+
# The *.xml and .* are not expanded despite not being quoted. So if the find emulator
7+
# weren't used, the find would fail with invalid arguments. Probably should fix this
8+
# in the future
9+
10+
mkdir -p bootable/recovery/tools/recovery_l10n/res/values/
11+
mkdir -p bootable/recovery/tools/recovery_l10n/res/layout/
12+
touch bootable/recovery/tools/recovery_l10n/res/values/strings.xml
13+
touch bootable/recovery/tools/recovery_l10n/res/layout/main.xml
14+
touch .cursorignore
15+
touch .gemini
16+
touch .repo
17+
18+
if echo "${mk}" | grep kati > /dev/null; then
19+
mk="${mk} --use_find_emulator"
20+
fi
21+
22+
cat <<EOF > Makefile
23+
resource_dir := bootable/recovery/tools/recovery_l10n/res/
24+
resource_dir_deps := \$(sort \$(shell find \$(resource_dir) -name *.xml -not -name .*))
25+
all: \$(resource_dir_deps)
26+
@echo Hello, world!
27+
EOF
28+
29+
${mk} 2>stderr_log
30+
if [ -e ninja.sh ]; then
31+
./ninja.sh
32+
fi
33+
34+
${mk} 2>stderr_log2
35+
if [ -e ninja.sh ]; then
36+
if grep regenerating stderr_log2 > /dev/null; then
37+
echo 'Should not regenerate'
38+
fi
39+
./ninja.sh
40+
fi

0 commit comments

Comments
 (0)