Patchwork [2,of,6] hgrc.d: separate namespace for mercurial scripts 9diff and 9mail

login
register
mail settings
Submitter jas@corpus-callosum.com
Date Aug. 12, 2013, 11:01 p.m.
Message ID <c0fa3b1baa4c1fc96839.1376348468@acme.buf.io>
Download mbox | patch
Permalink /patch/2170/
State Accepted
Commit 0eead8bd0b300fb7668e06f414c3b247d9c7dfef
Headers show

Comments

jas@corpus-callosum.com - Aug. 12, 2013, 11:01 p.m.
# HG changeset patch
# User Jeff Sickel <jas@corpus-callosum.com>
# Date 1376347195 18000
#      Mon Aug 12 17:39:55 2013 -0500
# Branch stable
# Node ID c0fa3b1baa4c1fc968390c37400b08314808d115
# Parent  c662d9f71084020dc003d3b71804e426ef6640f3
hgrc.d: separate namespace for mercurial scripts 9diff and 9mail
Augie Fackler - Aug. 13, 2013, 8:55 p.m.
On Mon, Aug 12, 2013 at 06:01:08PM -0500, Jeff Sickel wrote:
> # HG changeset patch
> # User Jeff Sickel <jas@corpus-callosum.com>
> # Date 1376347195 18000
> #      Mon Aug 12 17:39:55 2013 -0500
> # Branch stable
> # Node ID c0fa3b1baa4c1fc968390c37400b08314808d115
> # Parent  c662d9f71084020dc003d3b71804e426ef6640f3
> hgrc.d: separate namespace for mercurial scripts 9diff and 9mail
>
> diff -r c662d9f71084 -r c0fa3b1baa4c contrib/plan9/hgrc.d/9diff.rc
> --- a/contrib/plan9/hgrc.d/9diff.rc	Mon Aug 12 17:36:49 2013 -0500
> +++ b/contrib/plan9/hgrc.d/9diff.rc	Mon Aug 12 17:39:55 2013 -0500
> @@ -4,4 +4,4 @@
>  extdiff =
>
>  [extdiff]
> -9diff = 9diff -cm $parent $child $root
> +9diff = /bin/mercurial/9diff -cm $parent $child $root

Why the change to the absolute path to 9diff? Is it a surety that
that's where 9diff will be installed (remember, I only know about
plan9 as a theoretical construct, I've never used it).

This feels like two patches: one to add the config for 9mail, and one
to point 9diff at the dedicated namespace?

> diff -r c662d9f71084 -r c0fa3b1baa4c contrib/plan9/hgrc.d/9mail.rc
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/contrib/plan9/hgrc.d/9mail.rc	Mon Aug 12 17:39:55 2013 -0500
> @@ -0,0 +1,4 @@
> +# The 9mail to support patchbomb and other email wrappers
> +[email]
> +method = /bin/mercurial/9mail
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
jas@corpus-callosum.com - Aug. 14, 2013, 1:23 a.m.
On Aug 13, 2013, at 3:55 PM, Augie Fackler <raf@durin42.com> wrote:

> On Mon, Aug 12, 2013 at 06:01:08PM -0500, Jeff Sickel wrote:
>> # HG changeset patch
>> # User Jeff Sickel <jas@corpus-callosum.com>
>> # Date 1376347195 18000
>> #      Mon Aug 12 17:39:55 2013 -0500
>> # Branch stable
>> # Node ID c0fa3b1baa4c1fc968390c37400b08314808d115
>> # Parent  c662d9f71084020dc003d3b71804e426ef6640f3
>> hgrc.d: separate namespace for mercurial scripts 9diff and 9mail
>> 
>> diff -r c662d9f71084 -r c0fa3b1baa4c contrib/plan9/hgrc.d/9diff.rc
>> --- a/contrib/plan9/hgrc.d/9diff.rc	Mon Aug 12 17:36:49 2013 -0500
>> +++ b/contrib/plan9/hgrc.d/9diff.rc	Mon Aug 12 17:39:55 2013 -0500
>> @@ -4,4 +4,4 @@
>> extdiff =
>> 
>> [extdiff]
>> -9diff = 9diff -cm $parent $child $root
>> +9diff = /bin/mercurial/9diff -cm $parent $child $root
> 
> Why the change to the absolute path to 9diff? Is it a surety that
> that's where 9diff will be installed (remember, I only know about
> plan9 as a theoretical construct, I've never used it).

Plan 9 doesn't use a path in the same way we think of it in
other UNIX-based systems.  It binds namespaces together and
the rc shell will execute from /bin or any full or referenced
path to the file:

	bonanza; ns | grep '/bin'
	bind  /amd64/bin /bin 
	bind -a /rc/bin /bin 
	bind -a /usr/jas/bin/rc /bin 
	bind -a /usr/jas/bin/amd64 /bin 

In our case the actual install of 9diff is in:

	/rc/bin/mercurial/9diff

It's perfectly valid to start a script or executable as

	mercurial/9diff

Unfortunately the python implementation does a small shim
to behave like the posixmodule, but really isn't.  It still
uses os.system() in mercurial/util.py:468, which starts up
the fake sh shell with no real PATH to handle the fact that
we wanted the mercurial scripts in a separate namespace from
the typical rc scripts.  Without the explicit path we end
up with the error:

	/bin/sh: mercurial/9diff: not found

I should probably provide a plan9 platform module instead of
using posixmodule.c, but as the bulk of the python scripts
out there already test for windows and posix, we'd really
like to not add to the confusion.



> This feels like two patches: one to add the config for 9mail, and one
> to point 9diff at the dedicated namespace?
> 
>> diff -r c662d9f71084 -r c0fa3b1baa4c contrib/plan9/hgrc.d/9mail.rc
>> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
>> +++ b/contrib/plan9/hgrc.d/9mail.rc	Mon Aug 12 17:39:55 2013 -0500
>> @@ -0,0 +1,4 @@
>> +# The 9mail to support patchbomb and other email wrappers
>> +[email]
>> +method = /bin/mercurial/9mail
>> +
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel


This could be broken up into two patches if you like.

Jeff
Augie Fackler - Aug. 15, 2013, 6:22 p.m.
On Aug 13, 2013, at 9:23 PM, Jeff Sickel <jas@corpus-callosum.com> wrote:

> 
> On Aug 13, 2013, at 3:55 PM, Augie Fackler <raf@durin42.com> wrote:
> 
>> On Mon, Aug 12, 2013 at 06:01:08PM -0500, Jeff Sickel wrote:
>>> # HG changeset patch
>>> # User Jeff Sickel <jas@corpus-callosum.com>
>>> # Date 1376347195 18000
>>> #      Mon Aug 12 17:39:55 2013 -0500
>>> # Branch stable
>>> # Node ID c0fa3b1baa4c1fc968390c37400b08314808d115
>>> # Parent  c662d9f71084020dc003d3b71804e426ef6640f3
>>> hgrc.d: separate namespace for mercurial scripts 9diff and 9mail
>>> 
>>> diff -r c662d9f71084 -r c0fa3b1baa4c contrib/plan9/hgrc.d/9diff.rc
>>> --- a/contrib/plan9/hgrc.d/9diff.rc	Mon Aug 12 17:36:49 2013 -0500
>>> +++ b/contrib/plan9/hgrc.d/9diff.rc	Mon Aug 12 17:39:55 2013 -0500
>>> @@ -4,4 +4,4 @@
>>> extdiff =
>>> 
>>> [extdiff]
>>> -9diff = 9diff -cm $parent $child $root
>>> +9diff = /bin/mercurial/9diff -cm $parent $child $root
>> 
>> Why the change to the absolute path to 9diff? Is it a surety that
>> that's where 9diff will be installed (remember, I only know about
>> plan9 as a theoretical construct, I've never used it).
> 
> Plan 9 doesn't use a path in the same way we think of it in
> other UNIX-based systems.  It binds namespaces together and
> the rc shell will execute from /bin or any full or referenced
> path to the file:
> 
> 	bonanza; ns | grep '/bin'
> 	bind  /amd64/bin /bin 
> 	bind -a /rc/bin /bin 
> 	bind -a /usr/jas/bin/rc /bin 
> 	bind -a /usr/jas/bin/amd64 /bin 
> 
> In our case the actual install of 9diff is in:
> 
> 	/rc/bin/mercurial/9diff
> 
> It's perfectly valid to start a script or executable as
> 
> 	mercurial/9diff

Fascinating. Queued.

> 
> Unfortunately the python implementation does a small shim
> to behave like the posixmodule, but really isn't.  It still
> uses os.system() in mercurial/util.py:468, which starts up
> the fake sh shell with no real PATH to handle the fact that
> we wanted the mercurial scripts in a separate namespace from
> the typical rc scripts.  Without the explicit path we end
> up with the error:
> 
> 	/bin/sh: mercurial/9diff: not found
> 
> I should probably provide a plan9 platform module instead of
> using posixmodule.c, but as the bulk of the python scripts
> out there already test for windows and posix, we'd really
> like to not add to the confusion.
> 
> 
> 
>> This feels like two patches: one to add the config for 9mail, and one
>> to point 9diff at the dedicated namespace?
>> 
>>> diff -r c662d9f71084 -r c0fa3b1baa4c contrib/plan9/hgrc.d/9mail.rc
>>> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
>>> +++ b/contrib/plan9/hgrc.d/9mail.rc	Mon Aug 12 17:39:55 2013 -0500
>>> @@ -0,0 +1,4 @@
>>> +# The 9mail to support patchbomb and other email wrappers
>>> +[email]
>>> +method = /bin/mercurial/9mail
>>> +
>>> _______________________________________________
>>> Mercurial-devel mailing list
>>> Mercurial-devel@selenic.com
>>> http://selenic.com/mailman/listinfo/mercurial-devel
> 
> 
> This could be broken up into two patches if you like.
> 
> Jeff
>

Patch

diff -r c662d9f71084 -r c0fa3b1baa4c contrib/plan9/hgrc.d/9diff.rc
--- a/contrib/plan9/hgrc.d/9diff.rc	Mon Aug 12 17:36:49 2013 -0500
+++ b/contrib/plan9/hgrc.d/9diff.rc	Mon Aug 12 17:39:55 2013 -0500
@@ -4,4 +4,4 @@ 
 extdiff =
 
 [extdiff]
-9diff = 9diff -cm $parent $child $root
+9diff = /bin/mercurial/9diff -cm $parent $child $root
diff -r c662d9f71084 -r c0fa3b1baa4c contrib/plan9/hgrc.d/9mail.rc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/plan9/hgrc.d/9mail.rc	Mon Aug 12 17:39:55 2013 -0500
@@ -0,0 +1,4 @@ 
+# The 9mail to support patchbomb and other email wrappers
+[email]
+method = /bin/mercurial/9mail
+