9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Git and heritage (Was: Software preservation in the post-hg era)
@ 2020-03-31  7:43 Lucio De Re
  2020-04-04 16:15 ` cinap_lenrek
  0 siblings, 1 reply; 3+ messages in thread
From: Lucio De Re @ 2020-03-31  7:43 UTC (permalink / raw)
  To: 9fans; +Cc: Sean Hinchee

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

On 3/31/20, Sean Hinchee <henesy.dev@gmail.com> wrote:
> [ ... ]
> For now, as a stop-gap, I've made a GitHub organization in which I've
> consolidated most of what I had indexed from Bitbucket and a few other
> places.
>
> Thanks to people like Ori Bernstein, we have a native git client for
> plan9 [3]; without a native client, this kind of transition wouldn't
> be nearly as simple, thank you.
>
Ori's git9 is working better than adequately, although I tend to get
tangled up in its interface a lot. Which brings me to submit my
"enhancements" to 9front's "cmd/ssh.c"; these allow the Git URLs (a
subspecies, if my Git Bible is to go by) to be handled a little more
familiarly.

Quite correctly, Cinap, no doubt others, pointed out that Plan 9 has a
different representation for network addresses, one that seems better
designed. The change I applied to ssh.c does nothing to limit use of
the Plan 9 addressing style, it merely adds features that *do* belong
in the SSH context. The price is minimal: conflicting address
components may be supplied and something may break as a result, but
the expectation is that such breakage would be under interactive
supervision.

What I think swings the balance entirely in favour of adding the
enhancements is that Git likes to write URLs to the .git/config file
and as a result using Plan 9 addresses does make the config file
incompatible between Git as she is spoke and Plan 9's alternative. I
don't know about anyone else, but I live in a hybrid environment and I
fear this will bite me or someone I care about unnecessarily.

With the ssh.c enhancements and very minor tweaks to git9/proto.c (so
minor I'm having trouble finding them), one at least is able to avoid
incompatibilities (well, I'm hoping so).

I've attached the two patch sets, I make no claim to being a great
coder, the focus was to make the changes (a) as clear as possible, (b)
as unintrusive as possible.

The copy of 9front "ssh.c" I based my changes on may not be the most recent.

There's more to be said about converging the various Plan 9 flavours,
I continually find cause to regret the paths that have been chosen;
even though I am a faithful follower of the legacy system, I
appreciate divergence when it causes Plan 9 on my desktop to
interoperate better with the Posix and Posix-like systems I have
reason to use. But I think the convergence tool chest lies with Ori's
git9 and I would really like to assist making it not just robust, but
irresistible.

For that, my aim is to make it portable across all 9-flavours, very
much including p9p. I see no reason not to migrate to git9 everywhere
from the lesser Git ;-)

Lucio.

[-- Attachment #2: 9f.ssh.patch --]
[-- Type: text/x-patch, Size: 2436 bytes --]

% ape/diff -p ssh.c /n/dump/2020/0202/9front/sys/src/cmd/ssh.c
*** ssh.c	Sun Feb  2 08:34:12 2020
--- /n/dump/2020/0202/9front/sys/src/cmd/ssh.c	Sat Oct 28 18:57:42 2017
*************** uchar sid[256];
*** 81,87 ****
  char thumb[2*SHA2_256dlen+1], *thumbfile;
  
  int fd, intr, raw, debug;
! char *user, *service, *status, *host, *port, *cmd;
  
  Oneway recv, send;
  void dispatch(void);
--- 81,87 ----
  char thumb[2*SHA2_256dlen+1], *thumbfile;
  
  int fd, intr, raw, debug;
! char *user, *service, *status, *host, *cmd;
  
  Oneway recv, send;
  void dispatch(void);
*************** kfmt(Fmt *f)
*** 1133,1139 ****
  void
  usage(void)
  {
! 	fprint(2, "usage: %s [-dR] [-t thumbfile] [-T tries] [-u user] [-h] [-p port] [user@]host[:port] [cmd args...]\n", argv0);
  	exits("usage");
  }
  
--- 1133,1139 ----
  void
  usage(void)
  {
! 	fprint(2, "usage: %s [-dR] [-t thumbfile] [-T tries] [-u user] [-h] [user@]host [cmd args...]\n", argv0);
  	exits("usage");
  }
  
*************** main(int argc, char *argv[])
*** 1157,1171 ****
  	case 'd':
  		debug++;
  		break;
- 	case 'h':
- 		host = EARGF(usage());
- 		break;
- 	case 'p':
- 		port = EARGF(usage());
- 		break;
  	case 'R':
  		raw = 0;
  		break;
  	case 't':
  		thumbfile = EARGF(usage());
  		break;
--- 1157,1171 ----
  	case 'd':
  		debug++;
  		break;
  	case 'R':
  		raw = 0;
  		break;
+ 	case 'u':
+ 		user = EARGF(usage());
+ 		break;
+ 	case 'h':
+ 		host = EARGF(usage());
+ 		break;
  	case 't':
  		thumbfile = EARGF(usage());
  		break;
*************** main(int argc, char *argv[])
*** 1173,1181 ****
  		MaxPwTries = strtol(EARGF(usage()), &s, 0);
  		if(*s != 0) usage();
  		break;
- 	case 'u':
- 		user = EARGF(usage());
- 		break;
  	} ARGEND;
  
  	if(host == nil){
--- 1173,1178 ----
*************** main(int argc, char *argv[])
*** 1192,1205 ****
  			host = s;
  		}
  	}
- 	if(port == nil){
- 		port = "ssh";
- 		s = strchr(host, ':');
- 		if(s != nil){
- 			*s = '\0';
- 			port = s+1;
- 		}
- 	}
  
  	for(cmd = nil; *argv != nil; argv++){
  		if(cmd == nil){
--- 1189,1194 ----
*************** main(int argc, char *argv[])
*** 1212,1218 ****
  		}
  	}
  
! 	if((fd = dial(netmkaddr(host, nil, port), nil, nil, nil)) < 0)
  		sysfatal("dial: %r");
  
  	send.v = "SSH-2.0-(9)";
--- 1201,1207 ----
  		}
  	}
  
! 	if((fd = dial(netmkaddr(host, nil, "ssh"), nil, nil, nil)) < 0)
  		sysfatal("dial: %r");
  
  	send.v = "SSH-2.0-(9)";

[-- Attachment #3: git9.proto.patch --]
[-- Type: text/x-patch, Size: 1281 bytes --]

% ape/diff -p proto.c /n/dump/2020/0331/usr/lucio/Project/git9-master/proto.c
*** proto.c	Tue Mar 31 09:22:50 2020
--- /n/dump/2020/0331/usr/lucio/Project/git9-master/proto.c	Mon Mar 23 15:57:59 2020
***************
*** 1,6 ****
  #include <u.h>
  #include <libc.h>
- #include <stdio.h>
  
  #include "git.h"
  
--- 1,5 ----
*************** dialhttp(Conn *c, char *host, char *port
*** 232,241 ****
  }
  
  int
! dialssh(Conn *c, char *host, char *port, char *path, char *direction)
  {
  	int pid, pfd[2];
! 	char *target, cmd[64];
  
  	if(pipe(pfd) == -1)
  		sysfatal("unable to open pipe: %r");
--- 231,240 ----
  }
  
  int
! dialssh(Conn *c, char *host, char *, char *path, char *direction)
  {
  	int pid, pfd[2];
! 	char cmd[64];
  
  	if(pipe(pfd) == -1)
  		sysfatal("unable to open pipe: %r");
*************** dialssh(Conn *c, char *host, char *port,
*** 247,257 ****
  		dup(pfd[0], 0);
  		dup(pfd[0], 1);
  		snprint(cmd, sizeof(cmd), "git-%s-pack", direction);
- 		if (port != nil) {
- 			target = (char *) malloc(strlen(host) + 1 + strlen(port) + 1);
- 			sprintf(target, "%s:%s", host, port);
- 			host = target;
- 		}
  		if(chattygit)
  			fprint(2, "exec ssh %s %s %s\n", host, cmd, path);
  		execl("/bin/ssh", "ssh", host, cmd, path, nil);
--- 246,251 ----

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

end of thread, other threads:[~2020-04-05 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31  7:43 [9fans] Git and heritage (Was: Software preservation in the post-hg era) Lucio De Re
2020-04-04 16:15 ` cinap_lenrek
2020-04-05 17:44   ` Lucio De Re

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).