Karel Zak [Fri, 17 May 2013 10:35:23 +0000 (12:35 +0200)]
fdisk: add new stuff to display menus
fdisk menus:
- driven by menu and menu_entry structs
- supports normal and expect mode
- supports multiple independent menus
- supports menu separators to make output more readable
- allows to exclude by whole menu or menu entries by label type
TODO:
- define per label menus
- per menu callback
- sensitive only to keys defined in the currently printed menu
Karel Zak [Thu, 12 Sep 2013 10:44:09 +0000 (12:44 +0200)]
agetty: add \S to output /etc/os-release data
This patch allows to use a new \S or \S{VARNAME} sequence in the
/etc/issue file. The sequence prints data from /etc/os-release. The
reason is to keep /etc/issue file distribution and release
independent.
The \S{ANSI_COLOR} is converted to the real terminal escape seq.
For example:
\S
Kernel \r on an \m (\l)
or more complex example:
Welcome to \S{ANSI_COLOR}\S{NAME}\e0m \S{VERSION}
Report bugs at \S{BUG_REPORT_URL}.
See http://www.freedesktop.org/software/systemd/man/os-release.html
fr more details about /etc/issue.
Based on patch from Bill Nottingham <notting@redhat.com>.
Karel Zak [Wed, 11 Sep 2013 13:37:05 +0000 (15:37 +0200)]
libblkid: don't use UUID= for xfs external log
The log UUID is usually the same as filesystem UUID, it is bad idea to
have two devices with the same UUID in the system. It seems batter to
use only LOGUUID= for xfs external log.
Karel Zak [Wed, 11 Sep 2013 09:15:33 +0000 (11:15 +0200)]
libblkid: populate jbd LOGUUID in addition to UUID
The LOGUUID is alias for UUID, this alias is necessary to standardize
the tag name (we want to use the same tag LOGUUID= for all external
logs on all filesystems).
Note that for another filesystems (e.g. xfs) we have to differentiate
between the journal and filesystem uuids to avoid collisions, because
both devices use the same uuid.
Eric Sandeen [Mon, 5 Aug 2013 23:09:35 +0000 (18:09 -0500)]
libblkid: Detect external XFS log device
Detects external XFS log devices with a minimum size of 10MB. It's possible to
craft a smaller log, but that would be very unlikely; it'd require a small XFS
filesystem and an intentionally small log, which would defeat the performance
goal of an external log in the first place.
[kzak@redhat.com: - use UUID_LOG variable name for the log uuid]
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
This happen because oversight when 'exitval' gets to be set. By clance,
one might expect main() to call next() which will return value for
'exitval'. That assessment misses later call chain main() -> display()
-> get() -> next(), which in reverse should return correct value for
'exitval'.
It was mentioned in util-linux maillist that Ondrej Oprala is working on
major renewal of the hexdump . That in mind it seems best to simply to
revert the global 'exitval' and avoid conflict with Ondrej's work.
Reference: http://markmail.org/message/sbnvuhkboreujj5p Reported-by: Dave Reisner <d@falconindy.com> CC: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Thu, 29 Aug 2013 09:34:00 +0000 (10:34 +0100)]
utmpdump: make IPv6 addresses work
(unless bug[s]) This change is backwards compatibile. Earlier binary to
text dumps can be converted back to binary, or otherway around.
The only thing that will not work are IPv6 addresses that possible
earlier conversion had broke. Such conversions resulted with random IPv4
in place of IPv6 address in text format, and original information is gone
forever.
Sami Kerola [Thu, 29 Aug 2013 06:46:46 +0000 (07:46 +0100)]
last, utmpdump, agetty, wall, write: avoid compatibility hacks
In include/bits/utmp.h the ut_user and ut_time macros are marked with
comment they are backwards compatibility hacks. It is probably best to
avoid use of these macros where ever possible.
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.
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.
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.
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.
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.
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>
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...
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>
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."
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>