Karel Zak [Thu, 18 Apr 2013 08:50:30 +0000 (10:50 +0200)]
build-sys: use pkg-config results for libuser
Our code depends on libuser >= 0.58, it's better to completely rely on
pkg-config results rather than also call UL_CHECK_LIB (that overwrites
previous pkg-config have_user= result independently on libuser
version).
Karel Zak [Fri, 12 Apr 2013 10:35:34 +0000 (12:35 +0200)]
libmount: fix mount.nfs segfault, rely on assert() rather than on nonnull
We use
mnt_optstr_append_option(&o, mnt_fs_get_vfs_options(fs), NULL);
in mount.nfs, unfortunately mnt_optstr_append_option() has been marked
ass nonnull(1, 2). That's wrong because append and prepend should
robust enough to accept NULL as option name.
The patch also removes almost all __attribute__((nonnull). It seems
better to rely on assert() to have usable feedback. In many cases
(nonnull) is premature optimization for the library. This attribute
makes sense for things like strlen() or so...
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=948274 Signed-off-by: Karel Zak <kzak@redhat.com>
Jeff Mahoney [Tue, 9 Apr 2013 12:32:50 +0000 (14:32 +0200)]
loopdev: sync capacity after setting it
I recently tried to mount an hfsplus file system from an image file with
a partition table by using the loop offset and sizelimit options to specify
the location of the file system.
hfsplus stores some metadata at a set offset from the end of the partition,
so it's sensitive to the device size reported by the kernel.
/proc/partitions shows the correct number of blocks to match the sizelimit.
But if I set a breakpoint in mount before the mount syscall, I could see: 102400000 102432768
The kernel loop driver will set the gendisk capacity of the device at
LOOP_SET_STATUS64 but won't sync it to the block device until one of two
conditions are met: All open file descriptors referring to the device are
closed (and it will sync when re-opened) or if the LOOP_SET_CAPACITY ioctl
is called to sync it. Since mount opens the device and passes it directly
to the mount syscall after LOOP_SET_STATUS64 without closing and reopening
it, the sizelimit argument is effectively ignroed. The capacity needs to
be synced immediately for it to work as expected.
This patch adds the LOOP_SET_CAPACITY call to loopctx_setup_device since
the device isn't yet released to the user, so it's safe to sync the capacity
immediately.
[kzak@redhat.com: - port to the current git HEAD,
- use uint64_t]
Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola [Mon, 8 Apr 2013 19:32:53 +0000 (20:32 +0100)]
tools: add checks to manual page test script
This change includes
- better way to detect manual page inclusion
- man -k header test, which uses lexgrog
- repeated word detection
- static declaration to known repeated words
Most of the changes are based on man-page-day-1.sh, that is in use at
RedHat Quality Assurance, and wrote by Peter Schiffer.
CC: Peter Schiffer <pschiffe@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Mon, 8 Apr 2013 19:32:52 +0000 (20:32 +0100)]
libblkid: number of functions should not be declared extern [smatch scan]
These functions are already marked extern in header file.
libblkid/src/dev.c:70:19: warning: function 'blkid_dev_devname' with external linkage has definition
libblkid/src/dev.c:128:26: warning: function 'blkid_dev_iterate_begin' with external linkage has definition
libblkid/src/dev.c:148:12: warning: function 'blkid_dev_set_search' with external linkage has definition
libblkid/src/dev.c:175:12: warning: function 'blkid_dev_next' with external linkage has definition
libblkid/src/dev.c:196:13: warning: function 'blkid_dev_iterate_end' with external linkage has definition
libblkid/src/tag.c:84:12: warning: function 'blkid_dev_has_tag' with external linkage has definition
libblkid/src/tag.c:282:26: warning: function 'blkid_tag_iterate_begin' with external linkage has definition
libblkid/src/tag.c:303:12: warning: function 'blkid_tag_next' with external linkage has definition
libblkid/src/tag.c:322:13: warning: function 'blkid_tag_iterate_end' with external linkage has definition
libblkid/src/tag.c:336:18: warning: function 'blkid_find_dev_with_tag' with external linkage has definition
Sami Kerola [Mon, 8 Apr 2013 19:32:50 +0000 (20:32 +0100)]
various: fix shadow declarations [smatch scan]
libmount/src/tab.c:990:34: warning: symbol 'fs' shadows an earlier one
libmount/src/tab.c:970:26: originally declared here
misc-utils/findmnt.c:492:30: warning: symbol 'tmp' shadows an earlier one
misc-utils/findmnt.c:473:14: originally declared here
fdisks/fdiskdoslabel.c:211:36: warning: symbol 'pe' shadows an earlier one
fdisks/fdiskdoslabel.c:180:20: originally declared here
fdisks/fdiskdoslabel.c:639:34: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:578:16: originally declared here
fdisks/fdiskdoslabel.c:947:21: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:924:16: originally declared here
fdisks/fdiskdoslabel.c:976:29: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:924:16: originally declared here
fdisks/fdiskdoslabel.c:984:29: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:924:16: originally declared here
[kzak@redhat.com: - don't use local 'tmp' in findmnt.c]
Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola [Mon, 8 Apr 2013 19:32:49 +0000 (20:32 +0100)]
various: fix variable and function declarations [smatch scan]
disk-utils/fsck.minix.c:511:9: warning: mixing declarations and code
fdisks/sfdisk.c:982:5: warning: mixing declarations and code
fdisks/sfdisk.c:1254:5: warning: mixing declarations and code
fdisks/sfdisk.c:1564:5: warning: mixing declarations and code
lib/mbsalign.c:279:7: warning: mixing declarations and code
libblkid/src/devname.c:378:17: warning: mixing declarations and code
libfdisk/src/alignment.c:219:9: warning: mixing declarations and code
term-utils/wall.c:111:9: warning: mixing declarations and code
text-utils/col.c:418:19: warning: non-ANSI function declaration of function 'flush_blanks'
text-utils/col.c:553:12: warning: non-ANSI function declaration of function 'alloc_line'
text-utils/rev.c:105:9: warning: mixing declarations and code
text-utils/tailf.c:245:9: warning: mixing declarations and code
Sami Kerola [Mon, 8 Apr 2013 19:32:48 +0000 (20:32 +0100)]
bash-completion: swapon: add options and fix argument
The initial bash-completion missed swapon options -L and -U. Use of
block device was proposed to be more appropriate than a path to a file.
Requested-by: Karel Zak <kzak@redhat.com>
References: http://marc.info/?l=util-linux-ng&m=136517310727426&w=2 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Mon, 8 Apr 2013 19:32:46 +0000 (20:32 +0100)]
setarch: clean up usage()
Requested-by: Karel Zak <kzak@redhat.com>
References: http://marc.info/?l=util-linux-ng&m=136516351523680&w=2 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Ville Skyttä [Sun, 7 Apr 2013 08:56:12 +0000 (11:56 +0300)]
bash-completion: Symlink runuser symlink to su so it gets loaded on demand.
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com: - use '-runuser' in the install hook
- use the hook only if runuser is enabled]
Ville Skyttä [Sun, 7 Apr 2013 08:12:08 +0000 (11:12 +0300)]
bash-completion: Don't offer short options where corresponding long one exists.
Users who know the short options can just hit the short option instead
of tab, and it's not likely that it would be helpful to present a list
of single character options to users who don't know them, doing so
just unnecessarily trashes the list of suggestions.
Sami Kerola [Fri, 5 Apr 2013 20:17:24 +0000 (21:17 +0100)]
logger: allow to log using tcp transport protocol
This commit fixes error in usage() text, which claimed TCP is default
transport protocol. That was not true, and neither it should be. The
syslog messages has traditionally sent using UDP.
For the logger remains using UDP as first transport, but if it fails a
TCP connection is attempted. If an user wishes remote logging can be
forced to use either UDP or TCP. The service port for UDP is familiar
'syslog', for TCP the port 'syslog-conn' seems like reasonable default.
[kzak@redhat.com: - rename myopenlog to unix_socket(),
- always reset st to -1]
Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola [Tue, 2 Apr 2013 19:42:57 +0000 (20:42 +0100)]
logger: make local sockets to try both stream and datagram
When journald, from systemd, is in use logger gave following error.
$ logger --socket /dev/log test logger: connect /dev/log: Protocol wrong
type for socket
The journald supports only AF_DGRAM, and nothing else. Support for
AF_STREAM sockets was dropped because it messed up message ordering.
From an users point of view necessity to add --udp (UNIX(TM) Datagram
Protocol?) option when talking to syslog via unix socket felt confusing
and wrong. The command should know what is the socket type, and silently
use the correct one, unless the type is explicitely defined.
CC: Karel Zak <kzak@redhat.com> Adviced-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Tue, 2 Apr 2013 19:42:56 +0000 (20:42 +0100)]
chrt: make command syntax easier to understand in usage()
And mention in manual that the default is referring to the internal
default of this command, not the Linux system default. Manual page
example also tries to be a little more complete how to use the command.
Sami Kerola [Tue, 2 Apr 2013 19:42:54 +0000 (20:42 +0100)]
setterm: fix various color option argument lists
The lists did not have correct colors in usage(). Because the usage()
had to be fixed, it is best to make the output easy for translators to
work with.