Commit Graph

663 Commits

Author SHA1 Message Date
Yuri Chornoivan dc62fffc05
Fix minor typo: aliast -> alias 2020-01-08 18:43:22 +02:00
Yuri Chornoivan 760ecc3613
Fix minor typo: ussuported -> unsupported 2020-01-08 18:26:14 +02:00
Karel Zak 9418ba6d05 agetty: keep freed issue file pointer zeroized
References: https://bugzilla.redhat.com/show_bug.cgi?id=1784536
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-20 15:05:33 +01:00
Bjarni Ingi Gislason 1c4c602427 man pages: Change a HYPHEN-MINUS (-) to a minus (\-) for options and numbers
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>
2019-12-17 12:32:43 +01:00
Bjarni Ingi Gislason eb02489380 man pages: Add a comma after "e.g." and "i.e."
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>
2019-12-17 12:32:43 +01:00
Bjarni Ingi Gislason 2fb684f004 man pages: Fix misuse of two-fonts macros
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>
2019-12-17 12:32:43 +01:00
Karel Zak 3d3280ef15 Merge branch 'release-prep' of https://github.com/kerolasa/util-linux 2019-12-12 12:39:18 +01:00
Patrick Steinhardt c0274f8add agetty: return proper value if compiled without ISSUEDIR support
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>
2019-12-12 12:22:28 +01:00
Sami Kerola ac407b1650
script: fix typos [codespell]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-12-11 19:53:14 +00:00
Sami Kerola 543f6b6cfc
man: improve script and scriptreplay formatting style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-12-11 19:52:20 +00:00
Karel Zak 4af92de983 build-sys: remove duplicate includes
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-10 13:50:18 +01:00
Karel Zak 8e0b90e012 script: document SIGUSR1
Based on pull request: https://github.com/karelzak/util-linux/pull/815

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-09 16:10:02 +01:00
Karel Zak 7727be1af1 script: listen to SIGUSR1, flush logs on the signal
Based on pull request: https://github.com/karelzak/util-linux/pull/815

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-09 16:04:18 +01:00
Karel Zak eb78192211 scriptreplay: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-25 12:49:41 +01:00
Karel Zak 1eee1acb24 script: add --echo
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>
2019-11-25 12:39:52 +01:00
Karel Zak 4a2d27a242 scriptlive: keep ECHO flag, improve welcome message
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-22 14:04:21 +01:00
Karel Zak 1ec363cfff scriptlive: add --command, cleanup shell exec
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-22 13:48:29 +01:00
Karel Zak 95d255a819 scriptlive: terminate session at end of the log
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>
2019-11-22 13:03:35 +01:00
Karel Zak 4169bcb766 script: fix ECHO use, improve shell exec
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>
2019-11-21 12:28:51 +01:00
Karel Zak 4e666fceda agetty: add --show-issue to review issue output
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>
2019-11-12 11:24:40 +01:00
Karel Zak 456bcbca6b agetty: add support for /run/issue and /usr/lib/issue
Addresses: https://github.com/karelzak/util-linux/issues/828
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-12 10:26:35 +01:00
Karel Zak b1154c4ece script: fix signalfd use
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>
2019-10-09 16:51:34 +02:00
Karel Zak 4c791d127f build-sys: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 10:02:10 +02:00
Karel Zak 9e9b3d65dc script: cleanup logs freeing
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 14:20:39 +02:00
Karel Zak 1401181a19 scriptlive: remove unnecessary variables
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>
2019-10-08 13:11:54 +02:00
Karel Zak bdd4335706 lib/pty-session: make wait_child callback optional
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>
2019-10-08 13:11:54 +02:00
Karel Zak ec10634e7e script: use lib/pty-session
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>
2019-10-08 13:11:54 +02:00
Karel Zak f3e55e3e7c scriptlive: translate error messages too
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak cb4631fc52 scriptlive: add man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak fc176b0e2f scriptreplay: fix io data log use
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak d51f8ec129 scriptreplay: make data log file optional for --summary
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak 467aa4c1c0 script: fix man page on --logging-format
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak 263835e824 scriptlive: free resource at the and
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak 63869b842f build-sys: fix build with pty
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak a33f1fc432 scriptreplay: add -T, --log-timing
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>
2019-10-08 13:11:54 +02:00
Karel Zak 37a11e1a3d scriptlive: run shell in PTY
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>
2019-10-08 13:11:54 +02:00
Karel Zak a46e54583d scriptreplay: (utils) detect empty steps
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak b639c2a39b scriptreplay: use struct timeval for delay
* 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>
2019-10-08 13:11:54 +02:00
Karel Zak a1cc831b59 cript: always use decimal point numbers in logs
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>
2019-10-08 13:11:54 +02:00
Karel Zak 8ef57fdf13 script: add missing exit()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak 33869e5ac0 scriptlive: add new command to re-execute script(1) typescript
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>
2019-10-08 13:11:54 +02:00
Karel Zak 12352c967c scriptreplay: move all utils to script-playutils.{c,h}
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 4a4f4a6260 scriptreplay: add --summary
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 70c2cd9a60 script: add more information to timing log
Let's record also exit code, duration and start time.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak f923a59596 scriptreplay: check for EOF
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak fd42a45bea script: cleanup info logging
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 7c4a374f63 scriptreplay: print info and signals
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 3cecd17610 script: log additional information
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 6646f9f896 scriptreplay: make sure timing file specified
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak fbed5507da script: write signals to timing file
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 7031577246 scriptreplay: add --stream to the man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 88b8e9bffd scriptreplay: add --cr-mode
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>
2019-10-08 13:11:53 +02:00
Karel Zak cf0609a3ea scriptreplay: (man) add missing --log-* oprions
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 4f4bac42d8 scriptreplay: fix error path
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 41ce6545d2 scriptreplay: add --stream
Let's allow to specify stream, default to entry type according to the
command line options.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak d628e9cf7c script: default to new format when new features expected
The old format should be the default for stdout only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 0d955cd8ac scriptreplay: add --log-{in,out,io} options
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 02a51ce1e3 scriptreplay: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak daee4d95ae script: add --logging-format
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 7d5617c409 script: add note about --log-in and passwords
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 65dc24abac script: make --help more readable
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 167a485172 scriptreplay: skip unwanted steps
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 36b1369bdf script: add multistream timing file initialization
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak fec06a063e scriptreplay: rewrite to support new timing file format
* 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>
2019-10-08 13:11:53 +02:00
Karel Zak 88025c74e3 script: remove unused variable
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak c1c2ee0b3a script: support multi-stream logging
* 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>
2019-10-08 13:11:53 +02:00
Karel Zak 70062aad13 script: add --log-in
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>
2019-10-08 13:11:53 +02:00
Karel Zak fc58044f79 script: add option --log-timing
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>
2019-10-08 13:11:53 +02:00
Karel Zak ddbdb79256 script: add option --log-out
Let's make script(1) command line more explicit about typescript file.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak c64963f87c script: cleanup usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 9f82264851 script: allow to use the same log for more streams
The plan (for the next commits) is to use for example timing file for
stdin as well as for stdout.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak d805688afc script: report also timing file, do it only once
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 4f7521d66c script: make optional argument more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 596f42027d script: log file usage refactoring
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>
2019-10-08 13:11:53 +02:00
Elliott Mitchell 2bb3aa36b2 cleanup: Remove some spurious spaces
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>
2019-10-01 13:01:43 +02:00
Karel Zak 0f60f643a9 term-utils: add header file guards [lgtm scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-20 16:12:34 +02:00
Karel Zak bc6439ba32 setterm: cleanup usage() and man page
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>
2019-09-10 12:14:25 +02:00
Karel Zak 36ce5ebaf4 setterm: fix --clear
* make argument optional as in the original version
* fix typo (reset -> rest)

Addresses: https://github.com/karelzak/util-linux/issues/861
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-10 11:12:38 +02:00
Sami Kerola dbeb1d733e
docs: try to find broken man references and fix them
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>
2019-08-26 19:43:40 +01:00
Rosen Penev 76b680b1a9
Remove isascii usage
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.
2019-08-08 12:12:55 -07:00
Sami Kerola 2a952555d2 agetty: simplify code in dolog() preprocessor blocks
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>
2019-07-24 11:11:46 +02:00
Stanislav Brabec b0853a08db agetty: Remove superfluous fflush()
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>
2019-06-21 14:38:32 +02:00
Karel Zak 33985f1149 wall: make sure ut_line is not empty
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1711574
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-06-06 12:33:03 +02:00
Karel Zak 2c864ba8fc mesg: avoid 'ttyname failed: Success' message
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>
2019-05-27 13:07:12 +02:00
Karel Zak 2c308875a7 misc: consolidate version printing and close_stdout()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 15:14:13 +02:00
Jakub Wilk f28985ffc3 setterm: fix --hbcolor description
--hbcolor is for half-bright characters, which is sort of opposite of
bold.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2019-03-08 21:27:59 +01:00
Jakub Wilk bec23f0bf2 setterm: update comments about -ulcolor/-hbcolor syntax
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2019-03-07 22:11:46 +01:00
Jakub Wilk 3d886e86f6 setterm: fix bright colors for --ulcolor/--hbcolor
The "bright" keyword was parsed, but it didn't actually affect the color
that was set.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2019-03-07 22:11:46 +01:00
Jakub Wilk c1b4cf105d setterm: disallow "default" for --ulcolor/--hbcolor
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>
2019-03-07 22:11:38 +01:00
Stanislav Brabec dcf03ffb37 agetty: Switch to 8-bit processing in get_logname() for UTF-8 terminals
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>
2019-03-04 11:38:28 +01:00
Stanislav Brabec 5de9751997 agetty: Fix input of non-ASCII characters in get_logname()
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>
2019-03-04 11:38:17 +01:00
Sami Kerola 110260830d docs: fix typos [codespell]
Reference: https://github.com/codespell-project/codespell
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-02-18 13:22:43 +01:00
Sami Kerola 123eb9ef8c hardlink, wall: fix variable shadowing
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>
2019-02-18 13:20:34 +01:00
Karel Zak 3de236340d wall: remove unnecessary warning
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>
2019-02-14 10:41:59 +01:00
Stanislav Brabec d16afd8d15 agetty: Return old behavior with empty logname
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>
2018-11-21 10:48:05 +01:00
Christian Hesse f8ee3af9fa agetty: fix output of escaped characters
Signed-off-by: Christian Hesse <mail@eworm.de>
2018-11-12 11:32:28 +01:00
Samuel Thibault d7a412fe0a agetty: fix portability issues
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-12 11:31:17 +01:00
Stanislav Brabec c094fcd373 agetty: when logname is erased, re-enable reloads
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>
2018-10-31 09:35:48 +01:00
Lubomir Rintel 8b58ffddf4 agetty: don't put the VC into canonical mode
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>
2018-10-22 11:03:47 +02:00
Karel Zak cdd538e383 agetty: don't use __u32
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-11 14:22:08 +02:00