]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
7 years agosu: keep old sigactions in control struct
Karel Zak [Wed, 16 Aug 2017 11:49:27 +0000 (13:49 +0200)] 
su: keep old sigactions in control struct

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: fix refactoring bug in child PID usage
Karel Zak [Wed, 16 Aug 2017 11:57:41 +0000 (13:57 +0200)] 
su: fix refactoring bug in child PID usage

Fix child pid cleanup according to commit 0076012563ff34e294a6166d605118bcdd35f7e1.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: add child to control struct
Karel Zak [Wed, 16 Aug 2017 11:42:34 +0000 (13:42 +0200)] 
su: add child to control struct

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: fix compiler warnings [-Wimplicit-fallthrough=]
Karel Zak [Wed, 16 Aug 2017 11:09:47 +0000 (13:09 +0200)] 
su: fix compiler warnings [-Wimplicit-fallthrough=]

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: add wait_for_child()
Karel Zak [Wed, 16 Aug 2017 11:04:51 +0000 (13:04 +0200)] 
su: add wait_for_child()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: unblock signals is all initialized
Karel Zak [Fri, 11 Aug 2017 15:05:00 +0000 (17:05 +0200)] 
su: unblock signals is all initialized

This patch a little bit reorders signals initialization. The original
code unblocks SIGINT SIGQUIT before signal handler is set for the
signals. It means there is a small possible race.

It seems better to compose wanted mask, setup handlers and then
unblock all the wanted signals.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: clean up signals usage
Karel Zak [Fri, 11 Aug 2017 14:47:01 +0000 (16:47 +0200)] 
su: clean up signals usage

- don't use magic numbers to index old actions
- don't use if () if ()
- make if() conditions more readable

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: clean up const usage
Karel Zak [Fri, 11 Aug 2017 13:18:31 +0000 (15:18 +0200)] 
su: clean up const usage

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: fix debug message
Karel Zak [Fri, 11 Aug 2017 13:15:16 +0000 (15:15 +0200)] 
su: fix debug message

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: properly clear child PID
Karel Zak [Wed, 1 Feb 2017 10:58:09 +0000 (11:58 +0100)] 
su: properly clear child PID

The patch from master branch, somehow lost during su refactoring
rebase.

Reported-by: Tobias Stöckmann <tobias@stoeckmann.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: improve some debug messages
Karel Zak [Fri, 11 Aug 2017 13:07:36 +0000 (15:07 +0200)] 
su: improve some debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: add debug.h stuff
Karel Zak [Wed, 9 Nov 2016 13:46:00 +0000 (14:46 +0100)] 
su: add debug.h stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: use switch() to split after fork
Karel Zak [Wed, 9 Nov 2016 13:19:22 +0000 (14:19 +0100)] 
su: use switch() to split after fork

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: move PAM session initialization to separate function
Karel Zak [Wed, 9 Nov 2016 13:15:31 +0000 (14:15 +0100)] 
su: move PAM session initialization to separate function

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: rename evaluate_uid()
Karel Zak [Wed, 9 Nov 2016 13:07:01 +0000 (14:07 +0100)] 
su: rename evaluate_uid()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: cosmetic code changes
Karel Zak [Fri, 14 Oct 2016 13:40:12 +0000 (15:40 +0200)] 
su: cosmetic code changes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: cleanup setuid/gid related code
Karel Zak [Fri, 14 Oct 2016 13:28:00 +0000 (15:28 +0200)] 
su: cleanup setuid/gid related code

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: cleanup setenv related code
Karel Zak [Fri, 14 Oct 2016 13:23:44 +0000 (15:23 +0200)] 
su: cleanup setenv related code

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: cleanup shell related code
Karel Zak [Fri, 14 Oct 2016 13:18:37 +0000 (15:18 +0200)] 
su: cleanup shell related code

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: cleanup usernames usage
Karel Zak [Fri, 14 Oct 2016 13:06:33 +0000 (15:06 +0200)] 
su: cleanup usernames usage

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/pwdutils: add xgetlogin()
Karel Zak [Fri, 14 Oct 2016 13:02:01 +0000 (15:02 +0200)] 
lib/pwdutils: add xgetlogin()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: cleanup pwd struct usage
Karel Zak [Fri, 14 Oct 2016 11:41:27 +0000 (13:41 +0200)] 
su: cleanup pwd struct usage

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agologin: add xgetpwnam()
Karel Zak [Fri, 14 Oct 2016 11:21:17 +0000 (13:21 +0200)] 
login: add xgetpwnam()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: consolidate tty name usage
Karel Zak [Fri, 14 Oct 2016 10:21:15 +0000 (12:21 +0200)] 
su: consolidate tty name usage

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: reorder functions
Karel Zak [Fri, 14 Oct 2016 10:02:53 +0000 (12:02 +0200)] 
su: reorder functions

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: cleanup PAM stuff
Karel Zak [Thu, 13 Oct 2016 12:50:22 +0000 (14:50 +0200)] 
su: cleanup PAM stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: cleanup usage()
Karel Zak [Thu, 13 Oct 2016 12:40:54 +0000 (14:40 +0200)] 
su: cleanup usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: add control struct
Karel Zak [Thu, 13 Oct 2016 12:22:52 +0000 (14:22 +0200)] 
su: add control struct

* setup logindefs loader by function rather than by global pointer

* move basic booleans to the su_context struct

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: cosmetic changes after indent
Karel Zak [Thu, 13 Oct 2016 11:14:58 +0000 (13:14 +0200)] 
su: cosmetic changes after indent

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosu: fix indention
Karel Zak [Thu, 13 Oct 2016 11:06:35 +0000 (13:06 +0200)] 
su: fix indention

Yes, I know... this patch is horrible. We all hate this in git
history, but the original indention from coreutils has been so
crazy...

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: add ASAN to TODO list
Karel Zak [Mon, 18 Sep 2017 09:44:57 +0000 (11:44 +0200)] 
docs: add ASAN to TODO list

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobash-completion: update uuidgen, wipefs, tunelp, setpriv, and hwclock
Sami Kerola [Sun, 17 Sep 2017 18:49:02 +0000 (19:49 +0100)] 
bash-completion: update uuidgen, wipefs, tunelp, setpriv, and hwclock

uuidgen: Add hash-based UUIDs to bash-completion.  These were added in
commit c6f1ec68a8b38863efff2a18e30b7272db4fb273.

wipefs: Command started to use libsmartcols, and it got some new options.
Commit d9921b2a128f17aa9a9a110444d5faa43e1b371c.

rename: New option was added in commit fabb90676af89bcb5f429793746f141c0.

tunelp: The --trust-irq was removed it being years broken.  Commit
d52eb4bd9062081c8420b22c029c694f29d036c7.

setpriv: Add --ambient-caps option from commit 0c92194eeee9c1fd58580ef852.
In same go fix 'bash set -u' issue, that is the same as mentioned commit
abbcec4fc9c8d7fb835b4eafd1bc9d82acbf0056.

hwclock: For some reason --get has always been missing from this file.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agodocs: remove repeated word from mount(8) man page
Sami Kerola [Sun, 17 Sep 2017 18:49:00 +0000 (19:49 +0100)] 
docs: remove repeated word from mount(8) man page

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibsmartcols: fix scols_line_move_cells() n+1 error [asan]
Karel Zak [Mon, 18 Sep 2017 08:41:20 +0000 (10:41 +0200)] 
libsmartcols: fix scols_line_move_cells() n+1 error [asan]

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'patch-1' of https://github.com/aner-perez/util-linux
Karel Zak [Fri, 15 Sep 2017 12:45:36 +0000 (14:45 +0200)] 
Merge branch 'patch-1' of https://github.com/aner-perez/util-linux

7 years agolibmount: export locking errors as MNT_EX_FILEIO
Karel Zak [Fri, 15 Sep 2017 12:30:06 +0000 (14:30 +0200)] 
libmount: export locking errors as MNT_EX_FILEIO

The mount man page assumes locking errors mapped to MNT_EX_FILEIO (16)
return code. Unfortunately, this is internally not exported as a
special error code, so it's returned as a generic (errno based)
stuff. This patch fixes this issue.

Note that we still use locking for example for utab or when enabled
/etc/mtab (disabled by default).

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibsmartcols: fix heap-buffer-overflow when move columns
Karel Zak [Fri, 15 Sep 2017 11:43:54 +0000 (13:43 +0200)] 
libsmartcols: fix heap-buffer-overflow when move columns

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agouuidparse:fix stack-buffer-overflow [asan]
Karel Zak [Fri, 15 Sep 2017 11:30:45 +0000 (13:30 +0200)] 
uuidparse:fix stack-buffer-overflow [asan]

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoswaplabel: fix --disable-libuuid compilation
Karel Zak [Fri, 15 Sep 2017 11:30:40 +0000 (13:30 +0200)] 
swaplabel: fix --disable-libuuid compilation

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agomisc: cleanup UUID_STR_LEN definitions
Karel Zak [Fri, 15 Sep 2017 11:25:32 +0000 (13:25 +0200)] 
misc: cleanup UUID_STR_LEN definitions

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agologger: make stdin parsing more friendly to static analyzers
Karel Zak [Fri, 15 Sep 2017 10:54:54 +0000 (12:54 +0200)] 
logger: make stdin parsing more friendly to static analyzers

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: fix coding style and error messages
Karel Zak [Fri, 15 Sep 2017 10:28:44 +0000 (12:28 +0200)] 
rfkill: fix coding style and error messages

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: do not fsync(3) /dev/rfkill file descriptor
Sami Kerola [Mon, 11 Sep 2017 19:55:58 +0000 (20:55 +0100)] 
rfkill: do not fsync(3) /dev/rfkill file descriptor

Attempt to fsync() this device returns EINVAL, causing the rfkill always to
return EXIT_FAILURE when either block or unblock is requested.  Simply
closing the file descriptor will fix the issue.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: allow use of multiple arguments
Sami Kerola [Mon, 11 Sep 2017 19:55:57 +0000 (20:55 +0100)] 
rfkill: allow use of multiple arguments

There is no reason why multiple arguments could not be supported.

Most common use case is to do multiple control commands in one go without us
of 'all' argument that can cause unnecessary connection breakage.  For
example someone might want to add to a system initialization following
commands.

    rfkill block bluetooth uwb wimax wwan gps fm nfc

That will ensure everything but wifi is turned off with as few commands as
possible, without killing wifi at any point.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoExample for renaming foo? does not work as described
Aner Perez [Thu, 14 Sep 2017 15:30:53 +0000 (11:30 -0400)] 
Example for renaming foo? does not work as described

Command for renaming foo? should add 2 zeros to make all the file names have 3 digits as described in the example results.

7 years agoscript: support sig{stop/cont}
Karel Zak [Fri, 8 Sep 2017 07:48:29 +0000 (09:48 +0200)] 
script: support sig{stop/cont}

* call wait() only when child exited
* suspend all session (including script master process) when child get
  SIGSTOP and send SIGCONT to child when master process resume

This allows to suspend all session and later use "fg" shell command to
resume.

$ ps af
14722 pts/1    Ss     0:00 bash
 4870 pts/1    S+     0:00  \_ ./script
 4871 pts/6    Ss+    0:00      \_ bash -i

$ kill -SIGSTOP 4871

and script session on another terminal:

$ script
Script started, file is typescript
$ 
[1]+  Stopped                 ./script

$ fg 1
./script

... session again usable ...
^D
Script done, file is typescript

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsblk: small man page change in return codes description
Karel Zak [Thu, 7 Sep 2017 08:03:18 +0000 (10:03 +0200)] 
lsblk: small man page change in return codes description

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agohwclock: add -a that is short of --adjust to manual page and usage
Sami Kerola [Sun, 3 Sep 2017 22:34:07 +0000 (23:34 +0100)] 
hwclock: add -a that is short of --adjust to manual page and usage

In same go use -V as return value of --version from getopts_long().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agohwclock: update usage()
J William Piggott [Mon, 4 Sep 2017 01:17:28 +0000 (21:17 -0400)] 
hwclock: update usage()

Improve usage strings for debug and version.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agoMerge branch '170825' of github.com:jwpi/util-linux
Karel Zak [Tue, 5 Sep 2017 10:24:40 +0000 (12:24 +0200)] 
Merge branch '170825' of github.com:jwpi/util-linux

* '170825' of github.com:jwpi/util-linux:
  hwclock: close hwaudit_fd unconditionally
  hwclock: don't always use hwclock_exit
  hwclock: remove sysexits.h

7 years agouuidgen: add more details to man page
Karel Zak [Tue, 5 Sep 2017 10:17:26 +0000 (12:17 +0200)] 
uuidgen: add more details to man page

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agouuidgen: add support for hash-based UUIDs
Philip Prindeville [Mon, 28 Aug 2017 19:36:30 +0000 (13:36 -0600)] 
uuidgen: add support for hash-based UUIDs

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
7 years agomisc: replace magic number 37 with UUID_STR_LEN
Philip Prindeville [Mon, 28 Aug 2017 19:20:55 +0000 (13:20 -0600)] 
misc: replace magic number 37 with UUID_STR_LEN

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
7 years agolibuuid: add support for hash-based UUIDs
Philip Prindeville [Tue, 5 Sep 2017 09:19:26 +0000 (11:19 +0200)] 
libuuid: add support for hash-based UUIDs

Adding V3 and V5 UUIDs per RFC-4122.

[kzak@redhat.com: - fix symbols file]

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agohwclock: close hwaudit_fd unconditionally
J William Piggott [Tue, 29 Aug 2017 01:19:55 +0000 (21:19 -0400)] 
hwclock: close hwaudit_fd unconditionally

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: don't always use hwclock_exit
J William Piggott [Sun, 3 Sep 2017 16:23:44 +0000 (12:23 -0400)] 
hwclock: don't always use hwclock_exit

Special exit handling is not wanted for usage() or bad
command syntax. For example we do not want to audit:
hwclock --set --date foo

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: remove sysexits.h
J William Piggott [Mon, 28 Aug 2017 00:26:41 +0000 (20:26 -0400)] 
hwclock: remove sysexits.h

sysexits.h was introduced in v2.11t prior to util-linux-ng, with the
HISTORY entry: * hwclock: minor polishing.

So there was no specific issue solved by adding it. Its use was never
documented so it should be safe to remove.

Also, fix return values being used for the exit status that were not
magic constants (portability issue).

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agotests: update sfdisk wipe test
Karel Zak [Fri, 1 Sep 2017 08:42:51 +0000 (10:42 +0200)] 
tests: update sfdisk wipe test

Now command wipefs returns results in the order how superblocks has
been detected on the device.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: add NFC fallback for old headers
Karel Zak [Thu, 31 Aug 2017 18:40:37 +0000 (20:40 +0200)] 
rfkill: add NFC fallback for old headers

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agowipefs: cleanup offsets list usage, fix -t filter
Karel Zak [Thu, 31 Aug 2017 12:47:14 +0000 (14:47 +0200)] 
wipefs: cleanup offsets list usage, fix -t filter

* move list with offsets specified by -o to the wipe_control struct
* don't clone the list of offsets, just keep it simple and stupid
* apply all filters (-o and -t) in get_desc_for_probe()
* always return offset and len by get_desc_for_probe() and apply
  always use libblkid hide & step-back

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1486777
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/match: make match_fstype() case insensitive
Karel Zak [Thu, 31 Aug 2017 12:15:23 +0000 (14:15 +0200)] 
lib/match: make match_fstype() case insensitive

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: add --disable-rfkill
Karel Zak [Thu, 31 Aug 2017 09:40:51 +0000 (11:40 +0200)] 
build-sys: add --disable-rfkill

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: cleanup returns
Karel Zak [Thu, 31 Aug 2017 09:16:07 +0000 (11:16 +0200)] 
rfkill: cleanup returns

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: remove unused rfkill.py
Karel Zak [Thu, 31 Aug 2017 08:37:36 +0000 (10:37 +0200)] 
build-sys: remove unused rfkill.py

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: add Sami to authors
Karel Zak [Thu, 31 Aug 2017 08:36:51 +0000 (10:36 +0200)] 
rfkill: add Sami to authors

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: cleanup usage()
Karel Zak [Thu, 31 Aug 2017 08:31:21 +0000 (10:31 +0200)] 
rfkill: cleanup usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'rfkill' of git://github.com/kerolasa/lelux-utiliteetit into rfkill
Karel Zak [Thu, 31 Aug 2017 07:56:18 +0000 (09:56 +0200)] 
Merge branch 'rfkill' of git://github.com/kerolasa/lelux-utiliteetit into rfkill

* 'rfkill' of git://github.com/kerolasa/lelux-utiliteetit: (57 commits)
  rfkill: add systemd-rfkill(8) see also segment
  rfkill: check id number refers to a device that exists
  rfkill: use back and forward compatible test
  rfkill: add bash-completion file
  rfkill: inform in syslog when rfkill is invoked
  rfkill: use human readable timestamps in event output
  rfkill: use libsmartcols output
  rfkill: do not ignore read error
  rfkill: clarify 'all devices' handling
  rfkill: update manual page
  rfkill: make programming style to match util-linux project
  rfkill: make command to build in util-linux project
  rfkill: move files to appropriate locations
  add python module
  use uapi rfkill.h
  version 0.5
  fix compiler warning
  Add NFC support
  version 0.4
  Add rfkill type "fm" to the man page.
  ...

7 years agorfkill: add systemd-rfkill(8) see also segment
Sami Kerola [Thu, 6 Jul 2017 20:57:59 +0000 (21:57 +0100)] 
rfkill: add systemd-rfkill(8) see also segment

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: check id number refers to a device that exists
Sami Kerola [Tue, 4 Jul 2017 20:43:56 +0000 (21:43 +0100)] 
rfkill: check id number refers to a device that exists

Earlier all commands happily accepted without detecting failure when
none-existing id number was used.  For example:

$ rfkill block 2017; echo $?
0

The same input after this change looks following.

$ rfkill block 2017; echo $?
rfkill: invalid identifier: 2017
1

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: use back and forward compatible test
Sami Kerola [Sat, 1 Jul 2017 08:15:12 +0000 (09:15 +0100)] 
rfkill: use back and forward compatible test

The rfkill_event struct might grow in future, so ensure the read sizes are
at least the minimum, and allow it to be more.

Reference: https://github.com/torvalds/linux/blob/master/include/uapi/linux/rfkill.h#L90-L102
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: add bash-completion file
Sami Kerola [Sun, 25 Jun 2017 12:21:31 +0000 (13:21 +0100)] 
rfkill: add bash-completion file

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: inform in syslog when rfkill is invoked
Sami Kerola [Sun, 25 Jun 2017 11:12:40 +0000 (12:12 +0100)] 
rfkill: inform in syslog when rfkill is invoked

This should help when trying to explain what or who is flicking wireles on
or off.  Notice that the change is not perfect - if rfkill command is
setting a state that is already set the syslog entry is sent eventhough
there was no effective change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: use human readable timestamps in event output
Sami Kerola [Sun, 25 Jun 2017 10:33:57 +0000 (11:33 +0100)] 
rfkill: use human readable timestamps in event output

The event command appears to be something what primarily a developers will
to use when debugging.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: use libsmartcols output
Sami Kerola [Sun, 25 Jun 2017 08:42:06 +0000 (09:42 +0100)] 
rfkill: use libsmartcols output

This also makes the rfkill to output status when executed without arguments.
That is believed ot be more useful than usage() output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: do not ignore read error
Sami Kerola [Sun, 25 Jun 2017 00:35:28 +0000 (01:35 +0100)] 
rfkill: do not ignore read error

Read error should be impossible, but when one does happen user certainly
wants to know about that rather than see even more strange issue caused
random data in name variable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: clarify 'all devices' handling
Sami Kerola [Sun, 25 Jun 2017 00:04:41 +0000 (01:04 +0100)] 
rfkill: clarify 'all devices' handling

Stop using RFKILL_IS_INVALID a marker when rfkill is iterating over all
devices.  Addition of RFKIL_IS_ALL should make this a lot easier to digest,
especially if reading code in hurry.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: update manual page
Sami Kerola [Sat, 24 Jun 2017 23:01:19 +0000 (00:01 +0100)] 
rfkill: update manual page

Make the manual page style to match with util-linux project.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: make programming style to match util-linux project
Sami Kerola [Sat, 24 Jun 2017 19:42:58 +0000 (20:42 +0100)] 
rfkill: make programming style to match util-linux project

Use the usual facilities, add translation strings, move global variables at
the beginning of the file, make usage() look as expected, add standard
command-line option parsing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: make command to build in util-linux project
Sami Kerola [Sat, 24 Jun 2017 19:19:26 +0000 (20:19 +0100)] 
rfkill: make command to build in util-linux project

After this commit the command merely builds, but does not confirm style used
in util-linux project.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: move files to appropriate locations
Sami Kerola [Sat, 24 Jun 2017 19:03:38 +0000 (20:03 +0100)] 
rfkill: move files to appropriate locations

Also remove unnecessary items.  Notice that the licence text from COPYING is
moved to top of the command in comment section.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: merge rfkill.8 project to util-linux
Sami Kerola [Wed, 30 Aug 2017 19:29:31 +0000 (20:29 +0100)] 
rfkill: merge rfkill.8 project to util-linux

Projet merge discussion in maillists:
http://www.spinics.net/lists/util-linux-ng/msg14289.html
http://marc.info/?l=linux-wireless&m=149880885914076&w=2

Old-Remote: http://git.sipsolutions.net/rfkill.git/
Old-Remote: git://git.kernel.org/pub/scm/linux/kernel/git/jberg/rfkill.git
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agodocs: remove TODO item for fdisk
Karel Zak [Wed, 30 Aug 2017 10:01:21 +0000 (12:01 +0200)] 
docs: remove TODO item for fdisk

We use libsmartcols so basic escape for terminal should be already
done by the library.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: define dependence between chsh and getusershell
Karel Zak [Wed, 30 Aug 2017 09:30:41 +0000 (11:30 +0200)] 
build-sys: define dependence between chsh and getusershell

7 years agochsh: remove local /etc/shells parsing in favour of getusershell(3)
Sami Kerola [Mon, 28 Aug 2017 20:38:13 +0000 (21:38 +0100)] 
chsh: remove local /etc/shells parsing in favour of getusershell(3)

Less code, less bugs.  And if there are bugs at least share them with all
other programs that use getusershell(3) from libc.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agobash-completion: simplify pid listing
Sami Kerola [Sat, 26 Aug 2017 12:45:13 +0000 (13:45 +0100)] 
bash-completion: simplify pid listing

Changing directory in subshell does not effect parent process, so this is
better and possibly quicker way to list pids.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agohwclock: remove bool type definition
Sami Kerola [Sat, 26 Aug 2017 12:38:07 +0000 (13:38 +0100)] 
hwclock: remove bool type definition

Use plain int instead of type defining it to a boolean, and use numbers to
signify true or false as we do everywhere else in this source tree.  And in
hwclock-cmos.c file booleans weren't even needed, to the related code is
removed.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agofdisk: use strutils to trim whitespace from input
Vaclav Dolezal [Tue, 29 Aug 2017 12:31:06 +0000 (14:31 +0200)] 
fdisk: use strutils to trim whitespace from input

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agofdisk: fix copy from readline and whitespace stripping
Vaclav Dolezal [Mon, 28 Aug 2017 11:20:34 +0000 (13:20 +0200)] 
fdisk: fix copy from readline and whitespace stripping

Bug fixed:
---
678: fdisk:      ASK: asking for number ['Partition number', <1,4>, default=1, range: 1-4]
678: fdisk:      ASK: asking for user replay [interactive]
Partition number (1-4, default 1): 12345
678: fdisk:      ASK: user's reply: >>>12345<<<
Value out of range.
678: fdisk:      ASK: asking for user replay [interactive]
Partition number (1-4, default 1): 1
678: fdisk:      ASK: user's reply: >>>12345<<<
Value out of range.
678: fdisk:      ASK: asking for user replay [interactive]
Partition number (1-4, default 1):
678: fdisk:      ASK: user's reply: >>>22345<<<
Value out of range.
---

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agofdisk: minor fixes to make readline work
Vaclav Dolezal [Mon, 28 Aug 2017 10:31:10 +0000 (12:31 +0200)] 
fdisk: minor fixes to make readline work

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agohwclock: for debugging print startup system time
J William Piggott [Sun, 13 Aug 2017 17:38:18 +0000 (13:38 -0400)] 
hwclock: for debugging print startup system time

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: refactor set_system_clock()
J William Piggott [Sun, 13 Aug 2017 17:11:25 +0000 (13:11 -0400)] 
hwclock: refactor set_system_clock()

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: update set_system_clock comments
J William Piggott [Sun, 13 Aug 2017 00:13:22 +0000 (20:13 -0400)] 
hwclock: update set_system_clock comments

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: update set_system_clock debugging
J William Piggott [Wed, 9 Aug 2017 00:50:55 +0000 (20:50 -0400)] 
hwclock: update set_system_clock debugging

Update debug messages for a combined --systz and --hctosys in
the set_system_clock function.

New debug messages:

hwclock --test -D --systz --localtime
Calling settimeofday(NULL, 240) to warp System time.
Test mode: clock was not changed

hwclock --test -D --systz --utc
Calling settimeofday(NULL, 0) to lock the warp function.
Calling settimeofday(NULL, 240) to set the kernel timezone.
Test mode: clock was not changed

hwclock --test -D --hctosys --utc
Calling settimeofday(1502239269.733639, 240)
Test mode: clock was not changed

hwclock --test -D --hctosys --localtime
Calling settimeofday(NULL, 240) to set persistent_clock_is_local.
Calling settimeofday(1502253708.200200, 240)
Test mode: clock was not changed

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: remove set_system_clock_timezone()
J William Piggott [Sun, 6 Aug 2017 16:17:10 +0000 (12:17 -0400)] 
hwclock: remove set_system_clock_timezone()

Remove set_system_clock_timezone() because the previous patch
moved its functionality into set_system_clock().

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: move systz into hctosys
J William Piggott [Sun, 6 Aug 2017 15:39:33 +0000 (11:39 -0400)] 
hwclock: move systz into hctosys

The set_system_clock_timezone() function is nearly identical to
set_system_clock(). Three additional statements are required
to include systz in hctosys.

This patch is intentionally incomplete to make reviewing the
actual required changes easier. Other patches in this set will:

 * remove set_system_clock_timezone()
 * fix messages and debugging
 * fix comments
 * and finally refactor set_system_clock()

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agofdisk: add missing include
Karel Zak [Thu, 24 Aug 2017 17:59:20 +0000 (19:59 +0200)] 
fdisk: add missing include

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofdisk: fix readline interaction with signals
Karel Zak [Thu, 24 Aug 2017 13:37:16 +0000 (15:37 +0200)] 
fdisk: fix readline interaction with signals

The high-level readline API is crazy to use with signals. Fortunately
the library provides low-level rl_callback_* API. In this case we can
use poll() to wait for input and control all signals, etc.

This patch also a little changes fdisk behavior on CTRL+C and CTRL+D.
The signals does not kill fdisk, but forces fdisk to return to the
main menu, if already in the main menu then exit. If the disk layout
has been modified than ask "Do you really want to exit...".

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofdisk: handle SIGINT in dialogs as cancel
Vaclav Dolezal [Tue, 15 Aug 2017 13:25:32 +0000 (15:25 +0200)] 
fdisk: handle SIGINT in dialogs as cancel

[kzak@redhat.com: - use sig_atomic_t]

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofdisk: add wrap_fgets() for getting user input
Vaclav Dolezal [Tue, 15 Aug 2017 11:08:49 +0000 (13:08 +0200)] 
fdisk: add wrap_fgets() for getting user input

make function wrapping rl_fgets() and fputs()&fgets() to remove
code duplication in get_user_reply().

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agolibfdisk: fix fdisk_reset_partition() leaking *_chs strings.
Vaclav Dolezal [Tue, 15 Aug 2017 08:02:45 +0000 (10:02 +0200)] 
libfdisk: fix fdisk_reset_partition() leaking *_chs strings.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>