Opened 14 months ago
Closed 14 months ago
#18612 closed bug (fixed)
whence() in /etc/profile overrides ZSH builtin
Reported by: | zdykstra | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | System | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
The zsh
package sources /etc/profile
, which in turn defines whence()
. The problems with this are:
- ZSH already provides a built-in 'whence' command, so this function definition unnecessarily masks it.
- The function as it is currently defined does not even execute correctly under
/bin/zsh
, as it assumes it's operating underbash
, andzsh
sources the file while emulating the behavior ofksh
.
[master][~/source/haiku/data/etc]$ which zsh whence:type:30: bad option: -t whence:type:41: bad option: -t [master][~/source/haiku/data/etc]$ whence zsh whence:type:30: bad option: -t whence:type:41: bad option: -t
Looking back through the history of /etc/profile, it looks like whence()
has been there since the file was imported into SVN. There are Bash built-ins that perform everything whence
does, so the easiest path forward is to just remove this function from /etc/profile
. People can use the equivalent which/type/command functions under bash
.
Alternatively, an additional check condition can be added to https://cgit.haiku-os.org/haiku/tree/data/etc/profile#n50 to check if ZSH_VERSION
is defined and if it is, to not define whence()
. This is obviously more fragile, as it leaves the door open for additional problems of this nature to crop up going forward.
I'm happy to implement either option.
Change History (4)
comment:1 by , 14 months ago
comment:4 by , 14 months ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Unless there's some compatibility reason we need it, I'd support removing the function entirely.