diff -Nru bsd-mailx-8.1.2-0.20160123cvs/CVS/Entries bsd-mailx-8.1.2-0.20180807cvs/CVS/Entries --- bsd-mailx-8.1.2-0.20160123cvs/CVS/Entries 2016-01-23 09:08:27.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/CVS/Entries 2018-06-03 22:13:23.000000000 +0000 @@ -3,14 +3,11 @@ /pathnames.h/1.7/Tue Oct 14 12:50:21 2003// /rcv.h/1.3/Tue Oct 14 12:50:21 2003// /cmdtab.c/1.13/Thu Mar 11 14:08:18 2010// -/edit.c/1.19/Thu Mar 11 14:08:18 2010// /getname.c/1.8/Thu Mar 11 14:08:18 2010// /version.c/1.7/Thu Mar 11 14:08:19 2010// /cmd1.c/1.29/Sat Oct 15 06:41:40 2011// -/Makefile/1.10/Mon Aug 25 19:13:15 2014// /collect.c/1.34/Mon Aug 25 19:13:15 2014// /head.c/1.12/Mon Aug 25 19:13:16 2014// -/tty.c/1.20/Mon Aug 25 19:13:16 2014// /glob.h/1.8/Wed Dec 17 07:04:03 2014// /extern.h/1.28/Sun Mar 15 10:01:57 2015// /send.c/1.24/Sun Mar 15 10:01:59 2015// @@ -18,15 +15,18 @@ /cmd2.c/1.22/Mon Oct 26 07:54:39 2015// /cmd3.c/1.27/Mon Oct 26 07:54:39 2015// /def.h/1.16/Mon Oct 26 07:54:40 2015// -/fio.c/1.36/Mon Oct 26 07:54:40 2015// /lex.c/1.39/Mon Oct 26 07:54:40 2015// /list.c/1.20/Mon Oct 26 07:54:40 2015// -/mail.1/1.75/Mon Oct 26 07:54:40 2015// /names.c/1.23/Mon Oct 26 07:54:40 2015// /popen.c/1.38/Mon Oct 26 07:54:41 2015// /strings.c/1.10/Mon Oct 26 07:54:41 2015// -/temp.c/1.16/Mon Oct 26 07:54:41 2015// /vars.c/1.13/Mon Oct 26 07:54:41 2015// /main.c/1.33/Sat Jan 23 09:08:26 2016// -/quit.c/1.22/Sat Jan 23 09:08:26 2016// -/v7.local.c/1.16/Sat Jan 23 09:08:27 2016// +/Makefile/1.11/Fri May 6 19:34:29 2016// +/quit.c/1.23/Wed Aug 17 07:34:44 2016// +/temp.c/1.17/Wed Aug 17 07:34:44 2016// +/v7.local.c/1.17/Wed Aug 17 07:34:44 2016// +/edit.c/1.20/Sat Apr 29 07:17:47 2017// +/tty.c/1.21/Wed Jul 12 06:19:57 2017// +/fio.c/1.37/Sun Jun 3 22:13:22 2018// +/mail.1/1.79/Sun Jun 3 22:13:23 2018// diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/changelog bsd-mailx-8.1.2-0.20180807cvs/debian/changelog --- bsd-mailx-8.1.2-0.20160123cvs/debian/changelog 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/changelog 2018-08-08 21:12:01.000000000 +0000 @@ -1,3 +1,21 @@ +bsd-mailx (8.1.2-0.20180807cvs-1) unstable; urgency=medium + + * New upstream version from OpenBSD CVS repository. + * Add two new patches: + + 34-Fix-strnvis.patch for compatibility with future versions of + libbsd-dev; + + 35-Fix-new-warnings-and-error.patch to fix compilation error + and a few new warnings. + * Build with devhelper v11. + * Move source lintian overrides file to debian/source. + * Switch to https URLs in debian/copyright and debian/watch. + * debian/control: + + add `Rules-Requires-Root: no'; + + update Vcs-* fields for salsa migration; + + Standards-Version: 4.2.0. + + -- Robert Luberda Wed, 08 Aug 2018 23:12:01 +0200 + bsd-mailx (8.1.2-0.20160123cvs-4) unstable; urgency=medium * 33-Add-MIME-headers.patch: Add MIME headers to every mail to indicate diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/compat bsd-mailx-8.1.2-0.20180807cvs/debian/compat --- bsd-mailx-8.1.2-0.20160123cvs/debian/compat 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/compat 2018-08-08 21:12:01.000000000 +0000 @@ -1 +1 @@ -9 +11 diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/control bsd-mailx-8.1.2-0.20180807cvs/debian/control --- bsd-mailx-8.1.2-0.20160123cvs/debian/control 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/control 2018-08-08 21:12:01.000000000 +0000 @@ -2,13 +2,14 @@ Section: mail Priority: optional Maintainer: Robert Luberda -Standards-Version: 3.9.8 -Build-Depends: debhelper (>= 9), +Standards-Version: 4.2.0 +Build-Depends: debhelper (>= 11), groff, libbsd-dev (>= 0.8.1), liblockfile-dev (>= 1.05) -Vcs-Git: https://anonscm.debian.org/git/users/robert/bsd-mailx.git -Vcs-Browser: https://anonscm.debian.org/cgit/users/robert/bsd-mailx.git +Rules-Requires-Root: no +Vcs-Git: https://salsa.debian.org/debian/bsd-mailx.git +Vcs-Browser: https://salsa.debian.org/debian/bsd-mailx/ Package: bsd-mailx Architecture: any diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/copyright bsd-mailx-8.1.2-0.20180807cvs/debian/copyright --- bsd-mailx-8.1.2-0.20160123cvs/debian/copyright 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/copyright 2018-08-08 21:12:01.000000000 +0000 @@ -1,13 +1,13 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: OpenBSD -Source: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mail/ +Source: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mail/ Files: * Copyright: © 1980, 1993 The Regents of the University of California License: BSD-3-Clause Files: debian/* -Copyright: © 2001-2015 Robert Luberda +Copyright: © 2001-2018 Robert Luberda © 2001 Edward Betts © 2000 Wichert Akkerman © 2000 Paul Slootman diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/EXT/ChangeLog bsd-mailx-8.1.2-0.20180807cvs/debian/EXT/ChangeLog --- bsd-mailx-8.1.2-0.20160123cvs/debian/EXT/ChangeLog 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/EXT/ChangeLog 2018-08-08 21:12:01.000000000 +0000 @@ -1,3 +1,80 @@ +2018-04-26 12:42 guenther + + * fio.c: + + Use instead of for open() and friends. + Delete a bunch of unnecessary #includes and sort to match style(9) + while doing the above cleanup. + + ok deraadt@ krw@ + +2018-03-16 16:58 schwarze + + * mail.1: + + improve markup quality in the cases found by the new "--" style message + +2017-06-28 14:58 anton + + * tty.c: + + Replace usage of TIOCSTI in mail while editing headers using a more common + IO-loop where ICANON is disabled and a single char of input is read at a time. + This requires the line editing capabilities provided when ICANON is enabled to + be implemented. + + ok deraadt@ + +2017-05-29 12:50 jmc + + * mail.1: + + tweak previous to read a little better; + +2017-05-29 12:15 tedu + + * mail.1: + + remove mention of Berknet and mailaddr.7 + +2017-03-28 09:14 natano + + * edit.c: + + Prevent edit'ing a message from corrupting the mailbox. In an mbox file + every message is terminated by an empty line, so we have to make sure it + is preserved. Otherwise the message is combined with the next one. + + joint effort with deraadt and millert + +2016-07-28 21:37 tedu + + * mail.1, temp.c: + + these programs probably do not need to use TMPDIR. ok florian + +2016-07-19 06:43 deraadt + + * quit.c, v7.local.c: + + Cleanup close(open idioms. + ok krw + +2016-03-30 06:38 jmc + + * Makefile: + + for some time now mandoc has not required MLINKS to function + correctly - logically complete that now by removing MLINKS from base; + + authors need only to ensure there is an entry in NAME for any function/ + util being added. MLINKS will still work, and remain for perl to ease + upgrades; + + ok nicm (curses) bcook (ssl) + ok schwarze, who provided a lot of feedback and assistance + ok tb natano jung + 2015-11-24 00:08 deraadt * main.c: diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/00-Makefiles.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/00-Makefiles.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/00-Makefiles.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/00-Makefiles.patch 2018-08-08 21:12:01.000000000 +0000 @@ -4,16 +4,16 @@ Fix makefiles to make it possible to compile mailx on non-BSD systems. --- - Makefile | 33 ++++++++++++++++++++++++++++++--- + Makefile | 31 ++++++++++++++++++++++++++++++- USD.doc/Makefile | 14 +++++++++----- - 2 files changed, 39 insertions(+), 8 deletions(-) + 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile -index 9d08f89..ec663dd 100644 +index caf5408..260c8cc 100644 --- a/Makefile +++ b/Makefile -@@ -1,13 +1,22 @@ - # $OpenBSD: Makefile,v 1.10 2014/07/22 17:05:45 deraadt Exp $ +@@ -1,12 +1,23 @@ + # $OpenBSD: Makefile,v 1.11 2016/03/30 06:38:46 jmc Exp $ PROG= mail +CC ?= gcc @@ -29,15 +29,14 @@ + SFILES= mail.help mail.tildehelp EFILES= mail.rc --LINKS= ${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx --MLINKS= mail.1 Mail.1 mail.1 mailx.1 + LINKS= ${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx +MFILES= mail.1 + +all: $(PROG) distribution: cd ${.CURDIR}/misc; ${INSTALL} ${INSTALL_COPY} -o root -g wheel \ -@@ -15,4 +24,22 @@ distribution: +@@ -14,4 +25,22 @@ distribution: cd ${.CURDIR}/misc; ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \ -m 444 ${SFILES} ${DESTDIR}/usr/share/misc diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/01-Fix-includes.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/01-Fix-includes.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/01-Fix-includes.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/01-Fix-includes.patch 2018-08-08 21:12:01.000000000 +0000 @@ -29,7 +29,7 @@ #define APPEND /* New mail goes to end of mailbox */ diff --git a/edit.c b/edit.c -index cf14a37..d7a4732 100644 +index 226d36f..bbe0fb7 100644 --- a/edit.c +++ b/edit.c @@ -30,6 +30,12 @@ diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/02-Base-fixes-1.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/02-Base-fixes-1.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/02-Base-fixes-1.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/02-Base-fixes-1.patch 2018-08-08 21:12:01.000000000 +0000 @@ -73,7 +73,7 @@ * I guess we got it! */ diff --git a/mail.1 b/mail.1 -index f19780b..08ea3f9 100644 +index 9ce3506..fa40f46 100644 --- a/mail.1 +++ b/mail.1 @@ -298,7 +298,7 @@ The current list of such aliases can be displayed with the @@ -85,7 +85,7 @@ (see .Xr aliases 5 ) ; these are kept in a different syntax. -@@ -1212,7 +1212,7 @@ If the +@@ -1199,7 +1199,7 @@ If the environment variable is set, its value is used as the path to the user's mail spool. .Sh FILES @@ -94,7 +94,7 @@ .It Pa /var/mail/* post office (unless overridden by the .Ev MAIL -@@ -1225,7 +1225,7 @@ file giving initial mail commands; can be overridden by setting the +@@ -1212,7 +1212,7 @@ file giving initial mail commands; can be overridden by setting the environment variable .It Pa /tmp/R* temporary files diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/03-Base-fixes-2.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/03-Base-fixes-2.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/03-Base-fixes-2.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/03-Base-fixes-2.patch 2018-08-08 21:12:01.000000000 +0000 @@ -64,7 +64,7 @@ void stop(int); int stouch(void *); diff --git a/mail.1 b/mail.1 -index 08ea3f9..53582d6 100644 +index fa40f46..a4aa9a0 100644 --- a/mail.1 +++ b/mail.1 @@ -41,8 +41,8 @@ @@ -98,7 +98,7 @@ should be a comma separated list of names. .It Fl d Causes -@@ -1234,7 +1234,7 @@ system initialization file +@@ -1221,7 +1221,7 @@ system initialization file .Ex -std mail .Sh SEE ALSO .Xr fmt 1 , @@ -106,8 +106,8 @@ +.Xr newaliases 1 , .Xr vacation 1 , .Xr aliases 5 , - .Xr mailaddr 7 , -@@ -1276,9 +1276,9 @@ This man page is derived from the + .Xr mail.local 8 , +@@ -1262,9 +1262,9 @@ This man page is derived from the originally written by Kurt Shoens. .Sh BUGS Usually, diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/04-Add-custom-header.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/04-Add-custom-header.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/04-Add-custom-header.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/04-Add-custom-header.patch 2018-08-08 21:12:01.000000000 +0000 @@ -25,7 +25,7 @@ struct name *h_bcc; /* Blind carbon copies */ struct name *h_smopts; /* Sendmail options */ diff --git a/mail.1 b/mail.1 -index 53582d6..076dce8 100644 +index a4aa9a0..f09dc9f 100644 --- a/mail.1 +++ b/mail.1 @@ -41,6 +41,7 @@ @@ -48,7 +48,7 @@ .It Fl b Ar bcc-addr Send blind carbon copies to .Ar bcc-addr . -@@ -1264,7 +1270,7 @@ and are not supported by this implementation of +@@ -1250,7 +1256,7 @@ and are not supported by this implementation of .Nm mailx . .Pp The flags diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/05-Mailx-fixes.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/05-Mailx-fixes.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/05-Mailx-fixes.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/05-Mailx-fixes.patch 2018-08-08 21:12:01.000000000 +0000 @@ -5,7 +5,7 @@ mailx (1:8.1.1-10.1.3) frozen unstable; urgency=high * More security fixes - * Don't allow to set interactive in mailrc (or interactively) + * Don't allow one to set interactive in mailrc (or interactively) * Modify the variable-handling code to grok NULL values -- Wichert Akkerman Mon, 7 Aug 2000 17:22:57 -0700 @@ -38,10 +38,10 @@ int More(void *); int Pclose(FILE *); diff --git a/mail.1 b/mail.1 -index 076dce8..3639c02 100644 +index f09dc9f..f05fac4 100644 --- a/mail.1 +++ b/mail.1 -@@ -1207,10 +1207,17 @@ command; normally, the first five lines are printed. +@@ -1194,10 +1194,17 @@ command; normally, the first five lines are printed. utilizes the .Ev HOME , .Ev LOGNAME , diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/06-Use-lockf-instead-of-flock.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/06-Use-lockf-instead-of-flock.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/06-Use-lockf-instead-of-flock.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/06-Use-lockf-instead-of-flock.patch 2018-08-08 21:12:01.000000000 +0000 @@ -8,7 +8,7 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quit.c b/quit.c -index 29109ed..02c0303 100644 +index 0c47b1d..dcc59dc 100644 --- a/quit.c +++ b/quit.c @@ -96,7 +96,7 @@ quit(void) diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/09-Saved-mbox-message.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/09-Saved-mbox-message.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/09-Saved-mbox-message.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/09-Saved-mbox-message.patch 2018-08-08 21:12:01.000000000 +0000 @@ -9,10 +9,10 @@ 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quit.c b/quit.c -index 02c0303..7aad56b 100644 +index dcc59dc..4b10b24 100644 --- a/quit.c +++ b/quit.c -@@ -275,9 +275,9 @@ quit(void) +@@ -278,9 +278,9 @@ quit(void) } (void)Fclose(obuf); if (mcount == 1) diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/10-Reply-To-header.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/10-Reply-To-header.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/10-Reply-To-header.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/10-Reply-To-header.patch 2018-08-08 21:12:01.000000000 +0000 @@ -133,10 +133,10 @@ void makemessage(FILE *, int); void mark(int); diff --git a/mail.1 b/mail.1 -index 3639c02..912c622 100644 +index f05fac4..738b215 100644 --- a/mail.1 +++ b/mail.1 -@@ -853,6 +853,10 @@ Abort the message being sent, copying the message to +@@ -838,6 +838,10 @@ Abort the message being sent, copying the message to in your home directory if .Ic save is set. @@ -147,7 +147,7 @@ .Pp .It Ic ~r Ns Ar filename .It Ic ~< Ns Ar filename -@@ -1137,6 +1141,9 @@ variable is set. +@@ -1126,6 +1130,9 @@ variable is set. The default paginator .Xr more 1 is used if this option is not defined. @@ -157,7 +157,7 @@ .It Ev SHELL Pathname of the shell to use in the .Ic !\& -@@ -1213,7 +1220,8 @@ utilizes the +@@ -1200,7 +1207,8 @@ utilizes the .Ev PAGER , .Ev LISTER , .Ev EDITOR , diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/13-Mailx-concatenates-messages.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/13-Mailx-concatenates-messages.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/13-Mailx-concatenates-messages.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/13-Mailx-concatenates-messages.patch 2018-08-08 21:12:01.000000000 +0000 @@ -11,7 +11,7 @@ 1 file changed, 18 insertions(+) diff --git a/edit.c b/edit.c -index d7a4732..73cc915 100644 +index bbe0fb7..b928d11 100644 --- a/edit.c +++ b/edit.c @@ -112,6 +112,24 @@ edit1(int *msgvec, int type) diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/14-Truncate-mailbox-instead-of-deleting-it.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/14-Truncate-mailbox-instead-of-deleting-it.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/14-Truncate-mailbox-instead-of-deleting-it.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/14-Truncate-mailbox-instead-of-deleting-it.patch 2018-08-08 21:12:01.000000000 +0000 @@ -12,10 +12,10 @@ 2 files changed, 12 insertions(+) diff --git a/fio.c b/fio.c -index 8f30b9a..030298f 100644 +index 0a9cd26..faf1c37 100644 --- a/fio.c +++ b/fio.c -@@ -321,6 +321,14 @@ rm(char *name) +@@ -319,6 +319,14 @@ rm(char *name) errno = EISDIR; return(-1); } @@ -31,10 +31,10 @@ if (errno == EPERM) return(truncate(name, (off_t)0)); diff --git a/quit.c b/quit.c -index 7aad56b..e7452a5 100644 +index 4b10b24..8c446ac 100644 --- a/quit.c +++ b/quit.c -@@ -472,7 +472,11 @@ edstop(void) +@@ -475,7 +475,11 @@ edstop(void) (void)Fclose(obuf); if (gotcha) { (void)rm(mailname); diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/16-Stdin-not-a-tty.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/16-Stdin-not-a-tty.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/16-Stdin-not-a-tty.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/16-Stdin-not-a-tty.patch 2018-08-08 21:12:01.000000000 +0000 @@ -9,10 +9,10 @@ 1 file changed, 4 insertions(+) diff --git a/tty.c b/tty.c -index 1942814..5ab6712 100644 +index 4f7057b..ab10bdb 100644 --- a/tty.c +++ b/tty.c -@@ -70,6 +70,10 @@ grabh(struct header *hp, int gflags) +@@ -85,6 +85,10 @@ grabh(struct header *hp, int gflags) char *s; int error; diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/20-Don-t-delete-temporary-file.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/20-Don-t-delete-temporary-file.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/20-Don-t-delete-temporary-file.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/20-Don-t-delete-temporary-file.patch 2018-08-08 21:12:01.000000000 +0000 @@ -10,10 +10,10 @@ 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/edit.c b/edit.c -index 73cc915..d951139 100644 +index b928d11..f75ed4f 100644 --- a/edit.c +++ b/edit.c -@@ -216,7 +216,22 @@ run_editor(FILE *fp, off_t size, int type, int readonly) +@@ -224,7 +224,22 @@ run_editor(FILE *fp, off_t size, int type, int readonly) edit = _PATH_VI; } if (editit(edit, tempname) == -1) { diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/21-Use-wordexpr-instead-of-echo.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/21-Use-wordexpr-instead-of-echo.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/21-Use-wordexpr-instead-of-echo.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/21-Use-wordexpr-instead-of-echo.patch 2018-08-08 21:12:01.000000000 +0000 @@ -11,10 +11,10 @@ 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/fio.c b/fio.c -index 030298f..ab91f3a 100644 +index faf1c37..26e34b6 100644 --- a/fio.c +++ b/fio.c -@@ -37,9 +37,15 @@ +@@ -35,9 +35,15 @@ #include #include #include @@ -30,7 +30,7 @@ /* * Mail -- a mail program * -@@ -420,11 +426,14 @@ fsize(FILE *iob) +@@ -418,11 +424,14 @@ fsize(FILE *iob) char * expand(char *name) { @@ -47,7 +47,7 @@ /* * The order of evaluation is "%" and "#" expand into constants. -@@ -458,9 +467,48 @@ expand(char *name) +@@ -456,9 +465,48 @@ expand(char *name) (void)snprintf(xname, sizeof(xname), "%s%s", homedir, name + 1); name = savestr(xname); } @@ -97,7 +97,7 @@ /* XXX - does not expand enviroment variables. */ switch (glob(name, flags, NULL, &names)) { case 0: -@@ -479,8 +527,8 @@ expand(char *name) +@@ -477,8 +525,8 @@ expand(char *name) fprintf(stderr, "\"%s\": Expansion failed.\n", name); break; } diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/22-Replace-newlines-with-spaces.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/22-Replace-newlines-with-spaces.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/22-Replace-newlines-with-spaces.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/22-Replace-newlines-with-spaces.patch 2018-08-08 21:12:01.000000000 +0000 @@ -2,7 +2,7 @@ Date: Thu, 3 May 2007 12:30:00 +0200 Subject: 22 Replace newlines with spaces -main.c: Replace with spaces any embeded newline passed in arguments +main.c: Replace with spaces any embedded newline passed in arguments for '-s' and '-a' options (closes: #419840). --- main.c | 6 ++++++ diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/29-Document-two-dashes-separator.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/29-Document-two-dashes-separator.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/29-Document-two-dashes-separator.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/29-Document-two-dashes-separator.patch 2018-08-08 21:12:01.000000000 +0000 @@ -11,7 +11,7 @@ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mail.1 b/mail.1 -index 912c622..b1bde8f 100644 +index 738b215..5683e56 100644 --- a/mail.1 +++ b/mail.1 @@ -46,6 +46,7 @@ diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/33-Add-MIME-headers.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/33-Add-MIME-headers.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/33-Add-MIME-headers.patch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/33-Add-MIME-headers.patch 2018-08-08 21:12:01.000000000 +0000 @@ -21,7 +21,7 @@ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/mail.1 b/mail.1 -index b1bde8f..88949be 100644 +index 5683e56..f429557 100644 --- a/mail.1 +++ b/mail.1 @@ -67,7 +67,13 @@ The options are as follows: @@ -63,9 +63,9 @@ +.Dl $ mail -a 'Content-Type: text/plain; charset="ISO-8859-1"' +sets header indicating legacy character encoding. +.Pp - .Ss Network mail (ARPA, UUCP, Berknet) - See - .Xr mailaddr 7 + .Sh SUMMARY + (Adapted from the + .Dq Mail Reference Manual . ) diff --git a/main.c b/main.c index 07ad856..4cba833 100644 --- a/main.c diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/34-Fix-strnvis.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/34-Fix-strnvis.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/34-Fix-strnvis.patch 1970-01-01 00:00:00.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/34-Fix-strnvis.patch 2018-08-08 21:12:01.000000000 +0000 @@ -0,0 +1,57 @@ +From: Robert Luberda +Date: Tue, 7 Aug 2018 22:37:26 +0200 +Subject: Fix calls to strnvis + +Define LIBBSD_NETBSD_VIS macro, and re-order arguments of strnvis +calls to fix warnings caused by incompatibilities with future +versions of libbsd, as documented in the following comment +from /usr/include/bsd/vis.h: + +/* + * NetBSD added an strnvis and unfortunately made it incompatible with the + * existing one in OpenBSD and Freedesktop's libbsd (the former having existed + * for over ten years). Despite this incompatibility being reported during + * development (see http://gnats.netbsd.org/44977) they still shipped it. + * Even more unfortunately FreeBSD and later MacOS picked up this incompatible + * implementation. + * + * Provide both implementations and default for now on the historical one to + * avoid breakage, we will switch to the NetBSD one in libbsd 0.10.0 or so. + * Define LIBBSD_NETBSD_VIS to switch to the NetBSD one now. + */ +--- + cmd1.c | 4 ++-- + def.h | 1 + + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/cmd1.c b/cmd1.c +index 1c7f748..19855c5 100644 +--- a/cmd1.c ++++ b/cmd1.c +@@ -226,12 +226,12 @@ printhead(int mesg) + else + /* from me - show TO */ + name = value("showto") != NULL && to ? to : from; +- strnvis(visname, name, sizeof(visname), VIS_SAFE|VIS_NOSLASH); ++ strnvis(visname, sizeof(visname), name, VIS_SAFE|VIS_NOSLASH); + if (name == to) + fmt = "%c%c%3d TO %-14.14s %16.16s %4d/%-5d %s"; + else + fmt = "%c%c%3d %-17.17s %16.16s %4d/%-5d %s"; +- strnvis(vissub, subjline, sizeof(vissub), VIS_SAFE|VIS_NOSLASH); ++ strnvis(vissub, sizeof(vissub), subjline, VIS_SAFE|VIS_NOSLASH); + /* hl.l_date was sanity-checked when read in. */ + snprintf(fmtline, sizeof(fmtline), fmt, curind, dispc, mesg, visname, + hl.l_date, mp->m_lines, mp->m_size, vissub); +diff --git a/def.h b/def.h +index 6e57220..d7f6521 100644 +--- a/def.h ++++ b/def.h +@@ -54,6 +54,7 @@ + #include + #include + #include ++#define LIBBSD_NETBSD_VIS + #include + #include + #include "pathnames.h" diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/35-Fix-new-warnings-and-error.patch bsd-mailx-8.1.2-0.20180807cvs/debian/patches/35-Fix-new-warnings-and-error.patch --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/35-Fix-new-warnings-and-error.patch 1970-01-01 00:00:00.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/35-Fix-new-warnings-and-error.patch 2018-08-08 21:12:01.000000000 +0000 @@ -0,0 +1,100 @@ +From: Robert Luberda +Date: Tue, 7 Aug 2018 22:42:45 +0200 +Subject: Fix compilation issues + +Fix the following gcc issues: +- disable code that references to ALTWERASE that is not + defined on Debian; +- use 'char' rather than 'unsigned char' to get rid of warnings + about unsigned/signed conversions; +- check result of snprintf calls to fix `output might be + truncated' warnings. +--- + fio.c | 4 ++-- + popen.c | 6 +++++- + tty.c | 10 ++++++---- + 3 files changed, 13 insertions(+), 7 deletions(-) + +diff --git a/fio.c b/fio.c +index 26e34b6..35bcdd1 100644 +--- a/fio.c ++++ b/fio.c +@@ -456,8 +456,8 @@ expand(char *name) + name = "~/mbox"; + /* fall through */ + } +- if (name[0] == '+' && getfold(cmdbuf, sizeof(cmdbuf)) >= 0) { +- (void)snprintf(xname, sizeof(xname), "%s/%s", cmdbuf, name + 1); ++ if (name[0] == '+' && getfold(cmdbuf, sizeof(cmdbuf)) >= 0 && ++ snprintf(xname, sizeof(xname), "%s/%s", cmdbuf, name + 1) < sizeof(xname)) { + name = savestr(xname); + } + /* catch the most common shell meta character */ +diff --git a/popen.c b/popen.c +index 92b14b0..5ed33cf 100644 +--- a/popen.c ++++ b/popen.c +@@ -481,7 +481,11 @@ handle_spool_locks(int action) + int retval; + char lockpath[PATHSIZE]; + +- snprintf(lockpath, PATHSIZE - 1, "%s.lock", mailname); ++ if (snprintf(lockpath, PATHSIZE - 1, "%s.lock", mailname) >= PATHSIZE) ++ { ++ warnx("Cannot create lock file for %s: %s", mailname, "Path too long"); ++ return(1); ++ } + lockpath[PATHSIZE - 1] = '\0'; + + if (action == 0) { +diff --git a/tty.c b/tty.c +index ab10bdb..67d8a0f 100644 +--- a/tty.c ++++ b/tty.c +@@ -104,8 +104,10 @@ grabh(struct header *hp, int gflags) + return(-1); + } + tty.keys = oldtio.c_cc; ++#ifdef ALTWERASE + if (oldtio.c_lflag & ALTWERASE) + tty.flags |= TTY_ALTWERASE; ++#endif + + newtio = oldtio; + newtio.c_lflag &= ~(ECHO | ICANON); +@@ -175,7 +177,7 @@ char * + readtty(char *pr, char *src) + { + struct sigaction act, saveint; +- unsigned char canonb[BUFSIZ]; ++ char canonb[BUFSIZ]; + char *cp; + sigset_t oset; + int c, done; +@@ -327,7 +329,7 @@ static int + tty_getc(struct tty *t) + { + ssize_t n; +- unsigned char c; ++ char c; + + n = read(t->fdin, &c, 1); + switch (n) { +@@ -344,7 +346,7 @@ tty_getc(struct tty *t) + static int + tty_insert(struct tty *t, int c, int nocntrl) + { +- const unsigned char *ws = " \t"; ++ const char *ws = " \t"; + + if (CCEQ(t->keys[VERASE], c)) { + if (nocntrl) +@@ -380,7 +382,7 @@ tty_insert(struct tty *t, int c, int nocntrl) + static void + tty_putc(struct tty *t, int c) + { +- unsigned char cc = c; ++ char cc = c; + + write(t->fdout, &cc, 1); + } diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/patches/series bsd-mailx-8.1.2-0.20180807cvs/debian/patches/series --- bsd-mailx-8.1.2-0.20160123cvs/debian/patches/series 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/patches/series 2018-08-08 21:12:01.000000000 +0000 @@ -30,3 +30,5 @@ 31-Do-not-call-pledge.patch 32-Fix-FTBFS-on-Hurd.patch 33-Add-MIME-headers.patch +34-Fix-strnvis.patch +35-Fix-new-warnings-and-error.patch diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/rules bsd-mailx-8.1.2-0.20180807cvs/debian/rules --- bsd-mailx-8.1.2-0.20160123cvs/debian/rules 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/rules 2018-08-08 21:12:01.000000000 +0000 @@ -2,7 +2,7 @@ include /usr/share/dpkg/architecture.mk -export DEB_BUILD_MAINT_OPTIONS=hardening=+pie,+bindnow +export DEB_BUILD_MAINT_OPTIONS=hardening=+all export CFLAGS := -fPIC -Wall $(shell dpkg-buildflags --get CFLAGS) $(shell getconf LFS_CFLAGS) ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) @@ -12,7 +12,7 @@ endif %: - dh "$@" --parallel + dh "$@" override_dh_auto_clean: # Don't try to run make clean on unpatched version of Makefile diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/source/lintian-overrides bsd-mailx-8.1.2-0.20180807cvs/debian/source/lintian-overrides --- bsd-mailx-8.1.2-0.20160123cvs/debian/source/lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/source/lintian-overrides 2018-08-08 21:12:01.000000000 +0000 @@ -0,0 +1 @@ +bsd-mailx source: source-contains-cvs-control-dir diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/source.lintian-overrides bsd-mailx-8.1.2-0.20180807cvs/debian/source.lintian-overrides --- bsd-mailx-8.1.2-0.20160123cvs/debian/source.lintian-overrides 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/source.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -bsd-mailx source: source-contains-cvs-control-dir diff -Nru bsd-mailx-8.1.2-0.20160123cvs/debian/watch bsd-mailx-8.1.2-0.20180807cvs/debian/watch --- bsd-mailx-8.1.2-0.20160123cvs/debian/watch 2017-04-14 22:35:42.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/debian/watch 2018-08-08 21:12:01.000000000 +0000 @@ -1,7 +1,7 @@ version=3 # Note: mailx is part of OpenBSD base system, e.g. ftp://ftp.openbsd.org/pub/OpenBSD/5.5/src.tar.gz # Debian package is based on CVS version of the sources, see cvsweb interface -# on http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/usr.bin/mail/ +# on https://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/usr.bin/mail/ # It is not possible to extract the upstream version from neither of the above links, # so use the following link to the Debian repository just to make lintian and PTS happy. -ftp://ftp.debian.org/debian/pool/main/b/bsd-mailx/ bsd-mailx_(.*)\.orig\.tar\.bz2 +http://ftp.debian.org/debian/pool/main/b/bsd-mailx/ bsd-mailx_(.*)\.orig\.tar\.xz diff -Nru bsd-mailx-8.1.2-0.20160123cvs/edit.c bsd-mailx-8.1.2-0.20180807cvs/edit.c --- bsd-mailx-8.1.2-0.20160123cvs/edit.c 2010-03-11 14:08:18.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/edit.c 2017-04-29 07:17:47.000000000 +0000 @@ -1,4 +1,4 @@ -/* $OpenBSD: edit.c,v 1.19 2009/10/27 23:59:40 deraadt Exp $ */ +/* $OpenBSD: edit.c,v 1.20 2017/03/28 09:14:43 natano Exp $ */ /* $NetBSD: edit.c,v 1.5 1996/06/08 19:48:20 christos Exp $ */ /* @@ -76,7 +76,7 @@ int edit1(int *msgvec, int type) { - int c, i; + int nl = 0, c, i; FILE *fp; struct sigaction oact; sigset_t oset; @@ -115,11 +115,19 @@ mp->m_flag |= MODIFY; rewind(fp); while ((c = getc(fp)) != EOF) { - if (c == '\n') + if (c == '\n') { mp->m_lines++; + nl++; + } else + nl = 0; if (putc(c, otf) == EOF) break; } + for (; nl < 2; nl++) { + mp->m_lines++; + mp->m_size++; + putc('\n', otf); + } if (ferror(otf)) warn("%s", tmpdir); (void)Fclose(fp); diff -Nru bsd-mailx-8.1.2-0.20160123cvs/fio.c bsd-mailx-8.1.2-0.20180807cvs/fio.c --- bsd-mailx-8.1.2-0.20160123cvs/fio.c 2015-10-26 07:54:40.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/fio.c 2018-06-03 22:13:22.000000000 +0000 @@ -1,4 +1,4 @@ -/* $OpenBSD: fio.c,v 1.36 2015/10/16 18:21:43 mmcc Exp $ */ +/* $OpenBSD: fio.c,v 1.37 2018/04/26 12:42:51 guenther Exp $ */ /* $NetBSD: fio.c,v 1.8 1997/07/07 22:57:55 phil Exp $ */ /* @@ -31,8 +31,6 @@ */ #include "rcv.h" -#include -#include #include #include diff -Nru bsd-mailx-8.1.2-0.20160123cvs/mail.1 bsd-mailx-8.1.2-0.20180807cvs/mail.1 --- bsd-mailx-8.1.2-0.20160123cvs/mail.1 2015-10-26 07:54:40.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/mail.1 2018-06-03 22:13:23.000000000 +0000 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mail.1,v 1.75 2015/09/07 15:28:06 sobrado Exp $ +.\" $OpenBSD: mail.1,v 1.79 2018/03/16 16:58:26 schwarze Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)mail.1 8.8 (Berkeley) 4/28/95 .\" -.Dd $Mdocdate: September 7 2015 $ +.Dd $Mdocdate: March 16 2018 $ .Dt MAIL 1 .Os .Sh NAME @@ -351,20 +351,6 @@ .Ic expandaddr option is not set (the default), no expansion is performed and the recipient is treated as a local or network mail address. -.Ss Network mail (ARPA, UUCP, Berknet) -See -.Xr mailaddr 7 -for a description of network addresses. -.Pp -.Nm mail -has a number of options which can be set in the -.Pa .mailrc -file to alter its behavior; thus -.Ic set askcc -enables the -.Ar askcc -feature. -(These options are summarized below.) .Sh SUMMARY (Adapted from the .Dq Mail Reference Manual . ) @@ -372,7 +358,7 @@ Each command is typed on a line by itself, and may take arguments following the command word. The command need not be typed in its -entirety -- the first command which matches the typed prefix is used. +entirety \(em the first command which matches the typed prefix is used. For commands which take message lists as arguments, if no message list is given, then the next message forward which satisfies the command's requirements is used. @@ -573,8 +559,7 @@ .Pq Ic n (like .Ic + -or -.Tn CR ) +or CR) Goes to the next message in sequence and types it. With an argument list, types the next matching message. .It Ic preserve @@ -911,7 +896,11 @@ Simulate end of file on input. .El .Ss Mail options -Options are controlled via +A number of options can be set in the +.Pa .mailrc +file to alter the behavior of +.Nm , +controlled via the .Ic set and .Ic unset @@ -1139,8 +1128,6 @@ escape. A default shell is used if this option is not defined. -.It Ev TMPDIR -Directory in which temporary files are stored. .It Ev VISUAL Pathname of the text editor to use in the .Ic visual @@ -1237,7 +1224,6 @@ .Xr lockspool 1 , .Xr vacation 1 , .Xr aliases 5 , -.Xr mailaddr 7 , .Xr mail.local 8 , .Xr newaliases 8 , .Xr sendmail 8 , diff -Nru bsd-mailx-8.1.2-0.20160123cvs/Makefile bsd-mailx-8.1.2-0.20180807cvs/Makefile --- bsd-mailx-8.1.2-0.20160123cvs/Makefile 2014-08-25 19:13:15.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/Makefile 2016-05-06 19:34:29.000000000 +0000 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 2014/07/22 17:05:45 deraadt Exp $ +# $OpenBSD: Makefile,v 1.11 2016/03/30 06:38:46 jmc Exp $ PROG= mail SRCS= version.c aux.c cmd1.c cmd2.c cmd3.c cmdtab.c collect.c \ @@ -7,7 +7,6 @@ SFILES= mail.help mail.tildehelp EFILES= mail.rc LINKS= ${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx -MLINKS= mail.1 Mail.1 mail.1 mailx.1 distribution: cd ${.CURDIR}/misc; ${INSTALL} ${INSTALL_COPY} -o root -g wheel \ diff -Nru bsd-mailx-8.1.2-0.20160123cvs/quit.c bsd-mailx-8.1.2-0.20180807cvs/quit.c --- bsd-mailx-8.1.2-0.20160123cvs/quit.c 2016-01-23 09:08:26.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/quit.c 2016-08-17 07:34:44.000000000 +0000 @@ -1,4 +1,4 @@ -/* $OpenBSD: quit.c,v 1.22 2015/11/11 01:12:10 deraadt Exp $ */ +/* $OpenBSD: quit.c,v 1.23 2016/07/19 06:43:27 deraadt Exp $ */ /* $NetBSD: quit.c,v 1.6 1996/12/28 07:11:07 tls Exp $ */ /* @@ -188,6 +188,8 @@ mbox = expand("&"); mcount = c; if (value("append") == NULL) { + int fdx; + (void)snprintf(tempname, sizeof(tempname), "%s/mail.RmXXXXXXXXXX", tmpdir); if ((fd = mkstemp(tempname)) == -1 || @@ -220,7 +222,8 @@ return(-1); } (void)Fclose(obuf); - (void)close(open(mbox, O_CREAT | O_TRUNC | O_WRONLY, 0600)); + if ((fdx = open(mbox, O_CREAT | O_TRUNC | O_WRONLY, 0600)) != -1) + close(fdx); if ((obuf = Fopen(mbox, "r+")) == NULL) { warn("%s", mbox); (void)Fclose(ibuf); diff -Nru bsd-mailx-8.1.2-0.20160123cvs/temp.c bsd-mailx-8.1.2-0.20180807cvs/temp.c --- bsd-mailx-8.1.2-0.20160123cvs/temp.c 2015-10-26 07:54:41.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/temp.c 2016-08-17 07:34:44.000000000 +0000 @@ -1,4 +1,4 @@ -/* $OpenBSD: temp.c,v 1.16 2015/10/16 17:56:07 mmcc Exp $ */ +/* $OpenBSD: temp.c,v 1.17 2016/07/28 21:37:45 tedu Exp $ */ /* $NetBSD: temp.c,v 1.5 1996/06/08 19:48:42 christos Exp $ */ /* @@ -46,8 +46,7 @@ { char *cp; - if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0') - tmpdir = _PATH_TMP; + tmpdir = _PATH_TMP; if ((tmpdir = strdup(tmpdir)) == NULL) err(1, "strdup"); diff -Nru bsd-mailx-8.1.2-0.20160123cvs/tty.c bsd-mailx-8.1.2-0.20180807cvs/tty.c --- bsd-mailx-8.1.2-0.20160123cvs/tty.c 2014-08-25 19:13:16.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/tty.c 2017-07-12 06:19:57.000000000 +0000 @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.20 2014/01/17 18:42:30 okan Exp $ */ +/* $OpenBSD: tty.c,v 1.21 2017/06/28 14:58:23 anton Exp $ */ /* $NetBSD: tty.c,v 1.7 1997/07/09 05:25:46 mikel Exp $ */ /* @@ -40,12 +40,31 @@ #include "extern.h" #include #include +#include -static cc_t c_erase; /* Current erase char */ -static cc_t c_kill; /* Current kill char */ -#ifndef TIOCSTI -static int ttyset; /* We must now do erase/kill */ -#endif +#define TABWIDTH 8 + +struct tty { + int fdin; + int fdout; + int flags; +#define TTY_ALTWERASE 0x1 +#define TTY_ERR 0x2 + cc_t *keys; + char *buf; + size_t size; + size_t len; + size_t cursor; +}; + +static void tty_flush(struct tty *); +static int tty_getc(struct tty *); +static int tty_insert(struct tty *, int, int); +static void tty_putc(struct tty *, int); +static void tty_reset(struct tty *); +static void tty_visc(struct tty *, int); + +static struct tty tty; static volatile sig_atomic_t ttysignal; /* Interrupted by a signal? */ /* @@ -54,14 +73,10 @@ int grabh(struct header *hp, int gflags) { - struct termios ttybuf; -#ifndef TIOCSTI - struct sigaction savequit; -#else -# ifdef TIOCEXT + struct termios newtio, oldtio; +#ifdef TIOCEXT int extproc; int flag; -# endif /* TIOCEXT */ #endif struct sigaction savetstp; struct sigaction savettou; @@ -77,67 +92,53 @@ (void)sigaction(SIGTTOU, &act, &savettou); (void)sigaction(SIGTTIN, &act, &savettin); error = 1; -#ifndef TIOCSTI - ttyset = 0; -#endif - if (tcgetattr(fileno(stdin), &ttybuf) < 0) { + memset(&tty, 0, sizeof(tty)); + tty.fdin = fileno(stdin); + tty.fdout = fileno(stdout); + if (tcgetattr(tty.fdin, &oldtio) < 0) { warn("tcgetattr"); return(-1); } - c_erase = ttybuf.c_cc[VERASE]; - c_kill = ttybuf.c_cc[VKILL]; -#ifndef TIOCSTI - ttybuf.c_cc[VERASE] = 0; - ttybuf.c_cc[VKILL] = 0; - act.sa_handler = SIG_IGN; - if (sigaction(SIGQUIT, &act, &savequit) == 0 && - savequit.sa_handler == SIG_DFL) - (void)sigaction(SIGQUIT, &savequit, NULL); -#else -# ifdef TIOCEXT - extproc = ((ttybuf.c_lflag & EXTPROC) ? 1 : 0); + tty.keys = oldtio.c_cc; + if (oldtio.c_lflag & ALTWERASE) + tty.flags |= TTY_ALTWERASE; + + newtio = oldtio; + newtio.c_lflag &= ~(ECHO | ICANON); + newtio.c_cc[VMIN] = 1; + newtio.c_cc[VTIME] = 0; + if (tcsetattr(tty.fdin, TCSADRAIN, &newtio) < 0) { + warn("tcsetattr"); + return(-1); + } + +#ifdef TIOCEXT + extproc = ((oldtio.c_lflag & EXTPROC) ? 1 : 0); if (extproc) { flag = 0; if (ioctl(fileno(stdin), TIOCEXT, &flag) < 0) warn("TIOCEXT: off"); } -# endif /* TIOCEXT */ #endif if (gflags & GTO) { -#ifndef TIOCSTI - if (!ttyset && hp->h_to != NULL) - ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf); -#endif s = readtty("To: ", detract(hp->h_to, 0)); if (s == NULL) goto out; hp->h_to = extract(s, GTO); } if (gflags & GSUBJECT) { -#ifndef TIOCSTI - if (!ttyset && hp->h_subject != NULL) - ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf); -#endif s = readtty("Subject: ", hp->h_subject); if (s == NULL) goto out; hp->h_subject = s; } if (gflags & GCC) { -#ifndef TIOCSTI - if (!ttyset && hp->h_cc != NULL) - ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf); -#endif s = readtty("Cc: ", detract(hp->h_cc, 0)); if (s == NULL) goto out; hp->h_cc = extract(s, GCC); } if (gflags & GBCC) { -#ifndef TIOCSTI - if (!ttyset && hp->h_bcc != NULL) - ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf); -#endif s = readtty("Bcc: ", detract(hp->h_bcc, 0)); if (s == NULL) goto out; @@ -148,21 +149,15 @@ (void)sigaction(SIGTSTP, &savetstp, NULL); (void)sigaction(SIGTTOU, &savettou, NULL); (void)sigaction(SIGTTIN, &savettin, NULL); -#ifndef TIOCSTI - ttybuf.c_cc[VERASE] = c_erase; - ttybuf.c_cc[VKILL] = c_kill; - if (ttyset) - tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf); - (void)sigaction(SIGQUIT, &savequit, NULL); -#else -# ifdef TIOCEXT +#ifdef TIOCEXT if (extproc) { flag = 1; if (ioctl(fileno(stdin), TIOCEXT, &flag) < 0) warn("TIOCEXT: on"); } -# endif /* TIOCEXT */ #endif + if (tcsetattr(tty.fdin, TCSADRAIN, &oldtio) < 0) + warn("tcsetattr"); return(error); } @@ -176,38 +171,30 @@ readtty(char *pr, char *src) { struct sigaction act, saveint; - char ch, canonb[BUFSIZ]; - char *cp, *cp2; + unsigned char canonb[BUFSIZ]; + char *cp; sigset_t oset; - int c; + int c, done; + + memset(canonb, 0, sizeof(canonb)); + tty.buf = canonb; + tty.size = sizeof(canonb) - 1; + + for (cp = pr; *cp != '\0'; cp++) + tty_insert(&tty, *cp, 1); + tty_flush(&tty); + tty_reset(&tty); - fputs(pr, stdout); - fflush(stdout); if (src != NULL && strlen(src) > sizeof(canonb) - 2) { puts("too long to edit"); return(src); } -#ifndef TIOCSTI - if (src != NULL) - cp = copy(src, canonb); /* safe, bounds checked above */ - else - cp = copy("", canonb); - fputs(canonb, stdout); - fflush(stdout); -#else - cp = src == NULL ? "" : src; - while ((c = (unsigned char)*cp++) != '\0') { - if ((c_erase != _POSIX_VDISABLE && c == c_erase) || - (c_kill != _POSIX_VDISABLE && c == c_kill)) { - ch = '\\'; - ioctl(0, TIOCSTI, &ch); - } - ch = c; - ioctl(0, TIOCSTI, &ch); + if (src != NULL) { + for (cp = src; *cp != '\0'; cp++) + tty_insert(&tty, *cp, 1); + tty_flush(&tty); } - cp = canonb; - *cp = 0; -#endif + sigemptyset(&act.sa_mask); act.sa_flags = 0; /* Note: will not restart syscalls */ act.sa_handler = ttyint; @@ -217,15 +204,11 @@ (void)sigaction(SIGTTOU, &act, NULL); (void)sigaction(SIGTTIN, &act, NULL); (void)sigprocmask(SIG_UNBLOCK, &intset, &oset); - clearerr(stdin); - memset(cp, 0, canonb + sizeof(canonb) - cp); - for (cp2 = cp; cp2 < canonb + sizeof(canonb) - 1; ) { - c = getc(stdin); + for (;;) { + c = tty_getc(&tty); switch (ttysignal) { case SIGINT: - ttysignal = 0; - cp2 = NULL; - c = EOF; + tty_visc(&tty, '\003'); /* output ^C */ /* FALLTHROUGH */ case 0: break; @@ -233,9 +216,17 @@ ttysignal = 0; goto redo; } - if (c == EOF || c == '\n') + if (c == 0) { + done = 1; + } else if (c == '\n') { + tty_putc(&tty, c); + done = 1; + } else { + done = tty_insert(&tty, c, 0); + tty_flush(&tty); + } + if (done) break; - *cp2++ = c; } act.sa_handler = SIG_DFL; sigemptyset(&act.sa_mask); @@ -245,48 +236,17 @@ (void)sigaction(SIGTTOU, &act, NULL); (void)sigaction(SIGTTIN, &act, NULL); (void)sigaction(SIGINT, &saveint, NULL); - if (cp2 == NULL) - return(NULL); /* user hit ^C */ - *cp2 = '\0'; - if (c == EOF && ferror(stdin)) { + if (tty.flags & TTY_ERR) { + if (ttysignal == SIGINT) { + ttysignal = 0; + return(NULL); /* user hit ^C */ + } + redo: cp = strlen(canonb) > 0 ? canonb : NULL; - clearerr(stdin); /* XXX - make iterative, not recursive */ return(readtty(pr, cp)); } -#ifndef TIOCSTI - if (cp == NULL || *cp == '\0') - return(src); - cp2 = cp; - if (!ttyset) - return(strlen(canonb) > 0 ? savestr(canonb) : NULL); - while (*cp != '\0') { - c = (unsigned char)*cp++; - if (c_erase != _POSIX_VDISABLE && c == c_erase) { - if (cp2 == canonb) - continue; - if (cp2[-1] == '\\') { - cp2[-1] = c; - continue; - } - cp2--; - continue; - } - if (c_kill != _POSIX_VDISABLE && c == c_kill) { - if (cp2 == canonb) - continue; - if (cp2[-1] == '\\') { - cp2[-1] = c; - continue; - } - cp2 = canonb; - continue; - } - *cp2++ = c; - } - *cp2 = '\0'; -#endif if (equal("", canonb)) return(""); return(savestr(canonb)); @@ -328,3 +288,121 @@ ttysignal = s; } + +static void +tty_flush(struct tty *t) +{ + size_t i, len; + int c; + + if (t->cursor < t->len) { + for (; t->cursor < t->len; t->cursor++) + tty_visc(t, t->buf[t->cursor]); + } else if (t->cursor > t->len) { + len = t->cursor - t->len; + for (i = len; i > 0; i--) { + c = t->buf[--t->cursor]; + if (c == '\t') + len += TABWIDTH - 1; + else if (iscntrl(c)) + len++; /* account for leading ^ */ + } + for (i = 0; i < len; i++) + tty_putc(t, '\b'); + for (i = 0; i < len; i++) + tty_putc(t, ' '); + for (i = 0; i < len; i++) + tty_putc(t, '\b'); + t->cursor = t->len; + } + + t->buf[t->len] = '\0'; +} + +static int +tty_getc(struct tty *t) +{ + ssize_t n; + unsigned char c; + + n = read(t->fdin, &c, 1); + switch (n) { + case -1: + t->flags |= TTY_ERR; + /* FALLTHROUGH */ + case 0: + return 0; + default: + return c & 0x7f; + } +} + +static int +tty_insert(struct tty *t, int c, int nocntrl) +{ + const unsigned char *ws = " \t"; + + if (CCEQ(t->keys[VERASE], c)) { + if (nocntrl) + return 0; + if (t->len > 0) + t->len--; + } else if (CCEQ(t->keys[VWERASE], c)) { + if (nocntrl) + return 0; + for (; t->len > 0; t->len--) + if (strchr(ws, t->buf[t->len - 1]) == NULL + && ((t->flags & TTY_ALTWERASE) == 0 + || isalpha(t->buf[t->len - 1]))) + break; + for (; t->len > 0; t->len--) + if (strchr(ws, t->buf[t->len - 1]) != NULL + || ((t->flags & TTY_ALTWERASE) + && !isalpha(t->buf[t->len - 1]))) + break; + } else if (CCEQ(t->keys[VKILL], c)) { + if (nocntrl) + return 0; + t->len = 0; + } else { + if (t->len == t->size) + return 1; + t->buf[t->len++] = c; + } + + return 0; +} + +static void +tty_putc(struct tty *t, int c) +{ + unsigned char cc = c; + + write(t->fdout, &cc, 1); +} + +static void +tty_reset(struct tty *t) +{ + memset(t->buf, 0, t->len); + t->len = t->cursor = 0; +} + +static void +tty_visc(struct tty *t, int c) +{ + int i; + + if (c == '\t') { + for (i = 0; i < TABWIDTH; i++) + tty_putc(t, ' '); + } else if (iscntrl(c)) { + tty_putc(t, '^'); + if (c == 0x7F) + tty_putc(t, '?'); + else + tty_putc(t, (c | 0x40)); + } else { + tty_putc(t, c); + } +} diff -Nru bsd-mailx-8.1.2-0.20160123cvs/v7.local.c bsd-mailx-8.1.2-0.20180807cvs/v7.local.c --- bsd-mailx-8.1.2-0.20160123cvs/v7.local.c 2016-01-23 09:08:27.000000000 +0000 +++ bsd-mailx-8.1.2-0.20180807cvs/v7.local.c 2016-08-17 07:34:44.000000000 +0000 @@ -1,4 +1,4 @@ -/* $OpenBSD: v7.local.c,v 1.16 2015/11/11 01:12:10 deraadt Exp $ */ +/* $OpenBSD: v7.local.c,v 1.17 2016/07/19 06:43:27 deraadt Exp $ */ /* $NetBSD: v7.local.c,v 1.8 1997/05/13 06:15:58 mikel Exp $ */ /* @@ -70,9 +70,13 @@ void demail(void) { + int fd; - if (value("keep") != NULL || rm(mailname) < 0) - (void)close(open(mailname, O_CREAT | O_TRUNC | O_WRONLY, 0600)); + if (value("keep") != NULL || rm(mailname) < 0) { + fd = open(mailname, O_CREAT | O_TRUNC | O_WRONLY, 0600); + if (fd != -1) + close(fd); + } } /*