]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
11 years agolibblkid: remove optimization from verify( funrtion stable/v2.22
Karel Zak [Fri, 1 Feb 2013 14:59:58 +0000 (15:59 +0100)] 
libblkid: remove optimization from verify( funrtion

Now libblkid (the cache based part) tries to probe for the cached
filesystem firstly. This optimization is broken, because:

  * new another superblock could be on the device and the original
    is already obsolete
  * we still need to probe for partitions and raids
  * the code was too fragile

The patch also suggests lsblk --fs in blkid.8 for end users. lsblk
read information from used db.

Reported-by: Andreas Hofmeister <andi@collax.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agocal: don't mix ncurses output functions and printf()
Karel Zak [Thu, 17 Jan 2013 17:48:16 +0000 (18:48 +0100)] 
cal: don't mix ncurses output functions and printf()

Fedora 18 (ncurses-libs-5.9-7.20121017, glibc-2.16-28):

$ cal | cat
Actual results:
    January 2013    Su Mo Tu We Th Fr Sa       1  2  3  4  5 6  7  8
9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 30 31

Not sure where is the problem, but it's too fragile to mix two
output methods in one code.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=896447
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agohexdump: do not segfault when iterating over an empty format string
Ondrej Oprala [Fri, 21 Dec 2012 12:04:04 +0000 (13:04 +0100)] 
hexdump: do not segfault when iterating over an empty format string

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
11 years agoagetty: replace perms 660 to 620
Karel Zak [Wed, 2 Jan 2013 07:23:00 +0000 (08:23 +0100)] 
agetty: replace perms 660 to 620

 ... the default is root:tty 620

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: release++ (v2.22.2) v2.22.2
Karel Zak [Thu, 13 Dec 2012 11:16:17 +0000 (12:16 +0100)] 
build-sys: release++ (v2.22.2)

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agodocs: update v2.22.2-ReleaseNotes
Karel Zak [Thu, 13 Dec 2012 11:14:25 +0000 (12:14 +0100)] 
docs: update v2.22.2-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agodocs: update AUTHORS file
Karel Zak [Thu, 13 Dec 2012 11:07:29 +0000 (12:07 +0100)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopo: merge changes
Karel Zak [Wed, 12 Dec 2012 21:17:51 +0000 (22:17 +0100)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopo: update da.po (from translationproject.org)
Joe Hansen [Wed, 12 Dec 2012 20:57:56 +0000 (21:57 +0100)] 
po: update da.po (from translationproject.org)

11 years agopo: update cs.po (from translationproject.org)
Petr Pisar [Wed, 12 Dec 2012 20:57:56 +0000 (21:57 +0100)] 
po: update cs.po (from translationproject.org)

11 years agolibmount: fix typos
Karel Zak [Wed, 12 Dec 2012 20:01:32 +0000 (21:01 +0100)] 
libmount: fix typos

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoblkid: fix double free [coverity scan]
Karel Zak [Wed, 12 Dec 2012 19:48:15 +0000 (20:48 +0100)] 
blkid: fix double free [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: make mkstemp() more robust [coverity scan]
Karel Zak [Wed, 12 Dec 2012 12:32:52 +0000 (13:32 +0100)] 
libmount: make mkstemp() more robust [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoswapon: fix memmory leak [coverity scan]
Karel Zak [Wed, 12 Dec 2012 11:40:48 +0000 (12:40 +0100)] 
swapon: fix memmory leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibblkid: check mkdir(/run/blkid) return code [coverity scan]
Karel Zak [Wed, 12 Dec 2012 11:27:05 +0000 (12:27 +0100)] 
libblkid: check mkdir(/run/blkid) return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agologin: check lastlog lseek return code [coverity scan]
Karel Zak [Wed, 12 Dec 2012 10:48:08 +0000 (11:48 +0100)] 
login: check lastlog lseek return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agochsh: use return rather than exit in main, clean up man page
Karel Zak [Wed, 12 Dec 2012 09:48:01 +0000 (10:48 +0100)] 
chsh: use return rather than exit in main, clean up man page

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agochfn: always use return rather than exit() in main
Karel Zak [Wed, 12 Dec 2012 09:41:44 +0000 (10:41 +0100)] 
chfn: always use return rather than exit() in main

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agochfn: clean up exit status
Karel Zak [Wed, 12 Dec 2012 09:36:32 +0000 (10:36 +0100)] 
chfn: clean up exit status

The old version in some cases (but not always) returns -1 (255) on
error. It seems better to cleanup the code and don't return internal
return codes by exit().

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoblkid: fix man page mess
Karel Zak [Mon, 10 Dec 2012 11:25:25 +0000 (12:25 +0100)] 
blkid: fix man page mess

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibblkid: re-read PART{UUID,LABEL} for successfully verified cached devices
Karel Zak [Tue, 4 Dec 2012 12:02:57 +0000 (13:02 +0100)] 
libblkid: re-read PART{UUID,LABEL} for successfully verified cached devices

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolsblk: fix copy & past bug
Karel Zak [Tue, 27 Nov 2012 09:44:28 +0000 (10:44 +0100)] 
lsblk: fix copy & past bug

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoumount: sanitize paths from non-root users
Karel Zak [Mon, 26 Nov 2012 15:25:46 +0000 (16:25 +0100)] 
umount: sanitize paths from non-root users

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomount: sanitize paths from non-root users
Karel Zak [Mon, 26 Nov 2012 13:30:22 +0000 (14:30 +0100)] 
mount: sanitize paths from non-root users

 $ mount /root/.ssh/../../dev/sda2
 mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot

this is too promiscuous. It seems better to ignore on command line
specified paths which are not resolve-able for non-root users.

Fixed version:

  $ mount /root/.ssh/../../dev/sda2
  mount: /root/.ssh/../../dev/sda2: Permission denied

  $ mount /dev/sda2
  mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot

Note that this bug has no relation to mount(2) permissions evaluation
in suid mode. The way how non-root user specifies paths on command
line is completely irrelevant for comparison with fstab entries.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolib/canonicalize: add canonicalize_path_restricted() to canonicalize without suid...
Karel Zak [Mon, 26 Nov 2012 15:24:28 +0000 (16:24 +0100)] 
lib/canonicalize: add canonicalize_path_restricted() to canonicalize without suid permisssions

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: make debug stuff more robust
Karel Zak [Mon, 26 Nov 2012 11:19:02 +0000 (12:19 +0100)] 
libmount: make debug stuff more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agodocs: remove dead link
Sami Kerola [Tue, 23 Oct 2012 19:50:38 +0000 (20:50 +0100)] 
docs: remove dead link

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agowipefs: Add --force option to force it to erase.
Richard W.M. Jones [Mon, 19 Nov 2012 15:02:13 +0000 (15:02 +0000)] 
wipefs: Add --force option to force it to erase.

Commit c550f728f724360f99aae0fdb45b0589d9a347e0 added O_EXCL when
opening the thing to erase.  This broke the wipefs utility when used
on anything which isn't an unmounted filesystem.  eg. If you use it on
a block device containing partitions, then it won't work because the
kernel recognizes the partitions and so thinks the device is in use.

This change adds the --force option which, when used, undoes the above
flag change.  However you still have to use --force most of the time
when erasing something that isn't a plain unmounted filesystem.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
11 years agolibmount: correctly interpret '*' from /etc/filesystems
Karel Zak [Mon, 26 Nov 2012 10:21:40 +0000 (11:21 +0100)] 
libmount: correctly interpret '*' from /etc/filesystems

 - single line with '*' in /etc/filesystems means that libmount has to
   read /proc/filesystems, otherwise /proc/filesystems has to be ignored

 - mount(2) ENODEV is no reason to break the do_mount_by_pattern()
   loop when trying to mount by /{etc,proc}/filesystems

Reported-by: NeilBrown <neilb@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibblkid: (gpt) don't modify in memory buffers
Karel Zak [Wed, 21 Nov 2012 14:47:56 +0000 (15:47 +0100)] 
libblkid: (gpt) don't modify in memory buffers

LIBBLKID_DEBUG=0xffff blkid -p ....

gpt: ---> call probefunc()
reuse buffer: off=0 len=1024 pr=0xb0b690
reuse buffer: off=0 len=1024 pr=0xb0b690
reuse buffer: off=1024 len=16384 pr=0xb0b690
GPT entries corrupted
reuse buffer: off=10737417728 len=512 pr=0xb0b690
reuse buffer: off=10737401344 len=16384 pr=0xb0b690
GPT entries corrupted
gpt: <--- (rc = 1)

Reported-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agouuidgen: fix --random
Karel Zak [Mon, 19 Nov 2012 08:50:08 +0000 (09:50 +0100)] 
uuidgen: fix --random

Addresses: https://github.com/karelzak/util-linux/issues/20
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolscpu: make read_topology() more robust to avoid SIGFPE
Karel Zak [Tue, 13 Nov 2012 09:36:25 +0000 (10:36 +0100)] 
lscpu: make read_topology() more robust to avoid SIGFPE

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: fix support of comma-separated fs types lists
Gleb Fotengauer-Malinovskiy [Thu, 27 Sep 2012 16:48:34 +0000 (20:48 +0400)] 
libmount: fix support of comma-separated fs types lists

# grep cdrom /etc/fstab
/dev/sr0 /media/cdrom udf,iso9660 ro,noauto,user,utf8 0 0
# mount /media/cdrom
mount: unknown filesystem type 'udf,iso9660'

# mount -t udf,iso9660 /dev/sr0 /media/cdrom
mount: /dev/sr0 is write-protected, mounting read-only

[kzak@redhat.com: - add some comments
                  - don't try to found external helpers for the types]

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: don't reset NOSWAPMATCH context flag
Karel Zak [Thu, 15 Nov 2012 15:42:05 +0000 (16:42 +0100)] 
libmount: don't reset NOSWAPMATCH context flag

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: don't try to play with loopdevs if umount argument is really mountpoint
Karel Zak [Thu, 15 Nov 2012 14:59:59 +0000 (15:59 +0100)] 
libmount: don't try to play with loopdevs if umount argument is really mountpoint

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: more robust tab filter usage
Karel Zak [Thu, 15 Nov 2012 14:35:24 +0000 (15:35 +0100)] 
libmount: more robust tab filter usage

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibblkid: remove obsolete tags from cache
Karel Zak [Wed, 14 Nov 2012 12:14:29 +0000 (13:14 +0100)] 
libblkid: remove obsolete tags from cache

The libblkid cache tags are not removed if a new version of the
tags is empty (e.g. label 'foo' -> '').

 # mkfs.ext4 -L test_label /dev/sda15
 # blkid /dev/sda15
 /dev/sda15: LABEL="test_label"

 # tune2fs -L '' /dev/sda15
 # blkid /dev/sda15
 /dev/sda15: LABEL="test_label"
                    ^^^^^^^^^^

Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoumount: allways return MOUNT_EX_*
Karel Zak [Tue, 13 Nov 2012 15:50:02 +0000 (16:50 +0100)] 
umount: allways return MOUNT_EX_*

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agotests: remove lscpu /sys dumps without 'possible' CPU mask
Karel Zak [Mon, 12 Nov 2012 14:00:24 +0000 (15:00 +0100)] 
tests: remove lscpu /sys dumps without 'possible' CPU mask

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolscpu: Fix issue found on CPU hot-remove
Toshi Kani [Tue, 23 Oct 2012 19:49:46 +0000 (13:49 -0600)] 
lscpu: Fix issue found on CPU hot-remove

read_basicinfo() relies on sysfs cpu directories
"/sys/devices/system/cpu/cpu%d" with assumption that cpu
logical number %d is always sequentially assigned for all
CPUs. However, this assumption is not correct with CPU
hot-remove operation since it removes a target sysfs cpu
directory after it is ejected. As a result, lscpu may not
recognize all CPUs.

The issue can be easily reproduced on KVM or VirtualBox,
which supports CPU eject operation, as follows.

1) The system has 4 CPUs
  $ lscpu -a -e
  CPU NODE SOCKET CORE L1d:L1i:L2 ONLINE
  0   0    0      0    0:0:0      yes
  1   0    1      1    1:1:1      yes
  2   0    2      2    2:2:2      yes
  3   0    3      3    3:3:3      yes

2) Eject cpu2
  # echo 1 > /sys/bus/acpi/devices/LNXCPU:02/eject

3) lscpu no longer recognizes cpu3 after cpu2 is ejected
  $ lscpu -a -e
  CPU NODE SOCKET CORE L1d:L1i:L2 ONLINE
  0   0    0      0    0:0:0      yes
  1   0    1      1    1:1:1      yes

The following changes are made to address this issue.
 - Use maxcpus to allocate and parse bitmaps.
 - Set desc->ncpu from cpu/present, which includes both on-line
   and off-line CPUs.
 - Add is_cpu_present() to check if a CPU is present. Ejected
   CPUs are not present.

[kzak@redhat.com: - read also /sys/devices/system/cpu/possible mask to
                    determine maximal number of CPUs,
                  - err() if possible mask is not found in /sys]

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolib/loopdev: make loopcxt_get_device() more robust
Karel Zak [Mon, 12 Nov 2012 11:10:52 +0000 (12:10 +0100)] 
lib/loopdev: make loopcxt_get_device() more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoscript: do not try to close stderr twice
Sami Kerola [Tue, 6 Nov 2012 21:14:14 +0000 (21:14 +0000)] 
script: do not try to close stderr twice

The commit cdd2a8c360c70d16804ace7cc923a6c6bb7c9ca9 broke script(1)
return value.

$ script -e -c "echo"; echo $?
1

The reason, as Daniel it reported, was that the script will close stderr
twice, once as timing file and atexit() in function close_stdout().  This
commit fixes the problem.

Reported-by: Daniel Narvaez <dwnarvaez@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoagetty: fix autodetection for TERM
Michal Schmidt [Mon, 29 Oct 2012 22:33:01 +0000 (23:33 +0100)] 
agetty: fix autodetection for TERM

open_tty() autodetects whether to set TERM to "linux" or "vt102", but it
can apply the result only if op->term is still NULL.

11 years agomisc: make readlink() usage more robust
Karel Zak [Tue, 23 Oct 2012 10:40:39 +0000 (12:40 +0200)] 
misc: make readlink() usage more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agologin: fix compiler warning [-Wunused-result]
Karel Zak [Mon, 22 Oct 2012 11:13:02 +0000 (13:13 +0200)] 
login: fix compiler warning [-Wunused-result]

It's probably unnecessary paranoia, but let's check if we're able to
restore the original IDs after ~/.hushlogin file check.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agofsck.cramfs: compile with -DINCLUDE_FS_TESTS for make check
Karel Zak [Mon, 22 Oct 2012 08:10:55 +0000 (10:10 +0200)] 
fsck.cramfs: compile with -DINCLUDE_FS_TESTS for make check

 make check
 sudo su -
 cd tests
 ./run.sh cramfs

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolib/loopdev: check for /sys
Karel Zak [Wed, 17 Oct 2012 09:43:39 +0000 (11:43 +0200)] 
lib/loopdev: check for /sys

The current loopdev code prefers /sys to get information about
loop devices. The old methods like scan /dev are fallback solution
only. Unfortunately, the code does not check if /sys is mounted.

Addresses: http://blog.flameeyes.eu/2012/10/sophistication-can-be-bad
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolib/loopdev: improve debug messages
Karel Zak [Wed, 17 Oct 2012 09:42:21 +0000 (11:42 +0200)] 
lib/loopdev: improve debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomount: add long options for -L and -U to man page
Bill Pemberton [Wed, 10 Oct 2012 20:54:02 +0000 (16:54 -0400)] 
mount: add long options for -L and -U to man page

The -L and -U flags both have long options too (--label and --uuid).
The usage() function will show them but the man page didn't list them.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
11 years agomount: add -c abbreviation for --no-canonicalize to man page
Bill Pemberton [Wed, 10 Oct 2012 20:54:01 +0000 (16:54 -0400)] 
mount: add -c abbreviation for --no-canonicalize to man page

The --no-canonicalize option can also be set using -c.  The --help for
mount shows this option but the man page did not.  Add -c to the man
page.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
11 years agolibblkid: fix compiler warning [-Wstrict-aliasing]
Karel Zak [Mon, 15 Oct 2012 15:01:30 +0000 (17:01 +0200)] 
libblkid: fix compiler warning [-Wstrict-aliasing]

libblkid/src/superblocks/befs.c: In function 'get_uuid':
libblkid/src/superblocks/befs.c:353:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoswapon: remove loop declaration [smatch scan]
Sami Kerola [Mon, 8 Oct 2012 07:08:20 +0000 (08:08 +0100)] 
swapon: remove loop declaration [smatch scan]

sys-utils/swapon.c:677:2: error: 'for' loop initial declarations are
only allowed in C99 mode

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agowipefs: use O_EXCL
Karel Zak [Mon, 15 Oct 2012 10:38:09 +0000 (12:38 +0200)] 
wipefs: use O_EXCL

Address: https://bugzilla.redhat.com/show_bug.cgi?id=865961
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: don't use umount optimization for -l or -f
Karel Zak [Mon, 15 Oct 2012 09:10:50 +0000 (11:10 +0200)] 
libmount: don't use umount optimization for -l or -f

The options -l (lazy) and -f (force) means that the mountpoint may be
unreadable (for example because NFS server is unreadable). So we
should not try to be smart in this case and we should try to minimize
number of situations when stat() or readlink() is used for the
mountpoint.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: release++ (v2.22.1) v2.22.1
Karel Zak [Wed, 10 Oct 2012 12:56:16 +0000 (14:56 +0200)] 
build-sys: release++ (v2.22.1)

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agodocs: add v2.22.1-ReleaseNotes
Karel Zak [Wed, 10 Oct 2012 12:54:38 +0000 (14:54 +0200)] 
docs: add v2.22.1-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agodocs: update AUTHORS file
Karel Zak [Wed, 10 Oct 2012 12:49:53 +0000 (14:49 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopo: merge changes
Karel Zak [Wed, 10 Oct 2012 12:46:13 +0000 (14:46 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agotests: remove libgcc from config test results
Karel Zak [Wed, 10 Oct 2012 12:45:58 +0000 (14:45 +0200)] 
tests: remove libgcc from config test results

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agopo: add hr.po (from translationproject.org)
Tomislav Krznar [Wed, 10 Oct 2012 12:40:56 +0000 (14:40 +0200)] 
po: add hr.po (from translationproject.org)

11 years agopo: update vi.po (from translationproject.org)
Trần Ngọc Quân [Wed, 10 Oct 2012 12:40:56 +0000 (14:40 +0200)] 
po: update vi.po (from translationproject.org)

11 years agobuild-sys: clean update-potfiles script
Karel Zak [Wed, 10 Oct 2012 11:06:01 +0000 (13:06 +0200)] 
build-sys: clean update-potfiles script

 - use only sed(1)
 - remove config.h from the result
 - remove samples/, tests/, util-linu-*/ ("make ditcheck" product)
   directories from the result

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: remove --enable-gtk-doc from make check
Karel Zak [Wed, 10 Oct 2012 11:05:20 +0000 (13:05 +0200)] 
build-sys: remove --enable-gtk-doc from make check

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agosfdisk: fix aliasing warnings
Mike Frysinger [Wed, 10 Oct 2012 04:29:54 +0000 (00:29 -0400)] 
sfdisk: fix aliasing warnings

Compiles down to the same code.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agomd5: fix strict aliasing warnings
Mike Frysinger [Wed, 10 Oct 2012 04:22:38 +0000 (00:22 -0400)] 
md5: fix strict aliasing warnings

This is the same fix as was merged in gcc/binutils where this code
appears to originate from.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agotests: fix mount move test to work with shared mount
Milan Broz [Fri, 5 Oct 2012 16:37:40 +0000 (18:37 +0200)] 
tests: fix mount move test to work with shared mount

If parent mount for test directory is mounted with shared flag,
move mount test fails because kernel rejects mount move operation.

Use another directory level and explicitly make parent mount private.

(All "modern" systems using system have mounts shared for some reason.)

Signed-off-by: Milan Broz <mbroz@redhat.com>
11 years agotests: ignore test if kernel doesn't support minix fs
Milan Broz [Fri, 5 Oct 2012 16:37:39 +0000 (18:37 +0200)] 
tests: ignore test if kernel doesn't support minix fs

Minix mount test returs failure if kernel have no minix support,
 minix: mkfs ... FAILED (minix/mkfs)
ignore test result instead in this case.

Signed-off-by: Milan Broz <mbroz@redhat.com>
11 years agotests: fix timezone for cramfs
Milan Broz [Fri, 5 Oct 2012 16:37:38 +0000 (18:37 +0200)] 
tests: fix timezone for cramfs

cramfs test need explicitly set timezone otherwise
ls diff fails with
   cramfs: mkfs checksums ... FAILED (cramfs/mkfs)

Signed-off-by: Milan Broz <mbroz@redhat.com>
11 years agofdisk: add AArch64 support
Marcin Juszkiewicz [Wed, 3 Oct 2012 09:31:19 +0000 (10:31 +0100)] 
fdisk: add AArch64 support

Attached patch fixed build problem when util-linux is built for AArch64
architecture.

11 years agomount: add verbose messages
Karel Zak [Tue, 9 Oct 2012 09:56:35 +0000 (11:56 +0200)] 
mount: add verbose messages

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=864227
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agologin: reuse DEAD_PROCESS utmp entries
Karel Zak [Fri, 5 Oct 2012 10:07:10 +0000 (12:07 +0200)] 
login: reuse DEAD_PROCESS utmp entries

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=858009
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: fix umount file.img
Karel Zak [Fri, 5 Oct 2012 18:35:34 +0000 (20:35 +0200)] 
libmount: fix umount file.img

The umount optimization (commit 9cc03553f7b8494c7193024eec6e13b903eb2eec)
has to be disabled if the umount argument is not a directory.

Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agodmesg: fix console-level off-by-one
Bjørn Mork [Mon, 1 Oct 2012 23:54:49 +0000 (01:54 +0200)] 
dmesg: fix console-level off-by-one

  commit f06ec64f dmesg; support level names (e.g. --console-level=alert)

introduced an off-by-one error.  The kernel will print messages with
a *higher* level than the console-level. The bug made it impossible to
set the level for debugging, like it is documented in e.g
Documentation/networking/netconsole.txt :

 nemi:/tmp# dmesg -n 8
 dmesg: unknown level '8'

And attempting to set the "emerg" level would result in an invalid 0 value:

 nemi:/tmp# dmesg -n emerg
 dmesg: klogctl failed: Invalid argument

Restoring the old behaviour for numeric levels, and mapping the level
names so that "dmesg -n debug" behaves as expected: logging everything
at level "debug" and higher.

[kzak@redhat.com: - add comment to parse_level()]

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomount: fix a few typos
Mike Frysinger [Tue, 25 Sep 2012 22:39:00 +0000 (18:39 -0400)] 
mount: fix a few typos

Nothing of note here.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Conflicts:

mount-deprecated/mount.8
sys-utils/mount.8

11 years agotextual: typo fixes
Gilles Espinasse [Sat, 22 Sep 2012 07:59:19 +0000 (09:59 +0200)] 
textual: typo fixes

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
11 years agolsblk: fix reporting of 'part' type
Peter Rajnoha [Fri, 21 Sep 2012 12:23:32 +0000 (14:23 +0200)] 
lsblk: fix reporting of 'part' type

Partitions are incorrectly marked with 'disk' type on
lsblk output while it should be marked as 'part' type.

Before:
$ lsblk /dev/sda
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  128M  0 disk
`-sda1   8:1    0   64M  0 disk

With this patch applied:
$ lsblk /dev/sda
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  128M  0 disk
`-sda1   8:1    0   64M  0 part

Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
11 years agosu: don't modify PATH if -l not specified
Karel Zak [Tue, 2 Oct 2012 08:14:05 +0000 (10:14 +0200)] 
su: don't modify PATH if -l not specified

This patch reverts a6fdd3f8125be23930d955c2bc6b7a46cdaf8a12.

su(1) modifies PATH if:
  - option -l specified
  - ALWAYS_SET_PATH login.defs variable set

Reported-by: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoipcrm: avoid 'uninitialized' warning
Bernhard Voelker [Wed, 5 Sep 2012 13:12:01 +0000 (15:12 +0200)] 
ipcrm: avoid 'uninitialized' warning

GCC 4.1.2 on SLES 10.4:
sys-utils/ipcrm.c: In function ‘main’:
sys-utils/ipcrm.c:297: warning: ‘what_all’ may be used uninitialized in this function

* sys-utils/ipcrm.c: Initialize what_all to ALL.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
11 years agolibmount: don't setup new loopdev on remount with regular mtab
Karel Zak [Wed, 26 Sep 2012 09:25:01 +0000 (11:25 +0200)] 
libmount: don't setup new loopdev on remount with regular mtab

[chroot-i486] root:/tmp$ mount -oloop /tmp/blob /tmp/mnt
[chroot-i486] root:/tmp$ mount -o remount,loop,ro /tmp/mnt
[chroot-i486] root:/tmp$ mount
/dev/loop0 on /tmp/mnt type ext2 (ro,loop)
[chroot-i486] root:/tmp$ losetup -a
/dev/loop0: [2051]:306957 (/tmp/blob)
/dev/loop1: [0005]:2218 (/dev/loop0)
[chroot-i486] root:/tmp$ umount /tmp/mnt
umount: /tmp/mnt: filesystem umounted, but mount(8) failed: Device or
resource busy
[chroot-i486] root:/tmp$ losetup -d /dev/loop1
[chroot-i486] root:/tmp$ losetup -d /dev/loop0

Reported-by: g.esp@free.fr
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: optimize mtab and utab parsing in umount
Karel Zak [Tue, 25 Sep 2012 14:47:18 +0000 (16:47 +0200)] 
libmount: optimize mtab and utab parsing in umount

create 8000 NFS mountpoints:
#!/bin/bash
mount=/tmp/mount
if [ ! -d $mount ]; then
    mkdir -p $mount
fi
for dir in {1..8000}; do
    if [ ! -d $mount/$dir ]; then
mkdir -p $mount/$dir
    fi
    echo mount $dir
    mount -t nfs 127.0.0.1:/ $mount/$dir
done

old version:
time ./umount /tmp/mount/2255

real 0m1.254s
user 0m1.002s
sys 0m0.238s

new version:
time ./umount /tmp/mount/2244

real 0m0.332s
user 0m0.111s
sys 0m0.218s

Reported-by: chenditang <chendt.fnst@cn.fujitsu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: user-mounted loopback fs cannot be unmounted by user
Karel Zak [Fri, 21 Sep 2012 15:15:07 +0000 (17:15 +0200)] 
libmount: user-mounted loopback fs cannot be unmounted by user

Addresses: https://bugs.archlinux.org/task/31624
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomkswap: wipe old signature if there is no part table by default
Milan Broz [Mon, 10 Sep 2012 10:58:39 +0000 (12:58 +0200)] 
mkswap: wipe old signature if there is no part table by default

Historically mkswap avoids wiping any signature on "whole disk",
until force option is given.

While the idea is that it should not wipe possible boot loader,
in reality it leads to many situations where e.g. LUKS device
is overwritten but still can be detected as LUKS (but unusable).

Patch chnges behaviour that only if partition table is detected,
signatures are not wiped.

Also it removes check for block device - loop device can now
map partitions in-kernel, so using mkswap on disk image in file
should behave the same as on disk.

Also it adds warning that know signature was wiped.

Signed-off-by: Milan Broz <mbroz@redhat.com>
11 years agolsblk: fix processing of dm partition mappings
Peter Rajnoha [Thu, 20 Sep 2012 11:17:13 +0000 (13:17 +0200)] 
lsblk: fix processing of dm partition mappings

As blkid_devno_to_wholedisk returns parent dm device for
a partition mapping, the condition used in lsblk incorrectly
checked the parent-child relationship.

In this particular case, we need to process the dm partition
mapping like any other non-partition device as dm devices always
use proper holders/slaves sysfs hierarchy instead of
/sys/block/<parent>/<name> that is used for real partitions.

Example (test1 is a partition mapping and sdb1 is a real partition):
$ lsblk
NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                8:0    0  128M  0 disk
`-test (dm-0)    253:0    0  128M  0 dm
  `-test1 (dm-1) 253:1    0  127M  0 part
sdb                8:16   0  128M  0 disk
`-sdb1             8:17   0  127M  0 disk

Before this patch (test1 skipped!):
$ lsblk -s /dev/mapper/test1
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
test (dm-0) 253:0    0  128M  0 dm
`-sda         8:0    0  128M  0 disk

$ lsblk -s /dev/sdb1
NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb1    8:17   0  127M  0 disk
`-sdb   8:16   0  128M  0 disk

With this patch (test1 processed correctly):
$ lsblk -s /dev/mapper/test1
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
test1 (dm-1)  253:1    0  127M  0 part
`-test (dm-0) 253:0    0  128M  0 dm
  `-sda         8:0    0  128M  0 disk

$ lsblk -s /dev/sdb1
NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb1    8:17   0  127M  0 disk
`-sdb   8:16   0  128M  0 disk

11 years agolib/sysfs: fix sysfs_devname_to_devno for dm partitions
Peter Rajnoha [Thu, 20 Sep 2012 07:39:57 +0000 (09:39 +0200)] 
lib/sysfs: fix sysfs_devname_to_devno for dm partitions

Partitions mapped by device-mapper are not like real partitions where
there's a /sys/block/<parent>/<name>/dev sysfs path. We need to look
at /sys/block/<name>/dev like we do for any other non-partition devices.
The mapped partition is not found otherwise.

For example, this bug shows up in lsblk while specifying a device
on command line while that device is a dm mapping over a partition:
$lsblk
NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                8:0    0  128M  0 disk
`-test (dm-0)    253:0    0  128M  0 dm
  `-test1 (dm-1) 253:1    0  127M  0 part

Before this patch:
$lsblk /dev/mapper/test1
lsblk: dm-1: unknown device name

With this patch:
$lsblk /dev/mapper/test1
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
test1 (dm-1) 253:1    0  127M  0 part

11 years agosetterm: make error message more informative
Petr Uzel [Thu, 20 Sep 2012 13:53:50 +0000 (15:53 +0200)] 
setterm: make error message more informative

If `setterm -dump` fails because of lack of permission to read
/dev/vcsa, it should not report that it couldn't read /dev/vcsa0.
This could be misleading if there is only /dev/vcsa, but not /dev/vcsa0.

Before:
$ ./setterm -dump
setterm: Couldn't read /dev/vcsa0

After:
$ ./setterm -dump
setterm: Couldn't read neither /dev/vcsa0 nor /dev/vcsa

(Note: /dev/vcsa0 does not exist and the user does not have read
permission on /dev/vcsa in this case).

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=780615
Reported-by: Christopher Yeleighton <giecrilj@stegny.2a.pl>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
11 years agosfdisk: Fix format specifiers for size_t
Thierry Reding [Wed, 19 Sep 2012 09:48:46 +0000 (11:48 +0200)] 
sfdisk: Fix format specifiers for size_t

The proper specifier for size_t is %zu. %lu will work fine on 64-bit
architectures but not on 32-bit.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
11 years agohwclock: don't warp the systemtime if the RTC is in UTC
Tom Gundersen [Thu, 20 Sep 2012 22:02:46 +0000 (22:02 +0000)] 
hwclock: don't warp the systemtime if the RTC is in UTC

A sideeffect of 839be2ba6b44fa9dc927f081d547ebadec9de19c is that we now
warp the systemtime according to the timezone, on the first call of
--systz. This is not always the correct thing to do, and causes a
regression for us in Arch Linux.

The behavior is correct if the RTC, and hence the systemtime, is
in localtime. However, if the systemtime is already in UTC we don't
want to touch it when we set the kernel timezone (which we still need to
do as some filesystems use this information).

An almost identical issue was also fixed in systemd commit
72edcff5db936e54cfc322d9392ec46e2428fd9b.

Signed-off-by: Tom Gundersen <teg@jklm.no>
11 years agohwclock: wait time in hwclock is not long enough for some ARM devices
Karel Zak [Fri, 21 Sep 2012 10:05:12 +0000 (12:05 +0200)] 
hwclock: wait time in hwclock is not long enough for some ARM devices

On Sun, Sep 16, 2012 at 02:11:48PM +0800, Queen Adam wrote:
> I'm using Archlinux ARM for my Melo A100 box.
> The hwclock always timeout when using select() in rtc.c.
>
> After I change the timeout from 5 to 10, the problem is solved.
>
> In fact the timeout in my ARM box seems only to be a little larger
> than 5s.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agodocs: AUTHORS, NEWS: UTF-8 fixes.
Ville Skyttä [Sat, 15 Sep 2012 06:29:50 +0000 (09:29 +0300)] 
docs: AUTHORS, NEWS: UTF-8 fixes.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
11 years agodocs: umount.8 syntax fix.
Ville Skyttä [Sat, 15 Sep 2012 06:29:49 +0000 (09:29 +0300)] 
docs: umount.8 syntax fix.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
11 years agolibmount: append loop option when automatically create loopdev
Karel Zak [Tue, 18 Sep 2012 09:40:44 +0000 (11:40 +0200)] 
libmount: append loop option when automatically create loopdev

The loop option is optional, mount(8) is able to detect that the
source path is regular file (image) with known filesystem -- then a
loop device is automatically created. In this case we have to store
"loop" option to mtab on systems without autoclear loopdev flag.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: detach loopdev on umount if loop option in mtab
Karel Zak [Tue, 18 Sep 2012 09:22:17 +0000 (11:22 +0200)] 
libmount: detach loopdev on umount if loop option in mtab

[chroot-i486] root:/$ mount --version
mount from util-linux 2.22 (libmount 2.22.0: debug)
[chroot-i486] root:/$ losetup -a
[chroot-i486] root:/$ mount -oloop /tmp/foo_fs /tmp/bar_dir
[chroot-i486] root:/$ umount /tmp/foo_fs
[chroot-i486] root:/$ losetup -a
/dev/loop0: [2051]:387175 (/tmp/foo_fs)

Reported-by: g.esp@free.fr
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agortcwake: doesn't reset wakealarm
Giacomo [Wed, 12 Sep 2012 17:33:39 +0000 (17:33 +0000)] 
rtcwake: doesn't reset wakealarm

Disable an alarm use the same logic used to enable it: first try RTC_WKALM_SET
with the "enabled" flag set to false, if it fails fall back to RTC_AIE_OFF.

Signed-off-by: Giacomo <giacomo.perale@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: simplify usrlib_execdir initialization
Karel Zak [Mon, 1 Oct 2012 09:53:52 +0000 (11:53 +0200)] 
build-sys: simplify usrlib_execdir initialization

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: fix --localstatedir heuristics
Karel Zak [Wed, 12 Sep 2012 14:36:06 +0000 (16:36 +0200)] 
build-sys: fix --localstatedir heuristics

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: don't remove user= when executed by root
Karel Zak [Wed, 12 Sep 2012 12:27:12 +0000 (14:27 +0200)] 
libmount: don't remove user= when executed by root

The original mount(8) allows to store arbitrary user= option to mtab
file if called by root user. For example:

  # mount -f foo /bar -t xxx -o rw,user=kzak

the new mount removes the 'user=' and 'users' options at all for root
user. This is regression. The original functionality is necessary by
'sshfs' where fuse writes to mtab file by mount(8).

Reported-by: Juergen Daubert <jue@jue.li> (and 'horrorStruck' on IRC)
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: segfaults if neither /etc/filesystems nor/proc/filesystems exists
Karel Zak [Wed, 12 Sep 2012 09:57:19 +0000 (11:57 +0200)] 
libmount: segfaults if neither /etc/filesystems nor/proc/filesystems exists

Reported-by: Juergen Daubert <jue@jue.li>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibblkid: fix copyright noticed to be consistent (so all are LGPL)
Karel Zak [Tue, 11 Sep 2012 07:30:16 +0000 (09:30 +0200)] 
libblkid: fix copyright noticed to be consistent (so all are LGPL)

The libblkid library was intended to be released under the LGPL.
There is very little significant code in version.c; just a version
parser, and the original copyright holder (Theodore Ts'o,
tytso@mit.edu) has confirmed that he had intended to relicense all of
the files under the LGPL during a time when he was the sole author.

Acked-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: John Calcote <john.calcote@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: improve mnt_table_get_root_fs() docs
Karel Zak [Mon, 10 Sep 2012 08:30:11 +0000 (10:30 +0200)] 
libmount: improve mnt_table_get_root_fs() docs

Fix info about return value, improve description.

Reported-by: Amit <amit.uttam@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agowdctl: add fallbacks for old kernel headers
Karel Zak [Fri, 7 Sep 2012 16:08:55 +0000 (18:08 +0200)] 
wdctl: add fallbacks for old kernel headers

Reported-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Karel Zak <kzak@redhat.com>