File util-linux-script-man-doc-misuse.patch of Package util-linux.2662

commit ab52a8bcce2f01bb44d3c2266e19b32e9639084b
Author: Stanislav Brabec <sbrabec@suse.cz>
Date:   Fri Feb 13 19:59:22 2015 +0100

script.1: Improve documentation of non-interactive behavior

- use exit in .profile to avoid non-logged session after typing "exit"
- document that script can read more from stdin than the command inside:

echo -e 'script -c "read a b ; echo a=\$a b=\$b >defs.sh"\n1 2\necho Done' | sh
Script started, file is typescript
1 2
echo Done
Script done, file is typescript

commit 8fd4a7aa81d2bd65dd586a6c0de989d1abdae8a4
Author: Stanislav Brabec <sbrabec@suse.cz>
Date:   Wed Feb 11 15:07:52 2015 +0100

script: no logging for non-interactive shells

Karel Zak wrote:

> Would be better to learn people to fix their shell initialization
> files to not call script(1) for non-interactive sessions?

It makes sense.

From 8fff32e65399ae07f70e12568d4d5278725673a7 Mon Sep 17 00:00:00 2001
From: Stanislav Brabec <sbrabec@suse.cz>
Date: Wed, 11 Feb 2015 15:02:10 +0100
Subject: [PATCH] script.1: Document behavior in non-interactive shells

And discourage users from such use.

Index: util-linux-2.25/term-utils/script.1
===================================================================
--- util-linux-2.25.orig/term-utils/script.1
+++ util-linux-2.25/term-utils/script.1
@@ -121,6 +121,32 @@ create garbage in the typescript file.
 .B script
 works best with commands that do not manipulate the screen, the results are
 meant to emulate a hardcopy terminal.
+.PP
+It is not recommended to run
+.B script
+in non-interactive shells. The inner shell of
+.B script
+is always interactive, and this could lead to unexpected results. If you use
+.B script
+in the shell initialization file, you have to avoid entering an infinite
+loop. Use e. g. profile file, which is read by login shells only:
+.RS
+.RE
+.sp
+.na
+.RS
+.nf
+if test -t 0 ; then
+    script
+    exit
+fi
+.fi
+.RE
+.PP
+You should also avoid use of script in command pipes, as
+.B script
+can read more input than you would expect.
+.PP
 .SH ENVIRONMENT
 The following environment variable is utilized by
 .BR script :
openSUSE Build Service is sponsored by