This is incomplete change. Working command requires the subsequent
select() to poll() change as well.
Addresses: https://github.com/karelzak/util-linux/pull/62
CC: Wolfgang Richter <wolf@cs.cmu.edu>
CC: Ruediger Meier <ruediger.meier@ga-group.nl>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
On s390 and other big endian machines, doinput() sends NUL instead of
EOF to the tty master. NUL does not even reach the slave, and it is
waiting for more data forever.
If STDIN is not a tty, the bug caused "^@" being into the log, and since
commit 032228c it also causes hang.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
This adds a concise description of a tool to its usage text.
A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Translating these text elements should happen only once, which is
more likely when the text macros are used properly.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Apparently James Hunts patch (which he provided a long time
ago) is no longer covering it all.
This followup patch also silences the "Script done ..." message
when --quiet is used.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Specifying 'script --quiet ...' still produces the 'Script started'
message in the typescript file. The --quiet option implies that the
script program should not log any of its output to the typescript file.
Originally reported at:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=693966
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Sometimes we use "behaviour" and "behavior" in the same text, let's
use "behavior" only everywhere.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1011068
Signed-off-by: Karel Zak <kzak@redhat.com>
* don't initialize timingfd (to stderr) when -t not specified
* care about timingfd dooutput() rather in main()
* make timingdf gloval like fscript FILE
* close all in done()
* close irrelevant things in subshell and input processes
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
If both -f and -t are given, flush the timing fd on each write, similar
to the behavior on the script fd. This allows playback of still-running
sessions, and reduces the risk of ending up with empty timing files when
script(1) exits abnormally.
Signed-off-by: Jesper Dahl Nyerup <nyerup@one.com>
- don't suppress "Script done" message in typescript file by -q
(note that -q has no effect to "Script started" message)
- simplify the code by poll()
Signed-off-by: Karel Zak <kzak@redhat.com>
The current code waits for empty file master and slave descriptors,
but it makes sense only if there is child process that cares (read)
about data in the descriptors.
Signed-off-by: Karel Zak <kzak@redhat.com>
echo "ps uf" | script
does not work because script assume that stdin is terminal and
it does not forward EOF to the pty.
This patch:
* make non-tty use-case more robust (don't call tty ioclts to
non-tty file descriptors.
* send EOF (CTL('D') control char) to the master channel when
detected eof by read() on stdin
* wait for empty master and slave file descriptors to be sure that
we don't miss date for typescript. This is also necessary to be
sure that slave channel (shell) is completely initialized otherwise
EOF is ignored.
Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
The commit cdd2a8c360 broke script(1)
return value.
$ script -e -c "echo"; echo $?
1
The reason, as Daniel it reported, was that the script will close stderr
twice, once as timing file and atexit() in function close_stdout(). This
commit fixes the problem.
Reported-by: Daniel Narvaez <dwnarvaez@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
We should only include the libintl.h when NLS is requested.
This fixes issue when building util-linux with uClibc.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
The type mismatch; doinput: int -> ssize_t
[kzak@redhat.com: - int -> pid_t,
- remove "register" keyword]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
The tool proposed;
script.c should add these lines:
script.c should remove these lines:
- #include <sys/file.h> // lines 53-53
- #include <sys/types.h> // lines 48-48
- #include "c.h" // lines 61-61
and the change nearly did what the tool told. We should keep on
using c.h, not err.h. The config.h is not needed, it's added
automaticly.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The --force will allow default output destination, e.g.
typescript file, to be hard or symbolic link.
[kzak@redhat.com: - remove "error:" prefix from errx()]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>