tcsh-org / tcsh

This is a read-only mirror of the tcsh code repository.
https://www.tcsh.org/
Other
232 stars 42 forks source link

Regression in :r #32

Closed alzwded closed 3 years ago

alzwded commented 3 years ago

Commit e43828d2382e8d5252634829a06a91816491f384 broke r

The following snippet now works like this:

set x='/a.b/c'
echo $x:r
# prints `/a' instead of `/a.b/c`

Previously, it printed /a.b/c as expected. :r removes the extension and returns the base name and path, not strip entire path elements. The current code doesn't stop when encountering a /.

alzwded commented 3 years ago

Test:

AT_SETUP([/a.b/c:r doesn't remove path elements])

AT_DATA([colon_r_no_extension.csh],
[[set x='/a.b/c'
echo $x:r
exit 0
]])

AT_CHECK([tcsh -f colon_r_no_extension.csh], 0,
[/a.b/c
])

AT_CLEANUP
zoulasc commented 3 years ago

Fixed, thanks!