]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
13 years agoinclude [optutils]: add exclusive_option() inline function
Sami Kerola [Thu, 14 Jun 2012 18:17:51 +0000 (20:17 +0200)] 
include [optutils]: add exclusive_option() inline function

The exclusive_option() will unify how exclusive options are
determined.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agopartx: use -s option for default output
Davidlohr Bueso [Tue, 12 Jun 2012 12:50:06 +0000 (14:50 +0200)] 
partx: use -s option for default output

It's been around a year and a half now that partx was rewritten,
and the legacy output should no longer be default.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agolib/blkdev: return static strings by blkdev_scsi_type_to_name()
Karel Zak [Fri, 15 Jun 2012 11:14:30 +0000 (13:14 +0200)] 
lib/blkdev: return static strings by blkdev_scsi_type_to_name()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolsblk: use fallback for TYPE
Karel Zak [Fri, 15 Jun 2012 11:13:40 +0000 (13:13 +0200)] 
lsblk: use fallback for TYPE

 ... bug introduced by 1edd8af70b4794c796d0faed0cf763ff3474b92e

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoinclude/blkdev: cleanup up
Karel Zak [Fri, 15 Jun 2012 11:01:51 +0000 (13:01 +0200)] 
include/blkdev: cleanup up

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoMerge branch '2012wk23' of git://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Fri, 15 Jun 2012 10:44:17 +0000 (12:44 +0200)] 
Merge branch '2012wk23' of git://github.com/kerolasa/lelux-utiliteetit

* '2012wk23' of git://github.com/kerolasa/lelux-utiliteetit:
  lsblk: use blkdev_scsi_type_to_name()
  blkdev: add blkdev_scsi_type_to_name()
  wipefs: use symbolic value for markup mode
  eject: inform if CD-ROM drive is not ready
  docs: clean up partx.8 manual
  include: fix void pointer arithmetics warnings
  sysfs: fix printf format warnings
  build: fix unused parameter warnings
  build: fix redundant redeclaration warnings
  include: fix spurious list.h warnings
  uuidd: use output redirection which works [checkbashisms]
  blkid: fix realloc memory leak [cppcheck]
  setarch: do not use -1 as array index [cppcheck]

13 years agolibmount: make some string operations more robust
Karel Zak [Fri, 15 Jun 2012 10:26:05 +0000 (12:26 +0200)] 
libmount: make some string operations more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: fix trivial typos
Petr Uzel [Thu, 14 Jun 2012 14:13:03 +0000 (16:13 +0200)] 
libmount: fix trivial typos

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agolibmount: fix read before allocated buffer
Petr Uzel [Thu, 14 Jun 2012 14:13:02 +0000 (16:13 +0200)] 
libmount: fix read before allocated buffer

valgrind --leak-check=full ./sys-utils/mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux
....
==21359== Invalid read of size 1
==21359==    at 0x415AC6: mnt_optstr_remove_option_at (optstr.c:310)
==21359==    by 0x416358: mnt_optstr_apply_flags (optstr.c:716)
==21359==    by 0x40DFBF: mnt_context_prepare_mount (context_mount.c:86)
==21359==    by 0x40EB5A: mnt_context_mount (context_mount.c:782)
==21359==    by 0x4058B0: main (mount.c:918)
==21359==  Address 0x51cd5bf is 1 bytes before a block of size 10 alloc'd
==21359==    at 0x4C297CD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21359==    by 0x4C29957: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21359==    by 0x415780: __mnt_optstr_append_option (optstr.c:188)
==21359==    by 0x412822: mnt_fs_append_options (fs.c:764)
==21359==    by 0x409288: mnt_context_append_options (context.c:733)
==21359==    by 0x4053F0: main (mount.c:776)

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agolibmount: plug a memory leak in exec_helper()
Petr Uzel [Thu, 14 Jun 2012 14:13:01 +0000 (16:13 +0200)] 
libmount: plug a memory leak in exec_helper()

valgrind --leak-check=full ./sys-utils/mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux
....
==21359== 28 bytes in 1 blocks are definitely lost in loss record 1 of 1
==21359==    at 0x4C298B2: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21359==    by 0x415780: __mnt_optstr_append_option (optstr.c:188)
==21359==    by 0x415CB5: mnt_optstr_set_option (optstr.c:387)
==21359==    by 0x40D778: do_mount (context_mount.c:192)
==21359==    by 0x40E6A9: mnt_context_do_mount (context_mount.c:685)
==21359==    by 0x40EB7B: mnt_context_mount (context_mount.c:786)
==21359==    by 0x4058B0: main (mount.c:918)

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agolibblkid: update dm-verity scan
Milan Broz [Tue, 12 Jun 2012 11:18:02 +0000 (13:18 +0200)] 
libblkid: update dm-verity scan

New superblock now contains UUID. Old version is not going to be used.

Signed-off-by: Milan Broz <mbroz@redhat.com>
13 years agosetsid: fix off-by-one error in execvp call
Bernhard Voelker [Wed, 6 Jun 2012 14:34:55 +0000 (16:34 +0200)] 
setsid: fix off-by-one error in execvp call

Bug introduced during --ctty implementation by v2.21-112-g8a2f04d.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
13 years agosu: remove unimplemented options -u and -v
Bernhard Voelker [Wed, 6 Jun 2012 13:30:52 +0000 (15:30 +0200)] 
su: remove unimplemented options -u and -v

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
13 years agoflock: user-configurable exit code
Jan \"Yenya\" Kasprzak [Tue, 5 Jun 2012 14:26:58 +0000 (16:26 +0200)] 
flock: user-configurable exit code

When locking the file fails with -n or -w option, caller has no way
to distinguish between the exit code 1 of the -c command,
and the exit code 1 of flock(1) caused by the conflicting lock.

Add a new -E <exitcode> (--conflict-exit-code) option to set
the exit code for the case of locking failure to any value.

13 years agomount: (new) allow sloppy for non-root
Karel Zak [Thu, 14 Jun 2012 12:43:21 +0000 (14:43 +0200)] 
mount: (new) allow sloppy for non-root

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=825836
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: don't use nosuid,noexec,nodev for cifs user=foo
Karel Zak [Thu, 14 Jun 2012 12:19:26 +0000 (14:19 +0200)] 
libmount: don't use nosuid,noexec,nodev for cifs user=foo

   mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux

is incorrectly translated to

   mount.cifs -o noexec,nosuid,nodev,user=root,password=linux ...

The command mount(8) should be sensitive to "user" (without "=<name>")
only. The correct cifs command line is:

   mount.cifs -o user=root,password=linux

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=766157
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: don't generate empty option strings
Karel Zak [Thu, 14 Jun 2012 09:38:53 +0000 (11:38 +0200)] 
libmount: don't generate empty option strings

 mount -t foo something /mnt/test -o user=root,password=linux

generates

 "rw,noexec,nosuid,nodev,password=linux,,user=root"

options string for /sbin/mount.foo, the ",," is incorrect.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoeject: cleanup umount code
Karel Zak [Wed, 13 Jun 2012 13:58:16 +0000 (15:58 +0200)] 
eject: cleanup umount code

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoeject: don't try to use non-device path
Karel Zak [Wed, 13 Jun 2012 11:55:49 +0000 (13:55 +0200)] 
eject: don't try to use non-device path

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoeject: add --no-partitions-unmount
Karel Zak [Wed, 13 Jun 2012 11:46:24 +0000 (13:46 +0200)] 
eject: add --no-partitions-unmount

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agotools: add small and stupid script to check HAVE_DECL_
Karel Zak [Wed, 13 Jun 2012 09:59:29 +0000 (11:59 +0200)] 
tools: add small and stupid script to check HAVE_DECL_

 use 'make checkdecl' to run the script

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibblkid: trust in udev symlinks, don't verify
Karel Zak [Tue, 12 Jun 2012 14:31:39 +0000 (16:31 +0200)] 
libblkid: trust in udev symlinks, don't verify

The libblkid always verify that /dev/disk/by-* symlinks match with
on-device LABELs/UUIDs. It means that all requests (e.g. mount -L |
-U) generates extra superblocks scans on the device.

Currently, many users and tools (GNOME, systemd, ...etc) use the
symlink directly and udev maintains the symlinks by inotify (+watch
rule). It seems better for system performance to disable the extra
paranoid mode and trust in udev.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolosetup: improve -a to report loopdevs < 512 bytes
Karel Zak [Tue, 12 Jun 2012 13:41:47 +0000 (15:41 +0200)] 
losetup: improve -a to report loopdevs < 512 bytes

 # ll ~/xxx2
  -rw-r--r-- 1 root root 500 Jun 12 14:30 /root/xxx2

 old version:
  # losetup -a

 new version:
  # losetup -a
  /dev/loop0: [2052]:535312 (/root/xxx2)

The new version scans /sys/block/loopN, kernel >= 2.6.37 is required
otherwise fallback to the original not-so-smart /proc/partitions scan.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=730266
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolosetup: warn about backing file size
Karel Zak [Tue, 12 Jun 2012 12:34:16 +0000 (14:34 +0200)] 
losetup: warn about backing file size

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=730266
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolsblk: use blkdev_scsi_type_to_name()
Sami Kerola [Mon, 11 Jun 2012 19:22:38 +0000 (21:22 +0200)] 
lsblk: use blkdev_scsi_type_to_name()

Replace inline version of similar, but less complete, functionality
with the lib/blkdev.c function.  The function will inform if a type is
unknown, which appears as hex string value.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoblkdev: add blkdev_scsi_type_to_name()
Sami Kerola [Mon, 11 Jun 2012 19:17:38 +0000 (21:17 +0200)] 
blkdev: add blkdev_scsi_type_to_name()

Add a function, and necessary symbols, to convert scsi type id's
to name strings.

Reference: http://permalink.gmane.org/gmane.linux.utilities.util-linux-ng/5994
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agowipefs: use symbolic value for markup mode
Sami Kerola [Sun, 10 Jun 2012 20:20:34 +0000 (22:20 +0200)] 
wipefs: use symbolic value for markup mode

In case mode value is found to be out of bounds program will crash.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoeject: inform if CD-ROM drive is not ready
Sami Kerola [Sun, 10 Jun 2012 20:03:57 +0000 (22:03 +0200)] 
eject: inform if CD-ROM drive is not ready

Include file (see linux/cdrom.h lines 395 and 398) suggests ioctl() can
return CDS_NO_INFO and CDS_DRIVE_NOT_READY, which where ignored.  This
commit will tell user what is going on.

The commit will also make eject to crash in ioctl() will return
unexpected value.

Reference: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=include/linux/cdrom.h;h=dfd7f187c351440d2ffa81050e46ed2602877f73;hb=HEAD
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: clean up partx.8 manual
Sami Kerola [Sun, 10 Jun 2012 16:20:48 +0000 (18:20 +0200)] 
docs: clean up partx.8 manual

* Remove bold & italic noise.
* Reformat text to be 70 characters wide.
* Use option and option argument highlights consistently.
* Indent option argument list for --nr.
* Squeeze examples where the same is done multiple different ways.
* Use URL and email macros where appropriate.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoinclude: fix void pointer arithmetics warnings
Sami Kerola [Sun, 10 Jun 2012 14:49:51 +0000 (16:49 +0200)] 
include: fix void pointer arithmetics warnings

all-io.h:18:9: warning: pointer of type 'void *' used in arithmetic [-pedantic]
all-io.h:38:9: warning: pointer of type 'void *' used in arithmetic [-pedantic]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agosysfs: fix printf format warnings
Sami Kerola [Sun, 10 Jun 2012 14:48:31 +0000 (16:48 +0200)] 
sysfs: fix printf format warnings

sysfs.c:93:3: warning: format '%u' expects argument of type 'unsigned
int *', but argument 3 has type 'int *' [-Wformat]
sysfs.c:93:3: warning: format '%u' expects argument of type 'unsigned
int *', but argument 4 has type 'int *' [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild: fix unused parameter warnings
Sami Kerola [Sun, 10 Jun 2012 14:44:54 +0000 (16:44 +0200)] 
build: fix unused parameter warnings

pager.c:203:14: warning: unused parameter 'argc' [-Wunused-parameter]
pager.c:203:26: warning: unused parameter 'argv' [-Wunused-parameter]

randutils.c:108:14: warning: unused parameter 'argc' [-Wunused-parameter]
randutils.c:108:26: warning: unused parameter 'argv' [-Wunused-parameter]

optstr.c:774:37: warning: unused parameter 'optstr' [-Wunused-parameter]
optstr.c:774:51: warning: unused parameter 'value' [-Wunused-parameter]
optstr.c:774:65: warning: unused parameter 'valsz' [-Wunused-parameter]
optstr.c:774:79: warning: unused parameter 'next' [-Wunused-parameter]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild: fix redundant redeclaration warnings
Sami Kerola [Sun, 10 Jun 2012 14:37:11 +0000 (16:37 +0200)] 
build: fix redundant redeclaration warnings

env.c:24:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]
su.c:81:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]

fstab.c:581:14: warning: redundant redeclaration of 'strsignal' [-Wredundant-decls]

kill.h:1:13: note: previous declaration of 'get_pids' was here
kill.c:152:13: warning: redundant redeclaration of 'get_pids' [-Wredundant-decls]

kill.c:142:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]
getopt.c:89:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]

agetty.c:536:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls]
agetty.c:537:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
script.c:161:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
wall.c:96:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]

libmount.h:362:26: note: previous declaration of 'mnt_update_get_fs' was here
libmount.h:454:26: note: previous declaration of 'mnt_context_get_fs' was here
mountP.h:383:26: warning: redundant redeclaration of 'mnt_context_get_fs' [-Wredundant-decls]
mountP.h:398:26: warning: redundant redeclaration of 'mnt_update_get_fs' [-Wredundant-decls]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoinclude: fix spurious list.h warnings
Sami Kerola [Sun, 10 Jun 2012 09:09:08 +0000 (11:09 +0200)] 
include: fix spurious list.h warnings

include/list.h:224:17: warning: ISO C forbids omitting the middle term of a ?: expression [-pedantic]
include/list.h:255:19: warning: ISO C forbids omitting the middle term of a ?: expression [-pedantic]

Compilation warned about that at least 110 times.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agouuidd: use output redirection which works [checkbashisms]
Sami Kerola [Sat, 9 Jun 2012 21:20:04 +0000 (23:20 +0200)] 
uuidd: use output redirection which works [checkbashisms]

possible bashism in misc-utils/uuidd.rc line 52 (should be >word 2>&1):
if pidofproc -p $PIDFILE $DAEMON >& /dev/null ; then

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoblkid: fix realloc memory leak [cppcheck]
Sami Kerola [Sat, 9 Jun 2012 21:05:23 +0000 (23:05 +0200)] 
blkid: fix realloc memory leak [cppcheck]

[misc-utils/blkid.c:367]: (error) Common realloc mistake: 'str' nulled but not freed upon failure

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agosetarch: do not use -1 as array index [cppcheck]
Sami Kerola [Sat, 9 Jun 2012 20:45:27 +0000 (22:45 +0200)] 
setarch: do not use -1 as array index [cppcheck]

Negative array index does technically work, but looks awkward and
can confuse static analyser such as cppcheck.

[sys-utils/setarch.c:267]: (error) Array index -1 is out of bounds

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild-sys: add compiler warnings
Karel Zak [Wed, 6 Jun 2012 10:10:41 +0000 (12:10 +0200)] 
build-sys: add compiler warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofdisk: fix io_size usage in new API
Karel Zak [Wed, 6 Jun 2012 09:03:23 +0000 (11:03 +0200)] 
fdisk: fix io_size usage in new API

properly implemented fdisk_dev_has_topology() requires optimal
I/O size to detect that the device provides topology.

Unfortunately, currently used cxt->io_size maybe overwritten in
__discover_topology() to min_io_size.

This patch introduces cxt->optimal_io_size and keeps it independent on
cxt->io_size. The cxt->io_size is I/O size used by fdisk for alignment
calculation.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofdisk: fix compiler warning [-Wunused-variable]
Karel Zak [Wed, 6 Jun 2012 08:56:29 +0000 (10:56 +0200)] 
fdisk: fix compiler warning [-Wunused-variable]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofdisk: fix compiler warning [-Wpointer-sign]
Karel Zak [Wed, 6 Jun 2012 08:53:20 +0000 (10:53 +0200)] 
fdisk: fix compiler warning [-Wpointer-sign]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofdisk: fix compiler warnings [-Wsign-compare]
Karel Zak [Wed, 6 Jun 2012 08:48:26 +0000 (10:48 +0200)] 
fdisk: fix compiler warnings [-Wsign-compare]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofdisk: remove user specified sector size global variable
Davidlohr Bueso [Sun, 3 Jun 2012 17:47:44 +0000 (19:47 +0200)] 
fdisk: remove user specified sector size global variable

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: add fdisk_dev_sectsz_is_default helper
Davidlohr Bueso [Sun, 3 Jun 2012 18:15:34 +0000 (20:15 +0200)] 
fdisk: add fdisk_dev_sectsz_is_default helper

Instead of printing this warning from the API, add a helper and call it from
fdisk logic.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: use EXIT_SUCCESS for -l option
Davidlohr Bueso [Sun, 3 Jun 2012 18:15:30 +0000 (20:15 +0200)] 
fdisk: use EXIT_SUCCESS for -l option

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: add total sectors
Davidlohr Bueso [Sun, 3 Jun 2012 18:15:20 +0000 (20:15 +0200)] 
fdisk: add total sectors

Add the total_sectors variable to the context structure. This is the initial
geometry information.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: add device topology to the API
Davidlohr Bueso [Sun, 3 Jun 2012 18:15:17 +0000 (20:15 +0200)] 
fdisk: add device topology to the API

This patch adds device topology discovery to the internal API. This
functionality is static only to the API and therefore hidden from general fdisk
code. Functionality itself doesn't really change, min_io_size, io_size, logical
and physical sector sizes and alignment offset are added to the fdisk_context
structure and elements are accessed from there. The logical sector size
(sector_size) is now unsigned long instead of unsigned int, this as no effect
otherwise.

A few things to notice:
 - The patch is larger than I wanted but we need to modify function parameters
   across fdisk and its labels to use the topology data from cxt-> instances.
   Hopefully this will be pretty much it regarding this kind of modifications -
   perhaps geometry will need something of the like too.

 - The -b option must override internal discovery.

 - A new helper function has added to verify if the device provides topology
   information, this replaces the 'has_topology' global variable.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: sun: use sector_t
Davidlohr Bueso [Sun, 27 May 2012 19:44:24 +0000 (21:44 +0200)] 
fdisk: sun: use sector_t

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: sgi: use sector_t
Davidlohr Bueso [Sun, 27 May 2012 19:44:20 +0000 (21:44 +0200)] 
fdisk: sgi: use sector_t

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: dos: use sector_t
Davidlohr Bueso [Sun, 27 May 2012 19:44:17 +0000 (21:44 +0200)] 
fdisk: dos: use sector_t

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: introduce sector_t type
Davidlohr Bueso [Sun, 27 May 2012 19:44:13 +0000 (21:44 +0200)] 
fdisk: introduce sector_t type

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: remove useless comments
Davidlohr Bueso [Sun, 27 May 2012 19:44:07 +0000 (21:44 +0200)] 
fdisk: remove useless comments

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: use context as a parameter
Davidlohr Bueso [Sun, 27 May 2012 19:44:04 +0000 (21:44 +0200)] 
fdisk: use context as a parameter

This program heavily uses global variables, which isn't very elegant and can
lead to nasty bugs. Modify functions that use fdisk's context current features
(descriptor and path), to receive the context as a parameter instead of
globally. This includes DOS, SUN, SGI and BSD label code. Another benefit that
comes with this is that as the API grows all the information regarding fdisk
will be accessible from this structure so we can reduce even more global
variables and simply code.

This patch passed:
 - building
 - regression tests
 - local dos/sun/bsd partition changes

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: stop buffering welcome message
Davidlohr Bueso [Sun, 27 May 2012 19:43:56 +0000 (21:43 +0200)] 
fdisk: stop buffering welcome message

Recently, commit 0a86755fe8af1da510d2eca43bdfcd70af098c19 directed the welcome
message output from stderr to stdout breaking regression tests.  Correct this
by flushing stdout and stop buffering the output - a trivial function is
created as well.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agobuild-sys: suid su in make install
Karel Zak [Tue, 5 Jun 2012 15:38:09 +0000 (17:38 +0200)] 
build-sys: suid su in make install

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agologin: fix compiler warning [-Wsign-compare]
Karel Zak [Tue, 5 Jun 2012 14:59:54 +0000 (16:59 +0200)] 
login: fix compiler warning [-Wsign-compare]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoMerge branch '2012wk22' of git://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Tue, 5 Jun 2012 14:57:01 +0000 (16:57 +0200)] 
Merge branch '2012wk22' of git://github.com/kerolasa/lelux-utiliteetit

* '2012wk22' of git://github.com/kerolasa/lelux-utiliteetit:
  docs: clean up getopt.1 manual
  docs: clean up dmesg.1 manual
  docs: clean up chcpu.8 manual
  fileutils: xmkstemp() interface change
  docs: fix all man page groff warnings
  tools: add checkmans.sh
  docs: clean up wdctl.8 manual
  docs: clean up login.1 manual
  login: allow TTYGROUP name begin by number
  build-sys: add su executable to .gitignore
  logindefs: change getlogindefs_num() to return unsigned long

Conflicts:
login-utils/su.c
sys-utils/dmesg.1

13 years agosu: preserve errno in cleanup_pam()
Ludwig Nussel [Tue, 5 Jun 2012 13:31:24 +0000 (15:31 +0200)] 
su: preserve errno in cleanup_pam()

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agoinclide/env: innclude c.h, remove _() macro from xsetenv()
Karel Zak [Tue, 5 Jun 2012 13:44:12 +0000 (15:44 +0200)] 
inclide/env: innclude c.h, remove _() macro from xsetenv()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: trim leading commas from each options string
Dave Reisner [Sun, 3 Jun 2012 16:25:47 +0000 (12:25 -0400)] 
libmount: trim leading commas from each options string

Fixes a bug in option string parsing wherein a line such as:

  ro,relatime,,nosuid,nodev

Will be seen as only the tokens "ro" and "relatime" after the parser
encounters a zero length (and erroneously declared NULL) option.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agobuild-sys: include correct source file for chsh
Dave Reisner [Sat, 2 Jun 2012 17:38:02 +0000 (13:38 -0400)] 
build-sys: include correct source file for chsh

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agosu: use BSD err function instead of gnu's error()
Ludwig Nussel [Fri, 1 Jun 2012 12:51:21 +0000 (14:51 +0200)] 
su: use BSD err function instead of gnu's error()

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: remove unused code
Ludwig Nussel [Fri, 1 Jun 2012 12:51:20 +0000 (14:51 +0200)] 
su: remove unused code

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: replace PAM_BAIL_P macro with better solution
Ludwig Nussel [Fri, 1 Jun 2012 12:51:19 +0000 (14:51 +0200)] 
su: replace PAM_BAIL_P macro with better solution

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: introduce xsetenv globally
Ludwig Nussel [Fri, 1 Jun 2012 12:51:18 +0000 (14:51 +0200)] 
su: introduce xsetenv globally

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: use ENV_PATH resp ENV_SUPATH to be consistent with login
Ludwig Nussel [Fri, 1 Jun 2012 12:51:17 +0000 (14:51 +0200)] 
su: use ENV_PATH resp ENV_SUPATH to be consistent with login

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: use EXIT_FAILURE consistently
Ludwig Nussel [Fri, 1 Jun 2012 12:51:16 +0000 (14:51 +0200)] 
su: use EXIT_FAILURE consistently

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: don't use custom MAX macro
Ludwig Nussel [Fri, 1 Jun 2012 12:51:15 +0000 (14:51 +0200)] 
su: don't use custom MAX macro

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agolibblkid: add dm-verity hash device detection
Milan Broz [Fri, 1 Jun 2012 11:34:08 +0000 (13:34 +0200)] 
libblkid: add dm-verity hash device detection

dm-verity can use separate device for hash verification,
in this case there is a superblock in the first sector.

See
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/device-mapper/verity.txt
for more info.

Signed-off-by: Milan Broz <mbroz@redhat.com>
13 years agolib/strutils: circumvent missing localeconv()
maximilian attems [Thu, 31 May 2012 17:40:49 +0000 (19:40 +0200)] 
lib/strutils: circumvent missing localeconv()

Add stub too nls.h, include it instead of locale.h.
Code in strutils handles already returned NULL.

Signed-off-by: maximilian attems <max@stro.at>
13 years agoMerge branch 'su.1' of https://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Tue, 5 Jun 2012 12:47:00 +0000 (14:47 +0200)] 
Merge branch 'su.1' of https://github.com/kerolasa/lelux-utiliteetit

* 'su.1' of https://github.com/kerolasa/lelux-utiliteetit:
  docs: rewrite su.1 manual
  docs: fix email macro in manual example
  docs: add su.1 manual page

13 years agodmesg: fix typo in man page
Karel Zak [Tue, 5 Jun 2012 12:40:10 +0000 (14:40 +0200)] 
dmesg: fix typo in man page

Reported-by: Hemant Borole <hemantborole@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoFix typos in comments and wall's man page
Bernhard Voelker [Tue, 29 May 2012 17:06:50 +0000 (19:06 +0200)] 
Fix typos in comments and wall's man page

Culprits identified again by (newer) misspellings:

  $ git ls-files | misspellings -f - | grep -v '^po/'

* wall: Fix typo in man page.
* Fix typos in source code comments.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
13 years agotext-utils/hexsyntax.c: fix for missing program_invocation_short_name
Andreas Bießmann [Mon, 4 Jun 2012 11:01:09 +0000 (13:01 +0200)] 
text-utils/hexsyntax.c: fix for missing program_invocation_short_name

Some libc do not expose program_invocation_short_name. Therefore util-linux
comes with helpers in 'c.h'. Use the 'c.h' in hexsyntax.c where it was missed.

This patch fixes following error for me:
---8<---
hexsyntax.c: In function 'newsyntax':
hexsyntax.c:115: error: 'program_invocation_short_name' undeclared (first use in this function)
hexsyntax.c:115: error: (Each undeclared identifier is reported only once
hexsyntax.c:115: error: for each function it appears in.)
--->8---

Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
13 years agomore: fix regex error messages printing
Karel Zak [Tue, 5 Jun 2012 12:19:13 +0000 (14:19 +0200)] 
more: fix regex error messages printing

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomore: remove a meaningless test
Jeremy Huntwork [Wed, 23 May 2012 21:51:15 +0000 (17:51 -0400)] 
more: remove a meaningless test

regexec only returns 0 or REG_NOMATCH so remove a meaningless test

Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agodocs: clean up getopt.1 manual
Sami Kerola [Sat, 2 Jun 2012 20:39:40 +0000 (22:39 +0200)] 
docs: clean up getopt.1 manual

* Add lightness to synopsis.
* Add spaces after dots (English spacing).
* Replace backticks by ticks.
* Reformat text to be 70 characters wide.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: clean up dmesg.1 manual
Sami Kerola [Sat, 2 Jun 2012 19:57:31 +0000 (21:57 +0200)] 
docs: clean up dmesg.1 manual

* Add lightness to synopsis.
* Add few missing italic highlights to text segments which refer
  command line argument(s).
* Turn off bold where ever possible (makes text unnecessarily heavy).
* Add spaces after dots (English spacing).
* Use URL and email macros where appropriate.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: clean up chcpu.8 manual
Sami Kerola [Sat, 2 Jun 2012 19:00:19 +0000 (21:00 +0200)] 
docs: clean up chcpu.8 manual

* Add lightness to synopsis.
* Use argument and parameter highlights consistently.
* Indent dispatch modes.
* Add spaces after dots (English spacing).
* Add line break macros.
* Use URL and email macros where appropriate.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agofileutils: xmkstemp() interface change
Dave Reisner [Sat, 2 Jun 2012 17:31:30 +0000 (19:31 +0200)] 
fileutils: xmkstemp() interface change

We can not let the user control where TMPDIR is for this tempfile.
This will be where we write the updated passwd file, and must be
capable of being moved atomically with rename(2).  Therefore, it
cannot be on a different device, or setpwnam() and vipw/vigr programs
will invariably fail with EXDEV.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: fix all man page groff warnings
Sami Kerola [Sat, 2 Jun 2012 12:50:52 +0000 (14:50 +0200)] 
docs: fix all man page groff warnings

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agotools: add checkmans.sh
Sami Kerola [Sat, 2 Jun 2012 12:36:43 +0000 (14:36 +0200)] 
tools: add checkmans.sh

A script to find whether all manuals has proper groff syntax.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: clean up wdctl.8 manual
Sami Kerola [Sat, 2 Jun 2012 11:48:56 +0000 (13:48 +0200)] 
docs: clean up wdctl.8 manual

Align with Documentation/howto-man-page.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: clean up login.1 manual
Sami Kerola [Sat, 2 Jun 2012 11:20:36 +0000 (13:20 +0200)] 
docs: clean up login.1 manual

PATH contents for users & root in DESCRIPTION section where wrong,
and couple default values where missing.  Rest of the change is about
making the groff, and the output, to look good.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agologin: allow TTYGROUP name begin by number
Sami Kerola [Sat, 2 Jun 2012 10:11:25 +0000 (12:11 +0200)] 
login: allow TTYGROUP name begin by number

Assuming someone is using a TTYGROUP name beginnign by a digit the
login was misbehaving with 'contains invalid numerical value: %s'
message(s) in syslog.  Please notice that group names that consist
only digits as characters are valid (but likely to cause confusion,
and chaos).

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild-sys: add su executable to .gitignore
Sami Kerola [Sat, 2 Jun 2012 10:00:48 +0000 (12:00 +0200)] 
build-sys: add su executable to .gitignore

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agologindefs: change getlogindefs_num() to return unsigned long
Sami Kerola [Sat, 2 Jun 2012 09:57:42 +0000 (11:57 +0200)] 
logindefs: change getlogindefs_num() to return unsigned long

Where ever getlogindefs_num() is called return value is always
expected to be unsigned, such as sleep() input, gid_t or mode_t.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: rewrite su.1 manual
Ludwig Nussel [Sat, 2 Jun 2012 05:10:12 +0000 (07:10 +0200)] 
docs: rewrite su.1 manual

Converting coreutils info page to manual did not result as good
manual pages as writing almost completely new.  Ludwig wrote the
text, Sami cleaned up groff syntax.

Reference: http://www.spinics.net/lists/util-linux-ng/msg06321.html
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: fix email macro in manual example
Sami Kerola [Wed, 30 May 2012 17:49:37 +0000 (19:49 +0200)] 
docs: fix email macro in manual example

URL macro is not email address macro.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: add su.1 manual page
Sami Kerola [Wed, 30 May 2012 17:44:45 +0000 (19:44 +0200)] 
docs: add su.1 manual page

The manual page is almost one to one copy with GNU Coreutils 'su
invocation' info page.  This manual also includes few examples, fix
to return values, hint about PAM configuration file, authors and see
also sections.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild-sys: move configure login options to one place
Karel Zak [Tue, 29 May 2012 13:24:04 +0000 (15:24 +0200)] 
build-sys: move configure login options to one place

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add --enable-vipw
Karel Zak [Tue, 29 May 2012 13:20:44 +0000 (15:20 +0200)] 
build-sys: add --enable-vipw

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add --enable-newgrp
Karel Zak [Tue, 29 May 2012 13:15:38 +0000 (15:15 +0200)] 
build-sys: add --enable-newgrp

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add --disable-su
Karel Zak [Tue, 29 May 2012 12:54:06 +0000 (14:54 +0200)] 
build-sys: add --disable-su

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add --enable-chfn-chsh
Karel Zak [Tue, 29 May 2012 12:41:01 +0000 (14:41 +0200)] 
build-sys: add --enable-chfn-chsh

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add --disable-login
Karel Zak [Tue, 29 May 2012 12:14:38 +0000 (14:14 +0200)] 
build-sys: add --disable-login

... to implement fine-grained control on what is built from
login-utils.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agosu: remove program_name
Karel Zak [Tue, 29 May 2012 10:53:46 +0000 (12:53 +0200)] 
su: remove program_name

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agosu: fix compiler warning [-Wunused-parameter]
Karel Zak [Tue, 29 May 2012 09:01:23 +0000 (11:01 +0200)] 
su: fix compiler warning [-Wunused-parameter]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: remove -DUSE_PAM=1 for su(1)
Karel Zak [Tue, 29 May 2012 08:51:29 +0000 (10:51 +0200)] 
build-sys: remove -DUSE_PAM=1 for su(1)

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agosu: Mention SUID_* feature.
Thomas Schwinge [Fri, 25 May 2012 18:41:01 +0000 (20:41 +0200)] 
su: Mention SUID_* feature.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>