Change a HYPHEN-MINUS (code 0x55, 2D) to a minus (\-), if in front of
1) a name of an option
2) a negative number to be printed.
See man-pages(7) [Debian package "manpages"].
The output from "nroff" is unchanged.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Add a comma (,) after "e.g." and "i.e.", or use English words
(man-pages(7) [package "manpages"]).
Abbreviation points should be protected (usually with the
non-printing, zero width character '\&') from being interpreted as an
end of sentence, if they are not, and that independent of their current
place on the line.
This is important when typing, as one does not usually know in
advance when the editor jumps to a new line.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Two-fonts macros are made for two or more arguments.
Remove space at end of lines in the files "term-utils/{script.1,
scriptlive.1, scriptreplay.1}".
Put "\-\-summary" to the correct indent in the file
"term-utils/script.1"
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
If agetty is compiled without support for ISSUEDIR, then it implements
a stub for `issuedir_read` that simply does nothing. In fact it does
too little, as it doesn't have a proper return statement even though the
function returns an integer.
Fix the issue by always returning `1` from `issuedir_read`. This
is the same error code that the real implementation of that function
returns in case it cannot open the directory and is thus a sensible
default to pretend that the directory doesn't exist.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
It some cases it makes sense to disable ECHO flag also when script
used in pipe. This new option allows to keep full control in user's
hands.
Signed-off-by: Karel Zak <kzak@redhat.com>
We need a proper way how to inform child (shell) that the game is
over. It seems the best is to send EOF to child rather than
immediately break PTY mainloop where we have poll(), because shell can
still produce data etc.
Signed-off-by: Karel Zak <kzak@redhat.com>
For tools like su(1) is ECHO flag unexpected for use-case like
echo 'date' | su - user
but script(1) need the echo to keep input recorded.
The patch also return execlp() use to script(1) code.
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's make life easier for admins and allow to review issue file
output on the current terminal without all full agetty execution. Use
case is pretty simple:
# $EDITOR /etc/issue
# agetty --show-issue
Addresses: https://github.com/karelzak/util-linux/issues/828
Signed-off-by: Karel Zak <kzak@redhat.com>
It's necessary to create signal-fd before fork() to get SIGCHLD,
because child could be faster than our code.
Signed-off-by: Karel Zak <kzak@redhat.com>
ul_pty code is able to do all necessary things for us, so don't waste
effort and keep the child variable in main() only.
Signed-off-by: Karel Zak <kzak@redhat.com>
Now the code is duplicate on many places, but all we usually need is to
remember child status. It seems good enough to have very simple
callback child_die() to inform application about a change.
The patch also add PID to all signal related callbacks.
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch consolidate pseudo-terminal stuff in util-linux. From now
there is only one implementation used in su(1) --pty, scriptlive(1)
and script(1).
The new stuff is based on the original script(1) -- it means poll()
and signalfd() based.
Note that script(1) code does not provide fallback for systems/libc
where is no openpty().
Signed-off-by: Karel Zak <kzak@redhat.com>
Add alias to -t,--timing to make it easy to copy and past script(1)
comnand line to scriptlive(1) and scriptreplay(1) command lines.
For example:
record:
$ script --log-timing tm --log-in in
print:
$ scriptreplay --log-timing tm --log-in in
re-run:
$ scriptlive --log-timing tm --log-in in
And command line is still the same.
Signed-off-by: Karel Zak <kzak@redhat.com>
After this change shell executed by scriptlive(1) is going to behave
like shell in script(1). It means that the shell stdin is a
pseudo-terminal rather than pipe. This allows live replay of
interactive applications, ssh sessions, etc.
Signed-off-by: Karel Zak <kzak@redhat.com>
* use timeval rather than double for delay
* use sys/time.h macros for wirk with timeval
* add delay normalization to script-playutils.c API
Signed-off-by: Karel Zak <kzak@redhat.com>
The new header/info lines in log uses 0, but it's unexpected by
scriptreplay as there was always number formatted by %f.
Signed-off-by: Karel Zak <kzak@redhat.com>
The old good scriptreplay(1) just display your recorded session, the
scriptlive(1) uses stdin typescript (from new script(1)) to execute
your commands again.
Signed-off-by: Karel Zak <kzak@redhat.com>
The stdin log does not contain line breaks as command line uses CR
between commands. This makes scriptreplay for stdin very
user-unfriendly, because it overwrites still the same line.
The new option --cr-mode provides opportunity to control this
behavior. The default for stdin logs is replace CR with line-break.
Signed-off-by: Karel Zak <kzak@redhat.com>
* add internal support for multiple log files
* add support for new timing file format (default is old format)
Signed-off-by: Karel Zak <kzak@redhat.com>
* allow to use --log-in <infile> and --log-out <outfile> in the same time
* add --log-io <file> to log stdout and stdin to the one log file
* introduce a new timing file format with entry type identifirs
I <delay> <size> : info about input stream
O <delay> <size> : info about output stream
in the next commits it's possible to add 'S' for signals and 'H' for
extra (header) information.
* the new file format is optional and enabled only if multiple streams
logging is requested.
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's allow to log input independently on output. So it's possible to
script --log-in infile : logs only input
script --log-out outfile : logs only output
script --log-out outfile --log-in infile : logs both to separated files
Signed-off-by: Karel Zak <kzak@redhat.com>
The current -t[=<file>] is pretty messy due to optional <file>
argument; and default is to output to stderr. The default output to
stderr is very unusual semantic. This path makes the old -t
deprecated.
The new option -T, --log-timing requires the file name.
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit does not add any new feature. It just prepare code for
future extensions only.
* introduce two new structs: script_stream and script_log
* define two streams: 'stdout' and 'stdin'
* allow associate log files (type script or timing file) with the stream
* support more log file formats
Signed-off-by: Karel Zak <kzak@redhat.com>
Sorry detail-oriented people tend to wipe these out if they notice them.
Add in automated tools and lots of excess end-of-line spaces get wiped
out.
Addresses: https://github.com/karelzak/util-linux/pull/849
Signed-off-by: Karel Zak <kzak@redhat.com>
usage:
* use --option[=<argument>] to make it obvious that '=' is required
* don't use [ ] for required arguments
* add separators to make it more readable
man page
* use --option=[<argument>] for optional arguments in man page
* don't use \fI or \fB for keywords based arguments (on|off|default ...)
* use the same style in all man page
Signed-off-by: Karel Zak <kzak@redhat.com>
Unfortunately methods I used to find and fix were based on quite manual
process that cannot be easily repeated so I do not see how this fix could be
turned into a tools/checkmans.sh addition. Well, lets hope doing this
manually twice every decade is good enough.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
There is a c_isascii function that can be used.
isascii is deprecated and not available with some libcs like uClibc-ng
where it can be compile time disabled.
Aim is to make dolog() a lot more readable and understandable, with downside
of when (rarely?) USE_SYSLOG it not defined the function will use a bit more
space from stack. I think that is price well worth paying.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
eval_issue_file() contains fflush(stdout). It comes from an old code that
used fputs() to write to the console.
In the new code, we write to a temporary memstream, and
fclose(ie->output) fully replaces possible fflush(ie->output) in this
implementation.
The new print_issue_file() does not need it as well, as it uses
unbuffered write_all().
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
The ttyname(3) can fail to access /dev/ path, and that will cause function
to fail without setting errno value with result of rather confusing error
message. Lets start setting stdin permission via /proc when this happens as
a go-around, with hope kernel following symlink does not fail. Ok, noted,
that hopes of symlink follow working are pretty slim.
Based on patch from Sami Kerola <kerolasa@iki.fi>.
Reference: https://github.com/lxc/lxd/issues/1724
Signed-off-by: Karel Zak <kzak@redhat.com>
Passing "default" to --ulcolor or --hbcolor worked, but it set the color to
bright red. This was not a documented syntax, so let's forbid it.
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
If the terminal is in the UTF-8 mode, get_logname() should use 8-bit
processing.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
As login supports non-ASCII characters in the logname, agetty should be
consistent.
8b58ffdd re-activated old and ASCII-only get_logname(), which restricted
the input to ASCII only. As the code does not read whole characters,
isascii(ascval) and isprint(ascval) returns nonsenses after entering a
non-ASCII character.
As keyboard maps don't contain unprintable non-control characters, it
seems to be relatively safe to remove both checks.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
misc-utils/hardlink.c:91:65: warning: declaration shadows a variable in the global scope [-Wshadow]
misc-utils/hardlink.c:73:5: note: previous declaration is here
int content_only = 0;
term-utils/wall.c:114:40: warning: declaration shadows a variable in the global scope [-Wshadow]
term-utils/wall.c:129:65: warning: declaration shadows a variable in the global scope [-Wshadow]
/usr/include/bits/getopt_core.h:36:14: note: previous declaration is here
extern char *optarg;
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
wall(1) may be used in scripts or in pipe. In this case report failed
ttyname() does not make sense, especially if the code does not depend
on on this function.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1608176
Signed-off-by: Karel Zak <kzak@redhat.com>
c094fcd37 introduced a behavior change: When Return is entered with empty
logname, nothing happens. As it confuses users, return back the old
behavior: re-prompt.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
When user starts to enter logname, 8b58ffdd blocks issue reloads.
Reloads remain blocked even if user deletes all typed characters.
Make things visually consistent: If no characters are entered,
re-enable reloads.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
Reviewed-by: Lubomir Rintel <lkundrak@v3.sk>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
The wait_for_term_input()'s select() needs to be tripped when the user
starts typing. Otherwise the reloads can abort an already in-progress login.
Coupled with \4 and \6 expansions that happen to be there on Fedora Server,
this means reload on every netlink event. With a couple of IPv6 routers
announcing their networks and temporary addresses in use can make it
sometimes virtually impossible to log in.
Seems like zero lflags do the job just fine on a Linux VT. Reset it to
canonical mode before running login.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>