Interesting...  always learning something new.

However, how do you wind up in a situation in which you can't change /bin?


Worst case couldn't you just:

    bind /bin /oldbin

    bind /newbin /bin

?


On 7/25/25 01:01, [email protected] wrote:
I would like to clarify the role of |$path| in Plan 9 and in
9front. Some have said that Plan 9 has no concept of path,
due to the use of union mounts. This is not accurate.
The shell in Plan 9, called |rc|, uses a variable named
|$path| to locate commands. This variable is defined in
|/rc/lib/rcmain|. You can check its value by running
|echo $path| in any shell session.
On 9front, the default value is |(/bin .)|. On 9legacy, it is
|(. /bin)|. These values mean the shell will look for
commands in |/bin| and the current directory. If |.| comes
first, a command in the current directory may override a
system tool.
This is what happened in the |mk clean| example in
|/sys/src/cmd/git|. The script tried to run |rm|, but there
was a local file named |rm|. Because |.| came before |/bin|,
the local file was run instead of the system |rm|.
Plan 9 was designed as a distributed operating system. It was
not designed to be a better Unix. Each process in Plan 9 has
its own namespace. This means each process may see different
directories and files in |/bin|.
In such a system, |$path| is not a leftover from Unix. It is
a useful and necessary feature. It lets each shell find
commands from different locations without changing the
namespace.
Union mounts are still useful. They let you combine multiple
directories into |/bin|. But sometimes |/bin| cannot be
changed. It may be read-only or controlled by the file
server. In these cases, changing |$path| is the right tool.
To conclude, |$path| is part of how Plan 9 works. It fits the
design of the system. It lets users control command lookup
without changing the system for everyone else.

*9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions <https://9fans.topicbox.com/groups/9fans> + participants <https://9fans.topicbox.com/groups/9fans/members> + delivery options <https://9fans.topicbox.com/groups/9fans/subscription> Permalink <https://9fans.topicbox.com/groups/9fans/Tb55aa78014f11ae0-M0a708b064090b7293eaa3287>
------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tb55aa78014f11ae0-Mde87223e7e41b0b77b755880
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to