Commit Graph

663 Commits

Author SHA1 Message Date
Ivan Mironov 5df455dbbc agetty: Allow --init-string on a virtual console
This option has valid use cases on virtual consoles. Example:
enabling screen blanking in the same way as `setterm --blank ...`
does.

Signed-off-by: Ivan Mironov <mironov.ivan@gmail.com>
2021-02-02 00:29:25 +05:00
Karel Zak 31862cde0a fix compiler warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-21 10:26:25 +01:00
Karel Zak cf918bd3ac scriptlive: fix compiler warnings [-Wmaybe-uninitialized]
term-utils/scriptlive.c: In function 'process_next_step':
term-utils/scriptlive.c:125:4: warning: 'now.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/scriptlive.c:122:19: note: 'now.tv_usec' was declared here
term-utils/scriptlive.c:125:4: warning: 'now.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/scriptlive.c:122:19: note: 'now.tv_sec' was declared here

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-12-14 16:03:03 +01:00
Karel Zak 117cbf9180 script: fix compiler warnings [-Wmaybe-uninitialized]
term-utils/script.c: In function 'log_close.part.0.isra':
term-utils/script.c:306:3: warning: 'now.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/script.c:303:18: note: 'now.tv_usec' was declared here
term-utils/script.c:306:3: warning: 'now.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/script.c:303:18: note: 'now.tv_sec' was declared here

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-12-14 16:01:55 +01:00
Pino Toscano 5547316c85 build-sys: do not build plymouth-ctrl.c w/ disabled plymouth
Do not build plymouth-ctrl.c in agetty and sulogin in case the plymouth
support is disabled.

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
2020-11-17 11:27:48 +01:00
Egor Chelak 1b10fa0ef7 cast NULL to char * when using execl
When calling variadic functions, NULL must be explicitly cast to a
desired type.
This is noted in the exec(3) manpage.

The call in newgrp.c was changed for consistency.

Signed-off-by: Egor Chelak <egor.chelak@gmail.com>
2020-10-29 19:49:07 +02:00
Karel Zak eee886ba1d build-sys: exclude GPL from libcommon
The library is not distributed and almost all code in this ar(1)
archive is Public Domain or LGPL ... but let's avoid any doubts and do
not mix non-GPL and GPL code there.

Addresses: https://github.com/karelzak/util-linux/issues/1157
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-06 13:26:36 +02:00
Samanta Navarro 3fb46f5e7b agetty: fix typo in manual page 2020-10-03 11:57:56 +00:00
Karel Zak bd4739dae2 script: don't use strings from user as printf-format [coverity scan]
Let's avoid format string vulnerability (TAINTED_STRING).

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-01 13:29:46 +02:00
Karel Zak 8deb45fc56 script: kill child process on error
The recent change in code improves main-pool on error, but we need
to kill child process if it still running to avoid hang up in next
waitpid().

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-09-21 12:58:46 +02:00
leeceeksdee 3ba9018b85
he -> they 2020-08-28 19:11:02 +02:00
Soumendra Ganguly 75ccd75a2f script: cleanup --echo
Permanently turn off current stdin ECHO when it is a terminal and enable setting slave ECHO instead.
Fix other minor typos, update documentation.

[kzak@redhat.com: - remove irrelevant changes
                  - keep --echo argument unchanged]

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-08-27 12:56:46 +02:00
Soumendra Ganguly 535e81ebba Change tcgetattr error handling. 2020-08-08 05:28:42 -05:00
Soumendra Ganguly cfc264d50b Add more elegant error handling. Avoid isatty. 2020-08-07 03:01:02 -05:00
Michael Kerrisk (man-pages) 2b34e0141d Manual pages: agetty.8: Minor formatting and wording fixes
Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-24 14:41:49 +02:00
Soumendra Ganguly 00a09d78ea scriptreplay: enable special character handling
Calling cfmakeraw disables terminal special character handling. For
example, Ctrl-C does not send SIGINT to scriptreplay. The following
fixes this.

 tattr.c_lflag |= ISIG;

where tattr is the struct termios with which we are working.
2020-07-23 12:23:56 +02:00
SOUMENDRA GANGULY edb088ffbe Make scriptreplay set terminal to raw mode 2020-07-23 12:23:56 +02:00
Michael Kerrisk (man-pages) 0ddd83c703 Manual pages: scriptreplay.1: Miscellaneous wording, grammar, and formatting fixes
Nothing too contentious here, I think, so I'm rolling all
of the edits into one patch.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-20 09:58:13 +02:00
Michael Kerrisk (man-pages) c2edaa8d50 Manual pages: scriptlive.1: Miscellaneous wording, grammar, and formatting fixes
Nothing too contentious here, I think, so I'm rolling all
of the edits into one patch.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-20 09:58:13 +02:00
Michael Kerrisk (man-pages) 1dd82d5491 Manual pages: script.1: Miscellaneous wording, grammar, and formatting fixes
Nothing too contentious here, I think, so I'm rolling all
of the edits into one patch.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-20 09:58:13 +02:00
Michael Kerrisk (man-pages) 4f68c8b179 Manual pages: various: reword "allow(s) to"
The wording "allow(s) to" is not grammatical English. Reword various
pages to use a more correct form such "can be use to" or "allows
the [noun] of".

Aklong the way, fix a few nearby wording errors in some pages.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-14 14:08:54 +02:00
Yuri Chornoivan 311e33afef Fix minor typos 2020-07-09 20:14:32 +03:00
Bjarni Ingi Gislason 308f997baf doc: term-utils/*: fix some warnings from "mandoc -T lint"
mandoc: ./term-utils/agetty.8:224:36: WARNING: undefined escape, printing literally: \\
mandoc: ./term-utils/agetty.8:12:2: STYLE: fill mode already enabled, skipping: fi
mandoc: ./term-utils/agetty.8:307:2: WARNING: skipping paragraph macro: PP empty
mandoc: ./term-utils/agetty.8:489:2: STYLE: fill mode already enabled, skipping: fi
mandoc: ./term-utils/agetty.8:503:2: STYLE: fill mode already enabled, skipping: fi

mandoc: ./term-utils/script.1:198:2: WARNING: skipping paragraph macro: PP empty
mandoc: ./term-utils/script.1:244:2: WARNING: empty block: RS
mandoc: ./term-utils/script.1:261:2: WARNING: skipping paragraph macro: PP empty

mandoc: ./term-utils/scriptlive.1:77:2: STYLE: fill mode already disabled, skipping: nf

mandoc: ./term-utils/scriptreplay.1:122:2: STYLE: fill mode already disabled, skipping: nf

###

  Additional change:

1)  Changed '  ' once to ' ' in "agetty.8"

2)  Change in the output from "groff":

'-' changed to '\-' in "agetty.8".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2020-06-15 11:28:01 +02:00
Michael Kerrisk (man-pages) 1538f6f636 Manual pages: wording fix: "another" ==> "other"
In several pages, there is a consistent wording problem: "another"
where "other" should be used. This wording problem can be
surprisingly confusing for native speakers, especially those
unaware that in some other languages, "another" and "other" can be
expressed with the same word.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-05-29 14:31:47 +02:00
Michael Kerrisk (man-pages) 3bc92f313a Manual pages: rename EXAMPLE section to EXAMPLES
Earlier, I patched various pages to consistently use EXAMPLE as a
section heading, rather than EXAMPLES.  (At that time, both headings
occurred in util-linux, with roughly equal frequency.)

Since then, I've observed that EXAMPLES is the more common usage
across a large corpus of manual pages. So, in Linux the man-pages
project, I switched to using EXAMPLES also. This patch makes the same
change for util-linux.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-05-28 14:51:54 +02:00
Michael Kerrisk (man-pages) 67e63c1263 Manual pages: order NOTES / HISTORY / BUGS / EXAMPLE consistently
There is value in ensuring that manual page sections use consistently
named sections, as far as possible, and also that sections have a
consistent order within manual pages. This is one of a series of patches
to place manual page sections in a consistent order.

In this patch, we ensure that the NOTES, HISTORY, BUGS, and EXAMPLE
sections are always placed near the end of the page, just above
AUTHORS, COPYRIGHT, SEE ALSO, and AVAILABILITY.

One page is not fixed by this patch: term-utils/agetty.8. This page
is a mess of unusual section names, and probably requires an individual
edit.

Testing that no gross editing mistake (causing accidental loss or addition
of text) was performed as follows:

    $ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > a
    [Apply patch]
    $ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > b
    $ diff a b
    $ echo $?
    0

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-22 10:25:50 +02:00
Michael Kerrisk (man-pages) ade04bb89c Manual pages: order AUTHORS / COPYRIGHT / SEE ALSO / AVAILABILITY consistently
There is value in ensuring that manual page sections use consistently
named sections, as far as possible, and also that sections have a
consistent order within manual pages. This is one of a series of patches
to place manual page sections in a consistent order.

In this patch, we ensure that the AUTHORS, COPYRIGHT, SEE ALSO, and
AVAILABILITY sections are always placed at the end of the page.

Testing that no gross editing mistake (causing accidental loss or addition
of text) was performed as follows:

    $ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > a
    [Apply patch]
    $ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > b
    $ diff a b
    $ echo $?
    0

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-22 10:25:49 +02:00
Karel Zak 88aefd4c46 agetty: ignore ^C
Danc86 wrote:
 With agetty 2.32.1 and earlier, ^C at the login prompt is ignored. I
 noticed when upgrading to agetty 2.34, typing ^C now causes agetty to
 stop responding for 10 seconds and then it dies (and gets restarted by
 system and a new login prompt is printed).

 It logs this message:

   agetty[46048]: ttyS0: invalid character 0x3 in login name

 Previously the !isprint(ascval) condition would have caused control
 characters like ^C (\x03) to be discarded, whereas now it falls
 through to trying to decode it as part of a UTF-8 sequence, and then
 fails.

Fixes: 5de9751997
Addresses: https://github.com/karelzak/util-linux/issues/1046
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-05-22 10:22:12 +02:00
Michael Kerrisk (man-pages) a87f49f662 Manual pages: use the term "exit status"
The manual pages currently use a multitude of terms--"exit code",
"error code", "return code", "exit code", and so on--when what
is always meant is "exit status" (the POSIX term). This patch fixes
as many of these erroneous terms as I could find.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-20 12:56:52 +02:00
Michael Kerrisk (man-pages) bc281b0991 Manual pages: Standardize on EXAMPLE as section title
There is quite some value (in terms of readability and user
expectations) if consistent names are used for the sections
within manual pages. This patch is one of a series to bring
about this consistency.

Currently we have EXAMPLE (10) or EXAMPLES (23).
Let's standardize on the EXAMPLE (which is also what is
suggested in man-pages(7)) and used consistently across
a large number of pages in the Linux man-pages project.

(I realize the choice to go EXAMPLE, rather than EXAMPLES,
may be debatable. If necessary, I'd write a patch that instead
goes the other way, but I'd prefer to follow man-pages(7).)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-20 12:56:12 +02:00
Michael Kerrisk (man-pages) a8d0d330cf Manual pages: Standardize on AUTHORS as section title
There is quite some value (in terms of readability and user
expectations) if consistent names are used for the sections
within manual pages. This patch is one of a series to bring
about this consistency.

In the Linux man-pages project, I long ago did away with the
AUTHOR(S) section, but I realize some projects like to keep this.

But, let's make sure that the section is consistently titled
across pages. Currently we have AUTHOR (47) or AUTHORS (41).
Let's standardize on the latter (which is also what is
suggested in man-pages(7)).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-20 12:56:12 +02:00
Michael Kerrisk (man-pages) 5a82980632 docs: (man) remove double quotes (") in .SH lines
Using double quotes in .SH lines containing multiple words is unneeded,
and in any case is not consistently done in the util-linux manual pages,
where double quotes are used in only around half of the cases.
(This usage was long ago elminated in the man-pages project, with
no ill effects reported to date.)

Remove these quotes, so that .SH lines are more uniform, in preparation
for some (more easily) scripted doiscovery of consistency problems in
(and possibly global fixes to) the manual pages.

Other than stripping the double quotes, this patch makes no changes to
the content of the manual pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 12:15:34 +02:00
Karel Zak e327a7acd6 agetty: extend --issue-file to support multiple paths
The current default behavior is to print the first issue file/dir and
all alternative locations are used as a backup solution only. If something
is found than the rest is ignored. The --issue-file allow to overwrite
this default behavior, but currently it supports only one file/dir.

This patch extend --issue-file to support ':' separated list of paths
and *all* the files (if exist and no empty) in the list are printed.

 agetty --issue-file=/etc/issue:/etc/issue.d:/run/issue:/run/issue.d:/usr/lib/issue:/usr/lib/issue.d

Addresses: https://github.com/karelzak/util-linux/issues/1041
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-05-19 10:55:20 +02:00
Bjarni Ingi Gislason c5178f2796 docs: Some minor fixes in some manuals
Output is from: test-groff -b -e -mandoc -T utf8 -rF0 -t -w w -z

  [ "test-groff" is a developmental version of "groff" ]

Input file is ././misc-utils/kill.1

<./misc-utils/kill.1>:173 (macro BR): only 1 argument, but more are expected

Input file is ././misc-utils/lsblk.8

troff: backtrace: '/home/bg/git/groff/build/s-tmac/an-old.tmac':478: macro 'BR'
troff: backtrace: file '<./misc-utils/lsblk.8>':122
troff: <./misc-utils/lsblk.8>:122: warning: trailing space

Input file is ././sys-utils/mount.8

an-old.tmac: <./sys-utils/mount.8>:2427 (.RE): warning: extra .RE or .RS is missing before it; "an-RS-open" is 0.

Input file is ././sys-utils/unshare.1

<./sys-utils/unshare.1>:176 (macro BR): only 1 argument, but more are expected
<./sys-utils/unshare.1>:181 (macro BR): only 1 argument, but more are expected
<./sys-utils/unshare.1>:240 (macro BR): only 1 argument, but more are expected
<./sys-utils/unshare.1>:246 (macro BR): only 1 argument, but more are expected

Input file is ././term-utils/agetty.8

troff: backtrace: file '<./term-utils/agetty.8>':130
troff: <./term-utils/agetty.8>:130: warning: trailing space

Input file is ././text-utils/more.1

troff: backtrace: file '<./text-utils/more.1>':91
troff: <./text-utils/more.1>:91: warning: macro 'b' not defined

  The output from nroff and troff is unchanged, except for the word
"number" in text-utils/more.1, that was missing.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2020-05-18 10:35:25 +02:00
Jakub Wilk b220fad41e scriptlive: fix typo
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2020-05-05 14:37:56 +02:00
Jakub Wilk 140f586389 scriptlive: fix man page formatting
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2020-05-05 14:37:49 +02:00
Karel Zak 0d855a8309 agetty: save the original speed on --keep-baud
agetty cycling through the baud rates specified on command line
(triggered by BREAK). Unfortunately, the original baud rate (probably
the best one) is tried only first time on --keep-baud.

Addresses: https://github.com/karelzak/util-linux/issues/1025
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-05-04 12:27:42 +02:00
Rosen Penev ad296391f9
[clang-tidy] fix wrong *cmp usage
Found with bugprone-suspicious-string-compare

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-20 13:21:00 -07:00
Rosen Penev 042f62dfc5
[clang-tidy] do not use else after return
Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-20 13:20:59 -07:00
Rosen Penev bd89499e07
[clang-tidy] do not return in void functions
Found with readability-redundant-control-flow

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-19 14:03:21 -07:00
Karel Zak f48c407c9a scriptlive, scriptreplay: cleanup --maxdelay man page description
Addresses: https://github.com/karelzak/util-linux/issues/1004
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-14 11:40:38 +02:00
Karel Zak a775c4a4a4 agetty: (man) fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-10 20:55:00 +01:00
Karel Zak 14e7e40314 agetty: (man) add "white" color name
Addresses: https://github.com/karelzak/util-linux/issues/979
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-10 12:33:35 +01:00
Sami Kerola 9565786cb0
script: fix minor warning
ICO C does not allow extra ‘;’ outside of a function [-Wpedantic]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-02-15 15:24:01 +00:00
Sami Kerola 3160589d86
various: use threadsafe versions of time functions [lgtm scan]
Deprecating calls to not-thread safe asctime(), ctime(), and localtime()
calls is pretty close to pointless change.  Lets do it to reduce lgtm scan
warnings with justification it's nicer to use static analysis tools when
they have very few positives.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-02-15 15:23:44 +00:00
Sami Kerola cdf84bf658
write: fix potential string overflow
Noticed when compiled with gcc verion 9.2.1 20200130.

term-utils/write.c:182:7: warning: ‘strcmp’ argument 1 declared attribute
			  ‘nonstring’ [-Wstringop-overflow=]
  182 |   if (strcmp(u->ut_line, ctl->src_tty_name) == 0) {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/utmpx.h:31,
                 from term-utils/write.c:60:
/usr/include/bits/utmpx.h:59:8: note: argument ‘ut_line’ declared here
   59 |   char ut_line[__UT_LINESIZE]
      |        ^~~~~~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-02-15 15:23:36 +00:00
Karel Zak f0b3df38c5 Merge branch 'patch-2' of https://github.com/yurchor/util-linux
* 'patch-2' of https://github.com/yurchor/util-linux:
  Fix minor typo: aliast -> alias
2020-01-23 15:53:19 +01:00
Karel Zak 704156ad63 Merge branch 'patch-1' of https://github.com/yurchor/util-linux
* 'patch-1' of https://github.com/yurchor/util-linux:
  Fix minor typo: ussuported -> unsupported
2020-01-23 15:52:44 +01:00
Karel Zak 0d74f2628c scriptreplay: restrict header name size
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-20 13:04:59 +01:00
Karel Zak 00130885ab script: follow --logging-format on -t
Let's use new logic for timing file format also for old -t command
line option.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-15 13:01:06 +01:00