summaryrefslogtreecommitdiffstats
path: root/term-utils
Commit message (Collapse)AuthorAgeFilesLines
* script: be pedantic and use "%"SCNi64Karel Zak2015-10-161-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: don't assume that time_t is compatible with longIsaac Dunham2015-10-161-4/+6
| | | | | | | | | | time_t may change to 64-bit on 32-bit Linux kernels at some point; at that point, it may be desireable to test for issues with dates past 2038. [kzak@redhat.com: - use %jd rather than %lld] Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: remove dead code [coverity scan]Karel Zak2015-08-051-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: cleanup plymouth usage [coverity scan]Karel Zak2015-08-051-3/+9
| | | | | | | * use macros for paths * check open() return value Signed-off-by: Karel Zak <kzak@redhat.com>
* script: improve SIG{TERM,QUIT,KILL} sensitivityKarel Zak2015-07-281-3/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: Reprompt once the network addresses change if address displayedStef Walter2015-07-201-18/+107
| | | | | | | | | | | | | | | Several of the /etc/issue escape codes such as \4 and \6 depend on the current addresses of the system that can change after the agetty prompt is displayed. This can cause stale data to be displayed when a user looks at a VT, especially in cases of DHCP racing with system start up. Similar to the --reload mechanism, if we're displaying an address in the issue output, and the user hasn't typed anything yet: then redisplay the prompt with the new address. We use netlink to watch for address changes. We only open the netlink socket if we display an address in the issue file.
* script: evaluate errno only if read() sets itRuediger Meier2015-07-031-7/+6Star
| | | | | | | | | [kzak@redhat.com: - be careful with errno and DBG - add EINTR check (both suggested by Rudi] Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl> Signed-off-by: Karel Zak <kzak@redhat.com>
* script: make sure errno is zeroKarel Zak2015-07-021-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* reset: deprecate the script, and remove reset.033cSami Kerola2015-06-293-12/+6Star
| | | | | | | | | Most distributions probably ship reset from ncurses, which means util-linux reset(1) is unlikely to be in use anywhere. Assuming the previous being true it is almost unimaginable anyone one would be using the alternative script, so remove it and mark the script deprecated. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: fix variable initialization warningSami Kerola2015-06-291-3/+3
| | | | | | | term-utils/script.c:402:19: warning: obsolete use of designated initializer without '=' [-Wpedantic] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: use REALTIME_LIBS for scriptKarel Zak2015-06-291-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: add note to BUGS man page sectionKarel Zak2015-06-251-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: fix EOF problemsKarel Zak2015-06-171-26/+88
| | | | | | | | | | | | | | | | | * remove STDIN from poll() if: * STDIN already closed -- poll returns POLLHUP, for example: echo "date" | script * detect EOF as returned by read(), for example: script -c "echo Hello" < /dev/null * don't write to master when there is still something to read from slave (it means shell is not initialized yet or busy) Signed-off-by: Karel Zak <kzak@redhat.com>
* script: improve poll debuggingKarel Zak2015-06-171-5/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: cleanup signals usageKarel Zak2015-06-171-11/+28
| | | | | | | | | * don't call anything from assert() * fork() block cleanup to make it more readable * restore original signal mask in child (do_shell()) * close signal FD in child (do_shell()) Signed-off-by: Karel Zak <kzak@redhat.com>
* script: debug poll() resultsKarel Zak2015-06-161-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: add support for SCRIPT_DEBUG=Karel Zak2015-06-161-2/+65
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: remove magic constants from poll codeKarel Zak2015-06-161-21/+33
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: rename control struct membersKarel Zak2015-06-161-32/+32
| | | | | | | Sorry, but it's really ugly manner to use "xflg" where "x" is a command line option as program variable and use it in code. Signed-off-by: Karel Zak <kzak@redhat.com>
* script: close timingfp also when -eKarel Zak2015-06-161-11/+10Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: move timing file opening close to use of itSami Kerola2015-06-081-14/+17
| | | | | | | | This allows removing almost immediate closure of file handle in the doshell() function that does not use the file. Proposed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: add noreturn function attributesSami Kerola2015-06-081-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: use gettime_monotonic() to get timing file timestampsSami Kerola2015-06-082-14/+14
| | | | | | | | This moves the previous time to script control structure, and does timeval calculation with timersub() that is more appropriate than making a timeval to a double. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: use correct input type, move comment, and so onSami Kerola2015-06-081-13/+11Star
| | | | | | Minor corrections. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: replace strftime() workaround with CFLAGS = -Wno-format-y2kSami Kerola2015-06-082-12/+4Star
| | | | | | | | Nowadays, gcc(1) provides the -Wno-format-y2k option to prevent the warning, so that the above workaround is no longer required. Reference: http://man7.org/linux/man-pages/man3/strftime.3.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: move do_io() content to small functionsSami Kerola2015-06-081-50/+58
| | | | | | The do_io() got to be a bit long with relatively deep indentation. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: add 'Script started' line always to capture fileSami Kerola2015-06-081-5/+3Star
| | | | | | | | | | | | | | The scriptreplay(1) will expect capture file always to have header. Before this change the --quiet option together with timing caused following replay error. $ script --quiet --timing=timing [...] $ scriptreplay timing typescript [...] scriptreplay: unexpected end of file on typescript Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: remove io vs signal raceSami Kerola2015-06-081-7/+13
| | | | | | | | | | | | Make do_io() to run poll() until all streams are empty. This should remove the signal from child versus io handling race for good. Addresses: https://github.com/karelzak/util-linux/pull/62 Addresses: https://bugs.launchpad.net/bugs/264967 Addresses: https://bugs.debian.org/305808 CC: Wolfgang Richter <wolf@cs.cmu.edu> CC: Ruediger Meier <ruediger.meier@ga-group.nl> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: merge doinput() and output() functions to do_io()Sami Kerola2015-06-081-172/+59Star
| | | | | | | | | | One item to poll() more is a lot less work for system than separete input and output processes. 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>
* script: use poll() rather than select()Sami Kerola2015-06-061-88/+114
| | | | | | | | | Finalize the signalfd() change by adding file descriptors to poll() loop. 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>
* script: use signalfd() to catch signalsSami Kerola2015-06-061-33/+14Star
| | | | | | | | | | 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>
* script: add struct script_control and remove global variablesSami Kerola2015-06-061-244/+249
| | | | | | Fix also couple indentation issues. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: remove function prototypesSami Kerola2015-06-061-256/+243Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* tests: check script options work as expectedSami Kerola2015-06-062-2/+24
| | | | | | | Options --flush and --timing remain unchecked, as I do not have an idea how to check them reliably. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: Fix mangled EOF and hang on big endianStanislav Brabec2015-05-151-2/+2
| | | | | | | | | | | 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>
* wall: do not use a temporary file.Karel Zak2015-04-031-36/+80
| | | | | | | | | | | | | | | The issue with using a temporary file in wall is that wall runs as setgid. This means that an unprivileged user who runs wall can modify wall's temporary files, even if those are mode 0600, so the unprivileged user can edit and effectively suppress the banner. The fix is to simply not use temporary files. [kzak@redhat.com: - rewrite growing string functions - use struct buffer - add buf_print() function] Signed-off-by: Karel Zak <kzak@redhat.com> Co-Author: Jann Horn <jann@thejh.net>
* agetty: reload issue on --autologin --login-pause tooKarel Zak2015-03-091-79/+92
| | | | | | | | The current "agetty --reload" implementation does not refresh issue file output on autologin. Let's support this use-case too. Reported-by: Sitsofe Wheeler <sitsofe@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: make sure that reload file existsKarel Zak2015-03-091-5/+16
| | | | | | | | | | agetty monitors /run/agetty.reload file, unfortunately if the file does not exist when agetty starts up then "agetty" --reload does not work. This patch forces agetty to create the file before inotify is enabled. Reported-by: Sitsofe Wheeler <sitsofe@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: support /usr/lib/os-release tooKarel Zak2015-03-052-6/+10
| | | | | | | | | | | | http://www.freedesktop.org/software/systemd/man/os-release.html The file /etc/os-release takes precedence over /usr/lib/os-release. Applications should check for the former, and exclusively use its data if it exists, and only fall back to /usr/lib/os-release if it is missing. Reported-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: fix some spelling errors and typos in man pagesBill Pemberton2015-02-272-2/+2
| | | | | | | | | | | | | runuser.1: fix spelling implemenation -> implementation scriptreplay.1: fix spelling overide -> override unshare.1: fix spelling permamently -> permanently last.1: fix spelling preferrable -> preferable lslogins.1: fix spelling priviliges -> privileges hwclock.8.in: fix spelling transfered -> transferred prlimit.1: fix typo umlimited -> unlimited agetty.8: fix typo unnsupported -> unsupported Signed-off-by: Bill Pemberton <wfp5p@worldbroken.com>
* rpmatch: use symbolic value when evaluation return codesSami Kerola2015-02-241-3/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/strutils: extend parse_switch() to accept more optionsKarel Zak2015-02-241-12/+24
| | | | | | | * allow to specify more 0|1 pairs * allow to specify error message Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: move parse_switch() from setterm(1) to librarySami Kerola2015-02-241-16/+0Star
| | | | | | | To allow sharing the code with other utilities. Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* script.1: Improve documentation of non-interactive behaviorStanislav Brabec2015-02-161-1/+7
| | | | | | | | | | | - 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
* script: no logging for non-interactive shellsStanislav Brabec2015-02-121-0/+20
| | | | | | | | | | | | | | | | 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.
* Fix "Script started" buffering raceStanislav Brabec2015-02-101-0/+1
| | | | | | | | | | | | | | | script -c "echo Hallo World" </dev/null >script.log ; cat script.log Before: Hallo World Script started, file is typescript Script started, file is typescript Script done, file is typescript After: Script started, file is typescript Hallo World Script done, file is typescript
* textual: grammarize and harmonize the stat error messageBenno Schulenberg2015-02-021-1/+1
| | | | | | | | | The message "stat failed %s" seems to say that stat() failed to do something, or failed to pass a test, but of course it means that the statting of something failed. So say so. Also make two very similar messages equal to this one. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* Merge branch 'opts' of https://github.com/jwpi/util-linuxKarel Zak2015-01-262-6/+6
|\
| * docs: restore minus symbols in long optsJ William Piggott2015-01-212-6/+6
| | | | | | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | textual: fix spellos and inconsistencies in several program messagesBenno Schulenberg2015-01-261-3/+3
|/ | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>