[ncurses] clear scrollback buffer in clear (#815790)

Miroslav Lichvar mlichvar at fedoraproject.org
Wed Jan 30 13:25:07 UTC 2013


commit bed93e2c35be5c637dadfe4272620e15c8b78d94
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Wed Jan 30 12:35:07 2013 +0100

    clear scrollback buffer in clear (#815790)

 ncurses-clear.patch |   34 ++++++++++++++++++++++++++++++++++
 ncurses.spec        |    3 +++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/ncurses-clear.patch b/ncurses-clear.patch
new file mode 100644
index 0000000..d82947c
--- /dev/null
+++ b/ncurses-clear.patch
@@ -0,0 +1,34 @@
+diff -up ncurses-5.9/man/clear.1.clear ncurses-5.9/man/clear.1
+--- ncurses-5.9/man/clear.1.clear	2010-12-04 19:36:44.000000000 +0100
++++ ncurses-5.9/man/clear.1	2013-01-30 12:33:06.140568071 +0100
+@@ -37,7 +37,10 @@
+ .SH DESCRIPTION
+ \fB at CLEAR@\fR clears your screen if this is possible.  It looks in the
+ environment for the terminal type and then in the \fBterminfo\fR database to
+-figure out how to clear the screen.
++figure out how to clear the screen.  Some terminals can clear also their
++scrollback buffer to prevent access to potentially sensitive data.  If the
++\fBterminfo\fR entry for the terminal type contains extended capability
++\fBE3\fR, \fB at CLEAR@\fR will use it to clear the scrollback buffer.
+ .PP
+ \fB at CLEAR@\fR ignores any command-line parameters that may be present.
+ .SH SEE ALSO
+diff -up ncurses-5.9/progs/clear.c.clear ncurses-5.9/progs/clear.c
+--- ncurses-5.9/progs/clear.c.clear	2007-10-14 00:16:02.000000000 +0200
++++ ncurses-5.9/progs/clear.c	2013-01-30 12:13:10.494509019 +0100
+@@ -52,7 +52,15 @@ main(
+ 	int argc GCC_UNUSED,
+ 	char *argv[]GCC_UNUSED)
+ {
++    char *E3;
++
+     setupterm((char *) 0, STDOUT_FILENO, (int *) 0);
++    
++    /* Clear the scrollback buffer if possible. */
++    E3 = tigetstr("E3");
++    if (E3 && E3 != CANCELLED_STRING)
++	tputs(E3, lines > 0 ? lines : 1, putch);
++
+     ExitProgram((tputs(clear_screen, lines > 0 ? lines : 1, putch) == ERR)
+ 		? EXIT_FAILURE
+ 		: EXIT_SUCCESS);
diff --git a/ncurses.spec b/ncurses.spec
index edc03d0..fa037ae 100644
--- a/ncurses.spec
+++ b/ncurses.spec
@@ -11,6 +11,7 @@ Patch1: ncurses-5.9-20120616-patch.sh.bz2
 Patch2: ncurses-5.9-20120622-20130126.patch.bz2
 Patch8: ncurses-config.patch
 Patch9: ncurses-libs.patch
+Patch10: ncurses-clear.patch
 Patch11: ncurses-urxvt.patch
 Patch12: ncurses-kbs.patch
 BuildRequires: gpm-devel pkgconfig
@@ -97,6 +98,8 @@ The ncurses-static package includes static libraries of the ncurses library.
 
 %patch8 -p1 -b .config
 %patch9 -p1 -b .libs
+# -b would add the backup to rpm
+%patch10 -p1
 %patch11 -p1 -b .urxvt
 %patch12 -p1 -b .kbs
 


More information about the scm-commits mailing list