]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
11 years agolast: tell verbally system is still running
Sami Kerola [Wed, 28 Aug 2013 17:53:22 +0000 (18:53 +0100)] 
last: tell verbally system is still running

Use of uptime time stamp as previous boot login time makes the output not
constant, which is rather difficult to test.  Verbal message 'system is
still running' makes testing easy, and noticing which boot is still
running clear to a person.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: trim trailing white spaces
Sami Kerola [Wed, 28 Aug 2013 17:31:48 +0000 (18:31 +0100)] 
last: trim trailing white spaces

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agotests: add last(1) test
Sami Kerola [Wed, 28 Aug 2013 17:00:35 +0000 (18:00 +0100)] 
tests: add last(1) test

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: never restrict session time
Sami Kerola [Wed, 28 Aug 2013 14:37:46 +0000 (15:37 +0100)] 
last: never restrict session time

When a session time will reach whopping 10000 days the last round bracket
is unnecessarily removed from output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agodocs: add --time-format to last(1) manual page
Sami Kerola [Tue, 27 Aug 2013 17:15:00 +0000 (18:15 +0100)] 
docs: add --time-format to last(1) manual page

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: add --time-format with iso-8601 format
Sami Kerola [Tue, 27 Aug 2013 12:48:27 +0000 (13:48 +0100)] 
last: add --time-format with iso-8601 format

The ISO-8601 format makes consuming time stamps easy with various
parsers.  The format includes time zone information which is crucial when
an investigator is trying to make sense outputs collected from systems
all a across planet.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: use configuration struct
Sami Kerola [Tue, 27 Aug 2013 12:15:08 +0000 (13:15 +0100)] 
last: use configuration struct

This allows reducing global variables and will minimize number of
arguments for functions making code a little bit easier to read, and
maintain.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: fix --present option logic error
Sami Kerola [Tue, 27 Aug 2013 10:48:54 +0000 (11:48 +0100)] 
last: fix --present option logic error

Printing of sessions 'still logged in' was skipped because an error in
logic.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agodocs: add --since and time option formats to last(1) manual
Sami Kerola [Mon, 26 Aug 2013 21:14:19 +0000 (22:14 +0100)] 
docs: add --since and time option formats to last(1) manual

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: add --since time spec option
Sami Kerola [Mon, 26 Aug 2013 20:52:54 +0000 (21:52 +0100)] 
last: add --since time spec option

The --since and --until options are companions often needed together.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolib/time-util: move YYYYMMDDHHMMSS to common parser
Sami Kerola [Thu, 29 Aug 2013 15:11:41 +0000 (16:11 +0100)] 
lib/time-util: move YYYYMMDDHHMMSS to common parser

Even while the YYYYMMDDHHMMSS time format it not magnificent it is best
to make it to be part of the one, and only, time format parser.

Proposed-by: Karel Zak <kzak@redhat.com>
References: http://markmail.org/message/6baqt4ttkopu7ra6
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: parse easy to use time formats
Sami Kerola [Mon, 26 Aug 2013 20:43:05 +0000 (21:43 +0100)] 
last: parse easy to use time formats

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolib/strutils: move *swith() functions to private library
Sami Kerola [Thu, 29 Aug 2013 14:50:17 +0000 (15:50 +0100)] 
lib/strutils: move *swith() functions to private library

Avoid code dublication in libmount and time-util.

Proposed-by: Karel Zak <kzak@redhat.com>
Reference: http://markmail.org/message/h7zexvqsieqngtmx
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolib/time-util: copy time parsing functions from systemd
Sami Kerola [Mon, 26 Aug 2013 15:53:57 +0000 (16:53 +0100)] 
lib/time-util: copy time parsing functions from systemd

The functions are copied nearly as-is.  Coding style has been modified to
match with util-linux project, while the functionality remains untouched.

CC: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agowrite: change determination can user write to a terminal
Sami Kerola [Sun, 18 Aug 2013 09:44:13 +0000 (10:44 +0100)] 
write: change determination can user write to a terminal

Earlier test failed when user had write permission, but was not in
special group that owns terminal devices, usually tty.

This made write(1) to fail for root, if the root did not happen to be in
tty group.  In this commit root is granted ot write to anyone, even if
they have mesg(1) turned off.  For an user who is trying to write to own
other session the group write bit is significant only for whether mesg(1)
are enabled.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agodocs: add note to wall(1) about sessions which will not get message
Sami Kerola [Sun, 18 Aug 2013 08:51:46 +0000 (09:51 +0100)] 
docs: add note to wall(1) about sessions which will not get message

Sessions that has in utmp data ut_line begining with ':' are skipped.
This is done to avoid write errors to devices such as '/dev/:0'.  For
example wdm is reported to to generate such utmp line.

Perhaps in future this code should be revalidated.  If an utmp data
contains broken device lines it might be best inform user with a error
message, rather than skipping silently suspicious device entries.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agodocs: add --present to last(1) manual page
Sami Kerola [Sun, 18 Aug 2013 08:33:40 +0000 (09:33 +0100)] 
docs: add --present to last(1) manual page

I forgot to update manual after writing this functionality.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agowall: line wrap at column 79 also when line has tab chars
Sami Kerola [Sun, 18 Aug 2013 00:17:34 +0000 (01:17 +0100)] 
wall: line wrap at column 79 also when line has tab chars

Earlier tabs caused random ragged right indentation, because the tab
length was assumed to be 1 char which is not the case most of the time.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agomesg: sync usage() with howto-usage-function.txt
Sami Kerola [Sat, 17 Aug 2013 23:50:08 +0000 (00:50 +0100)] 
mesg: sync usage() with howto-usage-function.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agowall: sync usage() with howto-usage-function.txt
Sami Kerola [Sat, 17 Aug 2013 23:46:02 +0000 (00:46 +0100)] 
wall: sync usage() with howto-usage-function.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: fix typo
Sami Kerola [Sat, 17 Aug 2013 23:40:52 +0000 (00:40 +0100)] 
last: fix typo

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agowall: send message also to sessions opened by user 'sleeper'
Sami Kerola [Sat, 17 Aug 2013 23:36:57 +0000 (00:36 +0100)] 
wall: send message also to sessions opened by user 'sleeper'

Ignoring an user by name, and not telling about it in manual page, is
unexpected.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agobuild-sys: pylibmount will not work when python3 is present
Sami Kerola [Mon, 26 Aug 2013 12:11:44 +0000 (13:11 +0100)] 
build-sys: pylibmount will not work when python3 is present

While compiling with up to date Archlinux I notice the recently added
pylibmount does not link correctly.  Failures inform fundamental types
such as PyFileObject and PyFile_Type being missing.

It seems automake AM_PATH_PYTHON will prefer the python in path, which
for this distribution right now is python3.  As some sort of go-around
one can install older python, and symlink it to earlier in PATH lookup.

$ ln -s /usr/bin/python2 $HOME/bin/python
$ export PATH=$HOME/bin:$PATH

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agosu: suppress PAM info messages for -c or non-login sessions
Karel Zak [Tue, 27 Aug 2013 09:23:54 +0000 (11:23 +0200)] 
su: suppress PAM info messages for -c or non-login sessions

The 'Last login:' messages from PAM lastlogin module is unexpected
for non-login sessions or when -c <command> executed.

For example:

  $ su - -c id
  Last login: Wed Jul 24 08:36:28 CEST 2013 from dhcp-25-161.brq.redhat.com on pts/18
  uid=0(root) gid=0(root) skupiny=0(root)

this makes 'su' useless in scripts.

This patch suppress all PAM_TEXT_INFO messages for -c and for
non-login session ('-' is not specified) after pam_authenticate() and
pam_acct_mgmt().

Note that the new PAM conversation function checks the first message
in the msg[] array only. It seems good enough as PAM internally uses
pam_info() function that does not use multiple messages for one conv
call.

References: https://bugzilla.redhat.com/show_bug.cgi?id=987787
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: add CFLAGS and LDFLAGS for daemons and shared libs
Karel Zak [Tue, 27 Aug 2013 08:02:04 +0000 (10:02 +0200)] 
build-sys: add CFLAGS and LDFLAGS for daemons and shared libs

This is necessary for paranoid security guys who believe that things
like "-Wl,-z,relro" or "-Wl,-z,bind_now" is a way how to make the
world a safer place...

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agotests: minor changes to make tests more portable
Karel Zak [Mon, 26 Aug 2013 11:48:40 +0000 (13:48 +0200)] 
tests: minor changes to make tests more portable

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoswapon: cleanup man page
Karel Zak [Fri, 23 Aug 2013 11:02:18 +0000 (13:02 +0200)] 
swapon: cleanup man page

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoswapon: allow a more flexible swap discard policy
Rafael Aquini [Sun, 26 May 2013 04:31:56 +0000 (01:31 -0300)] 
swapon: allow a more flexible swap discard policy

Introduce the necessary changes to swapon(8) allowing a sysadmin to leverage
the new changes introduced to sys_swapon by "swap: discard while swapping
only if SWAP_FLAG_DISCARD_PAGES", therefore allowing a more flexible set of
choices when selection the discard policy for mounted swap areas.
This patch introduces the following optional arguments to the already
existent swapon(8) "--discard" option, in order to allow a discard type to
be selected at swapon time:
 * once    : only single-time area discards are issued. (swapon)
 * pages   : discard freed pages before they are reused.
If no policy is selected both discard types are enabled. (default)

[kzak@redhat.com: - support <policy> argument for short -d option too,
                  - add errx() on unsupported policy name]

Signed-off-by: Rafael Aquini <aquini@redhat.com>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolast: mention optional arguments in usage
Karel Zak [Fri, 23 Aug 2013 10:01:01 +0000 (12:01 +0200)] 
last: mention optional arguments in usage

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolast: add --present option
Sami Kerola [Sat, 17 Aug 2013 18:15:21 +0000 (19:15 +0100)] 
last: add --present option

The --present option will allow user to easily determine who where logged
in at a given time.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: allow --file to be defined multiple times
Sami Kerola [Sat, 17 Aug 2013 18:15:20 +0000 (19:15 +0100)] 
last: allow --file to be defined multiple times

This is useful when an admin is trying to find something, and has to
process all available data.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: global variables are initialize automatically to zero
Sami Kerola [Sat, 17 Aug 2013 18:15:19 +0000 (19:15 +0100)] 
last: global variables are initialize automatically to zero

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: use as narrow variable scoping as possible
Sami Kerola [Sat, 17 Aug 2013 18:15:17 +0000 (19:15 +0100)] 
last: use as narrow variable scoping as possible

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: remove broken code
Sami Kerola [Sat, 17 Aug 2013 18:15:16 +0000 (19:15 +0100)] 
last: remove broken code

Comment in the deletion tells everything necessary.

"This doesn't work on modern systems, where only a DNS lookup of the
result from hostname() will get you the domainname.  Remember that
domainname() is the NIS domainname, not DNS.  So basically this whole
piece of code is bullshit."

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: prefer enum rather than #definition list
Sami Kerola [Sat, 17 Aug 2013 18:15:15 +0000 (19:15 +0100)] 
last: prefer enum rather than #definition list

Incremental number lists are more hard to get wrong with enum, and they
are nicer to debug as for example gdb is aware of these symbolic names.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: make switch cases complete, and inform if impossible occurs
Sami Kerola [Sat, 17 Aug 2013 18:15:14 +0000 (19:15 +0100)] 
last: make switch cases complete, and inform if impossible occurs

Some of the ut_type numbers does not seem to be recognized by last(1) so
they are, at least for now, silently ignored.  See glibc documentation
for information what the ignored EMPTY, INIT_PROCESS, LOGIN_PROCESS, and
ACCOUNTING mean.

Reference: FIXME
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: check expected numeric user input is number
Sami Kerola [Sat, 17 Aug 2013 18:15:13 +0000 (19:15 +0100)] 
last: check expected numeric user input is number

This commit also changes the line count to use unsigned integers, as
negative numbers in this context does not make sense.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolast: use carefulput() for printable character output
Sami Kerola [Sat, 17 Aug 2013 18:15:12 +0000 (19:15 +0100)] 
last: use carefulput() for printable character output

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoinclude: carefulput: print determined char when unprintable char is found
Sami Kerola [Sat, 17 Aug 2013 18:15:11 +0000 (19:15 +0100)] 
include: carefulput: print determined char when unprintable char is found

This is done to allow reuse of the functin in last(1).

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agodocs: add long options to last.1 manual page
Sami Kerola [Sat, 17 Aug 2013 18:15:10 +0000 (19:15 +0100)] 
docs: add long options to last.1 manual page

And align the manual page with Documentation/howto-man-page.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agodocs: be clear which last(1) is deprecated
Sami Kerola [Sat, 17 Aug 2013 18:15:09 +0000 (19:15 +0100)] 
docs: be clear which last(1) is deprecated

The recently merged sysvinit last(1) and lastb(1) are supported.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agobuild-sys: complete elvtune removal
Sami Kerola [Sat, 17 Aug 2013 18:15:08 +0000 (19:15 +0100)] 
build-sys: complete elvtune removal

The first removal managed to remove only most of the elvtune, this commit
will complete the task.

Original-removal: 7f1fe74248290c50f5447c2c09fcf0f0575a7666
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agodocs: update TODO
Sami Kerola [Sat, 17 Aug 2013 18:15:07 +0000 (19:15 +0100)] 
docs: update TODO

The minix type fixes took place December 2012.

Commit: a180dc6c54f90896d6491f9bdf704523236dd99c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agobuild-sys: remove unnecessary environment variable
Sami Kerola [Sat, 17 Aug 2013 18:15:06 +0000 (19:15 +0100)] 
build-sys: remove unnecessary environment variable

The addition to original removal done in commit 952f1d79.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agopylibmount: improve helps strings formatting
Karel Zak [Thu, 22 Aug 2013 11:24:00 +0000 (13:24 +0200)] 
pylibmount: improve helps strings formatting

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: add debug messages
Karel Zak [Thu, 22 Aug 2013 10:10:13 +0000 (12:10 +0200)] 
pylibmount: add debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: cleanup libmnt_fs list after mnt_table_remove_fs()
Karel Zak [Thu, 22 Aug 2013 09:57:06 +0000 (11:57 +0200)] 
libmount: cleanup libmnt_fs list after mnt_table_remove_fs()

.. otherwise mnt_free_fs() will try to remove FS from non-existing
list.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: use libmount reference counting
Karel Zak [Thu, 22 Aug 2013 07:44:38 +0000 (09:44 +0200)] 
pylibmount: use libmount reference counting

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomisc: use libmnt_table reference counter
Karel Zak [Wed, 21 Aug 2013 14:07:51 +0000 (16:07 +0200)] 
misc: use libmnt_table reference counter

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: add reference counter to libmnt_table
Karel Zak [Wed, 21 Aug 2013 14:07:25 +0000 (16:07 +0200)] 
libmount: add reference counter to libmnt_table

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomisc: use libmnt_cache reference counting
Karel Zak [Wed, 21 Aug 2013 12:38:38 +0000 (14:38 +0200)] 
misc: use libmnt_cache reference counting

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: add reference counting to libmnt_cache
Karel Zak [Wed, 21 Aug 2013 12:37:55 +0000 (14:37 +0200)] 
libmount: add reference counting to libmnt_cache

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agofsck: use libmount fs reference counter
Karel Zak [Wed, 21 Aug 2013 10:53:15 +0000 (12:53 +0200)] 
fsck: use libmount fs reference counter

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: add reference counting to libmount_fs
Karel Zak [Wed, 21 Aug 2013 10:31:43 +0000 (12:31 +0200)] 
libmount: add reference counting to libmount_fs

 * mnt_new_fs() returns object with refcount=1
 * mnt_free_fs() does not care about reference counter

 * new functions mnt_ref_fs() and mnt_unref_fs()

 * mnt_table_add_fs() and mnt_table_rem_fs() uses reference counter

 * libmmnt_context uses reference counter for internal FS (as it could be
   shared outside the context)

 * backwardly incompatible change:

- FS could be deallocated after mnt_table_remove_fs()

 * it's recommended to use mnt_unref_fs() after mnt_table_add_fs()

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: remove Context_get_table()
Karel Zak [Wed, 21 Aug 2013 08:06:15 +0000 (10:06 +0200)] 
pylibmount: remove Context_get_table()

It's too problematic and too low-level to support it Py binding.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: cleanup cxt usage
Karel Zak [Wed, 21 Aug 2013 08:02:19 +0000 (10:02 +0200)] 
pylibmount: cleanup cxt usage

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: add function for context userdata
Karel Zak [Wed, 21 Aug 2013 08:01:23 +0000 (10:01 +0200)] 
libmount: add function for context userdata

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: remove unnecessary code
Karel Zak [Tue, 20 Aug 2013 15:52:47 +0000 (17:52 +0200)] 
pylibmount: remove unnecessary code

It's enough to call mnt_free_fs() to remove fs from the table.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: add mnt_table_is_empty(), improve table list usage
Karel Zak [Tue, 20 Aug 2013 12:35:13 +0000 (14:35 +0200)] 
libmount: add mnt_table_is_empty(), improve table list usage

Currently you have to use mnt_table_remove_fs() + mnt_free_fs() to
destroy the list in the table. This is complicated in same situations.
This patch allows to use mnt_free_fs() only.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: coding style changes, don't touch Context() status
Karel Zak [Tue, 20 Aug 2013 12:01:39 +0000 (14:01 +0200)] 
pylibmount: coding style changes, don't touch Context() status

It's better to follow libmnt_context status than allow to play any
nasty games with this important variables in Python.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: use only public libmount API in tab.c
Karel Zak [Tue, 20 Aug 2013 11:52:09 +0000 (13:52 +0200)] 
pylibmount: use only public libmount API in tab.c

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: add mnt_table_{first,last}_fs()
Karel Zak [Tue, 20 Aug 2013 11:48:43 +0000 (13:48 +0200)] 
libmount: add mnt_table_{first,last}_fs()

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: add new function to docs
Karel Zak [Tue, 20 Aug 2013 10:41:53 +0000 (12:41 +0200)] 
libmount: add new function to docs

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: add mnt_table_{set,get}_userdata()
Karel Zak [Tue, 20 Aug 2013 10:41:27 +0000 (12:41 +0200)] 
libmount: add mnt_table_{set,get}_userdata()

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: add mnt_table_with_comments()
Karel Zak [Tue, 20 Aug 2013 10:32:19 +0000 (12:32 +0200)] 
libmount: add mnt_table_with_comments()

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: cleanup *_HELP strings formatting
Karel Zak [Tue, 20 Aug 2013 10:07:24 +0000 (12:07 +0200)] 
pylibmount: cleanup *_HELP strings formatting

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: use mnt_fs_set_userdata() rather than ->userdata
Karel Zak [Tue, 20 Aug 2013 09:32:49 +0000 (11:32 +0200)] 
pylibmount: use mnt_fs_set_userdata() rather than ->userdata

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: fs.c - cleanup, remove libmount private stuff
Karel Zak [Tue, 20 Aug 2013 09:08:07 +0000 (11:08 +0200)] 
pylibmount: fs.c - cleanup, remove libmount private stuff

 * remove unnecessary comments
 * cleanup up strings format
 * remove direct access to private libmount stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: remove bindsrc from fs API
Karel Zak [Tue, 20 Aug 2013 08:49:14 +0000 (10:49 +0200)] 
pylibmount: remove bindsrc from fs API

It's unnecessary and very low-level.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: cleanup object names
Karel Zak [Mon, 19 Aug 2013 15:10:07 +0000 (17:10 +0200)] 
pylibmount: cleanup object names

Cxt -> Context
Tab -> Table

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: coding style changes in tab.c
Karel Zak [Mon, 19 Aug 2013 14:57:50 +0000 (16:57 +0200)] 
pylibmount: coding style changes in tab.c

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: coding style changes in fs.c
Karel Zak [Mon, 19 Aug 2013 14:51:23 +0000 (16:51 +0200)] 
pylibmount: coding style changes in fs.c

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: coding style changes in context.c
Karel Zak [Mon, 19 Aug 2013 14:40:47 +0000 (16:40 +0200)] 
pylibmount: coding style changes in context.c

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agotests: consolidate Py tests initialization
Karel Zak [Mon, 19 Aug 2013 13:35:52 +0000 (15:35 +0200)] 
tests: consolidate Py tests initialization

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: install pylibmount into
Karel Zak [Mon, 19 Aug 2013 13:24:33 +0000 (15:24 +0200)] 
build-sys: install pylibmount into

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: add regression tests
Ondrej Oprala [Mon, 19 Aug 2013 13:11:06 +0000 (15:11 +0200)] 
pylibmount: add regression tests

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopylibmount: add __init__.py
Ondrej Oprala [Mon, 19 Aug 2013 13:06:37 +0000 (15:06 +0200)] 
pylibmount: add __init__.py

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
11 years agopylibmount: basic code
Ondrej Oprala [Mon, 19 Aug 2013 13:00:15 +0000 (15:00 +0200)] 
pylibmount: basic code

[kzak@redhat.com: - split to more patches
                  - split to more .c files]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: add pylibmount
Karel Zak [Mon, 19 Aug 2013 12:57:21 +0000 (14:57 +0200)] 
build-sys: add pylibmount

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: remove deprecated elvtune command
Karel Zak [Tue, 13 Aug 2013 13:55:52 +0000 (15:55 +0200)] 
build-sys: remove deprecated elvtune command

The command is deprecated for years and useless with 2.6.x kernels.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: enable mesg(1) by default
Karel Zak [Tue, 13 Aug 2013 12:11:12 +0000 (14:11 +0200)] 
build-sys: enable mesg(1) by default

It seems that our mesg(1) implementation is compatible with sysvinit,
let's use it by default in mainstream distros.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agowall: make banner sysvinit compatible
Karel Zak [Tue, 13 Aug 2013 10:23:21 +0000 (12:23 +0200)] 
wall: make banner sysvinit compatible

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agowall: allow to specify <message> on command line
Karel Zak [Tue, 13 Aug 2013 09:45:54 +0000 (11:45 +0200)] 
wall: allow to specify <message> on command line

wall(1) from sysvinit supports

   # wall I love this company!

semantic, This patch add this functionally to the util-linux wall.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolast: add link to util-linux to last.1
Karel Zak [Tue, 13 Aug 2013 08:26:28 +0000 (10:26 +0200)] 
last: add link to util-linux to last.1

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolast: coding style clean up
Karel Zak [Tue, 13 Aug 2013 08:22:50 +0000 (10:22 +0200)] 
last: coding style clean up

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolast: use xalloc.h, err.h, nls.h and EXIT_ macros
Karel Zak [Mon, 12 Aug 2013 12:10:42 +0000 (14:10 +0200)] 
last: use xalloc.h, err.h, nls.h and EXIT_ macros

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolast: consolidate btmp/wtmp file paths
Karel Zak [Mon, 12 Aug 2013 11:42:25 +0000 (13:42 +0200)] 
last: consolidate btmp/wtmp file paths

 .. so share the paths with another utils.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolast: add long options, improve usage()
Karel Zak [Mon, 12 Aug 2013 11:39:11 +0000 (13:39 +0200)] 
last: add long options, improve usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: fix last stuff
Karel Zak [Mon, 12 Aug 2013 10:59:52 +0000 (12:59 +0200)] 
build-sys: fix last stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: improbe UL_CONFLICT_BUILD macro
Karel Zak [Mon, 12 Aug 2013 10:59:22 +0000 (12:59 +0200)] 
build-sys: improbe UL_CONFLICT_BUILD macro

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolast: clean up the begin of the file
Karel Zak [Mon, 12 Aug 2013 10:26:03 +0000 (12:26 +0200)] 
last: clean up the begin of the file

 .. and improve last(1) stuff in configure script.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolast: merge sysvinit last/lastb
Ondrej Oprala [Tue, 6 Aug 2013 16:19:37 +0000 (18:19 +0200)] 
last: merge sysvinit last/lastb

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoagetty: -L accepts optional argument
Karel Zak [Tue, 6 Aug 2013 13:39:11 +0000 (15:39 +0200)] 
agetty: -L accepts optional argument

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolosetup: use loop-control to explicitly ask for device
Karel Zak [Tue, 6 Aug 2013 09:04:35 +0000 (11:04 +0200)] 
losetup: use loop-control to explicitly ask for device

Now we use LOOP_CTL_GET_FREE ioctl to ask for free device, for example

  losetup -f foo.img

Unfortunately, losetup(8) allows to ask for specified device

  losetup /dev/loop100 foo.img

and in this case we assume that the device already exists in the
system. This is incorrect, we should be able to use loop-control
LOOP_CTL_ADD ioctl to ask for the specified device.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoblkdiscard: use fstat() rather than stat() [coverity scan]
Karel Zak [Tue, 6 Aug 2013 08:29:04 +0000 (10:29 +0200)] 
blkdiscard: use fstat() rather than stat() [coverity scan]

 Calling function "open(char const *, int, ...)" that uses "path" after
 a check function. This can cause a time-of-check, time-of-use race
 condition.

.. well, in blkdiscard context it's mostly cosmetic change.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolosetup: fix loop device name usage
Karel Zak [Mon, 5 Aug 2013 14:03:15 +0000 (16:03 +0200)] 
losetup: fix loop device name usage

The code is not paranoid enough, loopcxt_set_device() only set the
device name to loopdev struct, but it does not check if the device
really exists.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: be robust when work with loopdev backing file paths
Karel Zak [Mon, 5 Aug 2013 13:24:30 +0000 (15:24 +0200)] 
libmount: be robust when work with loopdev backing file paths

It's usually unnecessary as we compare devno and ino, but let's
use absolute paths for situations when it's necessary to compare
paths as strings.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolosetup: make -j <path> more robust
Karel Zak [Mon, 5 Aug 2013 13:24:30 +0000 (15:24 +0200)] 
losetup: make -j <path> more robust

It's usually unnecessary as we compare devno and ino, but let's
use absolute paths for situations when it's necessary to compare
paths as strings.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: canonicalize for conversion from loopdev backing file
Karel Zak [Mon, 5 Aug 2013 11:58:01 +0000 (13:58 +0200)] 
libmount: canonicalize for conversion from loopdev backing file

  # mount foo.img /mnt
  # umount foo.img
  umount: foo.img: not mounted

The loopdev code (and sysfs backing_file) uses absolute paths, but
libmount does not canonicalize the path before lookup for the backing file.

References: https://bugzilla.redhat.com/show_bug.cgi?id=950497
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agocal: set statically defined data read-only
Sami Kerola [Sat, 3 Aug 2013 23:15:21 +0000 (00:15 +0100)] 
cal: set statically defined data read-only

Signed-off-by: Sami Kerola <kerolasa@iki.fi>