[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

testing requested: tip/cu fixes



For those not reading bugs@ ...

	-Otto

---------- Forwarded message ----------
Date: Mon, 7 Mar 2005 08:07:37 +0100 (CET)
From: Otto Moerbeek <otto_(_at_)_drijf_(_dot_)_net>
To: Hugo Villeneuve <harpagon_(_at_)_jwales_(_dot_)_EINTR_(_dot_)_net>
Cc: Otto Moerbeek <otto_(_at_)_drijf_(_dot_)_net>, gnats_(_at_)_openbsd_(_dot_)_org
Subject: Re: user/4135: tip/cu "~t remotefrom [localto]" command use
    non-portable remote shell cmd.



On Mon, 7 Mar 2005, Hugo Villeneuve wrote:

> Whichever way you go, you'll need to add "close(fd);" in the if
> statement.  transfer() gets an already opened file via fd and have
> to close it.
> 
> Also, I got myself wandering why I wasn't geting "[EOT]" anymore
> on quiting with ~.
> 
> It's because of the new signal propagation between the tipin and
> tipout processes incorported in 3.6.
> 
> To get [EOT] back (and run tipabort() to the end), SIGTERM must be
> ignored before killing the tipout process.

that amounts to this, including your end of text command you originally 
sent in:

- detect illegal frame sizes
- fix file transfer when using emecs editing mode on the remote end
- print [EOT] on ~. again, by making tip_abort able to finish

Please test (others reading this too!),

Thanks,

	-Otto

Index: cmds.c
===================================================================
RCS file: /cvs/src/usr.bin/tip/cmds.c,v
retrieving revision 1.20
diff -u -p -r1.20 cmds.c
--- cmds.c	7 Nov 2004 09:48:08 -0000	1.20
+++ cmds.c	7 Mar 2005 07:00:21 -0000
@@ -112,7 +112,7 @@ cu_take(char cc)
 		printf("\r\n%s: cannot create\r\n", argv[1]);
 		return;
 	}
-	(void)snprintf(line, sizeof(line), "cat %s;echo \01", argv[0]);
+	(void)snprintf(line, sizeof(line), "cat %s;echo ''|tr '\\012' '\\01'", argv[0]);
 	transfer(line, fd, "\01");
 }
 
@@ -135,6 +135,12 @@ transfer(buf, fd, eofchars)
 	sig_t f;
 	char r;
 
+	if (number(value(FRAMESIZE)) > BUFSIZ || number(value(FRAMESIZE)) < 1) {
+		printf("framesize must be >= 1 and <= %d\r\n", BUFSIZ);
+		close(fd);
+		return;
+	}
+
 	parwrite(FD, buf, size(buf));
 	quit = 0;
 	kill(tipout_pid, SIGIOT);
@@ -642,6 +648,7 @@ tipabort(msg)
 	char *msg;
 {
 
+	signal(SIGTERM, SIG_IGN);
 	kill(tipout_pid, SIGTERM);
 	disconnect(msg);
 	if (msg != NOSTR)
Index: tip.1
===================================================================
RCS file: /cvs/src/usr.bin/tip/tip.1,v
retrieving revision 1.31
diff -u -p -r1.31 tip.1
--- tip.1	7 Nov 2004 18:19:53 -0000	1.31
+++ tip.1	7 Mar 2005 07:00:21 -0000
@@ -208,7 +208,7 @@ file defaults to the
 .Dq from
 file name if it isn't specified.
 The remote host executes the command string
-.Dq cat 'from';echo ^A
+.Dq cat 'from';echo ''|tr '\e012' '\e01'
 to send the file to
 .Nm tip .
 .It Ic \&~|



Visit your host, monkey.org