9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] mk clean on /sys/src/cmd/git
       [not found] <CAFMepcncyQE9JD5nbg3prFojBsnqJVGLG2rtwnGa45Fr3VM70w@mail.gmail.com>
@ 2025-07-23 22:12 ` ori
       [not found]   ` <038bc699-6fd0-41e3-a213-297b5b71c979@fjrhome.net>
  0 siblings, 1 reply; 6+ messages in thread
From: ori @ 2025-07-23 22:12 UTC (permalink / raw)
  To: 0intro, 9fans; +Cc: 9fans

on 9front, I think the default path is (/bin .), but I
think it's worth being a bit more robust. Done.

Quoth Kyohei Kadota via 9fans <9fans@9fans.net>:
> Hi, David.
> 
> I found, on /sys/src/cmd/git, mk clean exits with an usage error. For example:
> 
> % cd /sys/src/cmd/git
> % mk clean
> rm -f *.[568ijqv] *.a[568ijqv] y.tab.? lex.yy.c y.debug y.output
> [568ijqv].??* conf get fs log query repack save send serve walk
> $CLEANFILES
> usage: add [-r :remove] file ...
> mk: rm -f *.[568ijqv] ... : exit status=rc 3855: usage 3855: usage
> 
> There is /sys/src/cmd/git/rm and it's marked as executable so mk may
> refer to that.
> 
> Thus I would you like to merge the patch below. Is it possible to merge?
> 
> diff --git a/sys/src/cmd/git/mkfile b/sys/src/cmd/git/mkfile
> --- a/sys/src/cmd/git/mkfile
> +++ b/sys/src/cmd/git/mkfile
> @@ -1,4 +1,5 @@
>  </$objtype/mkfile
> +path=/bin
> 
> BIN=/$objtype/bin/git
> TARG=\

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb55aa78014f11ae0-M5a314881b64d88931f0b52fa
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] mk clean on /sys/src/cmd/git
       [not found]   ` <038bc699-6fd0-41e3-a213-297b5b71c979@fjrhome.net>
@ 2025-07-24 21:38     ` Dan Cross
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Cross @ 2025-07-24 21:38 UTC (permalink / raw)
  To: 9fans

On Thu, Jul 24, 2025 at 4:56 PM Frank D. Engel, Jr. <fde101@fjrhome.net> wrote:
> There is no concept of "path" in 9front/Plan9 - not needed due to union
> mounts.

Perhaps sadly, that's not true. `$path` is still a thing in `rc`; see
`/rc/lib/rcmain` or `echo $path` at the `rc` prompt. Ori is correct
that on 9front it's `(/bin .)`; on 9legacy it's worse, being `(.
/bin)` (that is, current dir first).

> You just mount additional directories on top of /bin to "merge" them at
> one location.

This is true, which is why $path defaults to the super minimal
definition from rcmain by default on 9front/plan9. But some folks
(myself included...) don't like having `.` in there, so setting it
manually isn't a bad thing. Note also that invoking rc as `rc -p` will
result in $path just being `/bin`, despite `-p` being documented as sa
no-op in the man page.

        - Dan C.

> On 7/23/25 18:12, ori@eigenstate.org wrote:
> > on 9front, I think the default path is (/bin .), but I
> > think it's worth being a bit more robust. Done.
> >
> > Quoth Kyohei Kadota via 9fans <9fans@9fans.net>:
> >> Hi, David.
> >>
> >> I found, on /sys/src/cmd/git, mk clean exits with an usage error. For example:
> >>
> >> % cd /sys/src/cmd/git
> >> % mk clean
> >> rm -f *.[568ijqv] *.a[568ijqv] y.tab.? lex.yy.c y.debug y.output
> >> [568ijqv].??* conf get fs log query repack save send serve walk
> >> $CLEANFILES
> >> usage: add [-r :remove] file ...
> >> mk: rm -f *.[568ijqv] ... : exit status=rc 3855: usage 3855: usage
> >>
> >> There is /sys/src/cmd/git/rm and it's marked as executable so mk may
> >> refer to that.
> >>
> >> Thus I would you like to merge the patch below. Is it possible to merge?
> >>
> >> diff --git a/sys/src/cmd/git/mkfile b/sys/src/cmd/git/mkfile
> >> --- a/sys/src/cmd/git/mkfile
> >> +++ b/sys/src/cmd/git/mkfile
> >> @@ -1,4 +1,5 @@
> >>   </$objtype/mkfile
> >> +path=/bin
> >>
> >> BIN=/$objtype/bin/git
> >> TARG=\
> > ------------------------------------------
> > 9fans: 9fans
> > Permalink: https://9fans.topicbox.com/groups/9fans/Tb55aa78014f11ae0-M5a314881b64d88931f0b52fa
> > Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb55aa78014f11ae0-Md20a2a5cf8c56db0eb32f119
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] mk clean on /sys/src/cmd/git
       [not found] <f463011f-c42b-4ac2-b643-c86f6775ad32@posixcafe.org>
@ 2025-07-25  4:22 ` ori
       [not found]   ` <17534197030.540fFDaf.10725@composer.9fans.topicbox.com>
  0 siblings, 1 reply; 6+ messages in thread
From: ori @ 2025-07-25  4:22 UTC (permalink / raw)
  To: 9fans

Yes, I'd say it's largely a historical mistake, and
we mostly ignore it, but it's there.

Quoth Jacob Moody <moody@posixcafe.org>:
> That's not true, rc has a $path, you can see for yourself:
> 
> cpu% echo $path
> /bin .
> 
> Most stuff does just use /bin, but for convenience rc also includes the cwd in $path.
> 
> On 7/24/25 15:54, Frank D. Engel, Jr. wrote:
> > There is no concept of "path" in 9front/Plan9 - not needed due to union 
> > mounts.
> > 
> > You just mount additional directories on top of /bin to "merge" them at 
> > one location.
> > 
> > 
> > On 7/23/25 18:12, ori@eigenstate.org wrote:
> >> on 9front, I think the default path is (/bin .), but I
> >> think it's worth being a bit more robust. Done.
> >>
> >> Quoth Kyohei Kadota via 9fans <9fans@9fans.net>:
> >>> Hi, David.
> >>>
> >>> I found, on /sys/src/cmd/git, mk clean exits with an usage error. For example:
> >>>
> >>> % cd /sys/src/cmd/git
> >>> % mk clean
> >>> rm -f *.[568ijqv] *.a[568ijqv] y.tab.? lex.yy.c y.debug y.output
> >>> [568ijqv].??* conf get fs log query repack save send serve walk
> >>> $CLEANFILES
> >>> usage: add [-r :remove] file ...
> >>> mk: rm -f *.[568ijqv] ... : exit status=rc 3855: usage 3855: usage
> >>>
> >>> There is /sys/src/cmd/git/rm and it's marked as executable so mk may
> >>> refer to that.
> >>>
> >>> Thus I would you like to merge the patch below. Is it possible to merge?
> >>>
> >>> diff --git a/sys/src/cmd/git/mkfile b/sys/src/cmd/git/mkfile
> >>> --- a/sys/src/cmd/git/mkfile
> >>> +++ b/sys/src/cmd/git/mkfile
> >>> @@ -1,4 +1,5 @@
> >>>   </$objtype/mkfile
> >>> +path=/bin
> >>>
> >>> BIN=/$objtype/bin/git
> >>> TARG=\
> >> ------------------------------------------
> >> 9fans: 9fans
> >> Permalink: https://9fans.topicbox.com/groups/9fans/Tb55aa78014f11ae0-M5a314881b64d88931f0b52fa
> >> Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb55aa78014f11ae0-Ma692fe3e5d6a6361d2f612d0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] mk clean on /sys/src/cmd/git
       [not found]   ` <17534197030.540fFDaf.10725@composer.9fans.topicbox.com>
@ 2025-07-25  8:46     ` Frank D. Engel, Jr.
  2025-07-27  5:09       ` thales.of.miletus
       [not found]       ` <F521A3FB77A0A59C1C384326952E6086@eigenstate.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Frank D. Engel, Jr. @ 2025-07-25  8:46 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 2617 bytes --]

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, miletus.thales.623@gmail.com 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

[-- Attachment #2: Type: text/html, Size: 3985 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] mk clean on /sys/src/cmd/git
  2025-07-25  8:46     ` Frank D. Engel, Jr.
@ 2025-07-27  5:09       ` thales.of.miletus
       [not found]       ` <F521A3FB77A0A59C1C384326952E6086@eigenstate.org>
  1 sibling, 0 replies; 6+ messages in thread
From: thales.of.miletus @ 2025-07-27  5:09 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

That is a good question. In many cases, it is true that you
can rebind /bin using commands such as:

bind /bin /oldbin
bind /newbin /bin

This works when the namespace is fully under the user’s
control. Plan 9’s namespace model supports it well.

However, this assumes a standalone setup. Plan 9 was not
designed as a local UNIX replacement. It was designed as a
distributed operating system. In that context, things work
differently.

On a terminal booted from a file server, /bin may be
mounted read-only from a remote CPU server. In that case, the
user cannot rebind it. Even if permitted, doing so may
conflict with shared system policies.

There are also cases where tools exist in user-specific
locations, or arrive later via mounts that are not part of
the initial boot namespace.

In such cases, changing $path is the correct and intended
solution. It affects only the current shell or script. It
preserves namespace integrity and avoids system-wide impact.

At the core is a design question. As the administrator, do
you want to use Plan 9 *as Plan 9*, or do you want to use it
*as a UNIX*?

Plan 9 encourages private namespaces, per-process resources,
and distributed services. Its shell tools, including $path,
support that model.

If you treat Plan 9 as a traditional single-machine system,
you may overlook features designed for a distributed world.

On Sun, Jul 27, 2025 at 6:20 AM Frank D. Engel, Jr. <fde101@fjrhome.net>
wrote:

> 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
>
> ?
>
>

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb55aa78014f11ae0-M9317b7986c78f3ab36458742
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 3756 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] mk clean on /sys/src/cmd/git
       [not found]       ` <F521A3FB77A0A59C1C384326952E6086@eigenstate.org>
@ 2025-07-27  5:23         ` thales.of.miletus
  0 siblings, 0 replies; 6+ messages in thread
From: thales.of.miletus @ 2025-07-27  5:23 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1933 bytes --]

The broader question is architectural in nature. Should
Plan 9 be employed as a conventional local system, or
should it be used as it was originally intended, as a
distributed environment in which each user maintains an
independent and potentially dynamic view of available
resources?

In configurations where only a single user is present,
this distinction may carry little practical consequence.
Under such conditions, the user retains full control over
the namespace and may structure it in any manner desired.

On Sun, Jul 27, 2025 at 12:39 PM <ori@eigenstate.org> wrote:

> Quoth Frank D. Engel, Jr. <fde101@fjrhome.net>:
> >
> > 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
> >
> > ?
> >
> 
> pretty sure you responded to an llm, and the llm lied to you; you
> should always be able to change /bin; $path is of very limited
> utility.
> 
> that said, there are things you can do with it that you can't do
> with binding to /bin:
> 
> 1) you can replace directories in /bin/ with binaries; we ship
> a /bin/git/compat script that uses this to put /n/gitcompat/git
> (a file) in front of /bin/git (a dir).
> 
> 2) it lets you have binaries relative to your cwd; the common
> example is '.', but you can do 'path=(/bin . bin) to have
> utility scripts in `{pwd}^/bin/project-specific-tools. I've
> never done this, or wanted to do this, but the popularity of
> direnv in some circles imply to me some people want this.
> 
> These are all hypothetical; I have never personally changed $path
> from the 9front default.
> 

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb55aa78014f11ae0-M28447dbb5e85dcde989f1c20
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 3481 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-28 15:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAFMepcncyQE9JD5nbg3prFojBsnqJVGLG2rtwnGa45Fr3VM70w@mail.gmail.com>
2025-07-23 22:12 ` [9fans] mk clean on /sys/src/cmd/git ori
     [not found]   ` <038bc699-6fd0-41e3-a213-297b5b71c979@fjrhome.net>
2025-07-24 21:38     ` Dan Cross
     [not found] <f463011f-c42b-4ac2-b643-c86f6775ad32@posixcafe.org>
2025-07-25  4:22 ` ori
     [not found]   ` <17534197030.540fFDaf.10725@composer.9fans.topicbox.com>
2025-07-25  8:46     ` Frank D. Engel, Jr.
2025-07-27  5:09       ` thales.of.miletus
     [not found]       ` <F521A3FB77A0A59C1C384326952E6086@eigenstate.org>
2025-07-27  5:23         ` thales.of.miletus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).