rakitzis / rc

rc shell -- independent re-implementation for Unix of the Plan 9 shell (from circa 1992)
Other
257 stars 23 forks source link

Incompatibility: Lack of implicit concatenation for `{} #80

Closed euclaise closed 1 year ago

euclaise commented 1 year ago

Background

Earlier today I ran a script I had tested for plan9port's rc, and instead of the intended behavior it deleted everything my user had perms to delete.

The issue is illustrated here in it's initial context: image

euclaise@thinkpad fort $ rc ./build.9rc                                                                                                                                                  git
rc: /root: Permission denied
rc: /work: No such file or directory
/bin /boot /dev /etc /home /lib /lib64 /lost+found /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var
/bin /boot /dev /etc /home /lib /lib64 /lost+found /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var
euclaise@thinkpad fort $ 9 rc ./build.9rc                                                                                                                                                git
/home/euclaise/Projects/fort/work/*
/home/euclaise/Projects/fort/root/*
euclaise@thinkpad fort $ cat build.9rc                                                                                                                                                   git
# This is a script for the Plan 9 'rc' shell.
# It is contained in the plan9port or 9base packages.
# Alternatively, it is sometimes available alone, such as in the AUR as 'rc'

root=`{pwd}/root
work=`{pwd}/work

echo $work/*
echo $root/*

exit

Details

The issue appears to be that plan9port's rc implicitly concatenates the `{pwd} and /root together, while this one doesn't:

euclaise@thinkpad fort $ rc                                                                                                                                                              git
; root=`{pwd}/root
rc: /root: Permission denied
euclaise@thinkpad fort $ 9 rc                                                                                                                                                            git
% root=`{pwd}/root
%
euclaise commented 1 year ago

Nevermind, this appears to be consistent with 9front's behavior. It's a plan9port bug then