I saw something similar before, but unfortunately, the patch below
doesn't fix it.
cpu% fn 'file?' { test -f $* }
cpu% 'file?' /LICENSE
cpu% echo $status
cpu% 'file?' /foo
cpu% echo $status
test 145387: false
cpu% rc
cpu% 'file?' /LICENSE
rc: can't open /env/fn#file?: bad character in file name: '/env/fn#file?'
file?: '/bin/file?' file does not exist
cpu% 'file?' /LICENSE
file?: '/bin/file?' file does not exist
cpu% unicode
0001
cpu%
>> it appears something is going wrong
>> with rc's local assignments. ifs has the usual
>> value.
>>
>> ; font=/lib/font/bit/cyberbit/mod*.font rio
>> rio: can't access /lib/font/bit/cyberbit/mod*.font: bad character in file
>> name: '/lib/font/bit/cyberbit/mod*.font'
>> ; unicode
>> 0001
>> ; echo /lib/font/bit/cyberbit/mod*.font
>> /lib/font/bit/cyberbit/mod14.font
>> ; x=/lib/font/bit/cyberbit/mod*.font
>> ; whatis x
>> x=/lib/font/bit/cyberbit/mod14.font
>
> % diff -c /n/sources/plan9/sys/src/cmd/rc/exec.c .
> /n/sources/plan9/sys/src/cmd/rc/exec.c:751,759 - ./exec.c:751,761
> }
> deglob(runq->argv->words->word);
> runq->local = newvar(strdup(runq->argv->words->word), runq->local);
> - runq->local->val = copywords(runq->argv->next->words, (word *)0);
> - runq->local->changed = 1;
> poplist();
> + globlist();
> + runq->local->val = runq->argv->words;
> + runq->local->changed = 1;
> + runq->argv->words = 0;
> poplist();
> }
>
> %