Commit Graph

5519 Commits

Author SHA1 Message Date
Ondrej Oprala ea8a10391b su: add segmentation fault reporting of the child process
Child processes that ended with segmentation fault previously
indicated this with return status only. The report is now more
verbose if core dump is allowed.

Improved-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2012-09-21 12:37:18 +02:00
Peter Rajnoha da30cb2a87 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
2012-09-21 12:25:32 +02:00
Peter Rajnoha 857db7f53c 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
2012-09-21 12:21:30 +02:00
Petr Uzel 2754ffc5f5 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>
2012-09-21 12:14:14 +02:00
Thierry Reding 4862db73e8 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>
2012-09-21 12:14:04 +02:00
Tom Gundersen 910a090039 hwclock: don't warp the systemtime if the RTC is in UTC
A sideeffect of 839be2ba6b 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>
2012-09-21 12:07:32 +02:00
Karel Zak 72fc8ca062 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>
2012-09-21 12:05:12 +02:00
Ville Skyttä 9e94f3938d docs: AUTHORS, NEWS: UTF-8 fixes.
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2012-09-20 11:30:59 +02:00
Ville Skyttä 53859b5f59 docs: umount.8 syntax fix.
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2012-09-20 11:30:41 +02:00
Karel Zak e8cd181967 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>
2012-09-18 11:40:44 +02:00
Karel Zak 475c30d061 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>
2012-09-18 11:22:17 +02:00
Giacomo 829eab67e6 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>
2012-09-13 13:23:11 +02:00
Karel Zak 2b945eda3d agetty: add \4 and \6 issue file sequences to print IP addresses
Based on Andrea Bonomi <a.bonomi@endian.com> ideas.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-13 12:59:46 +02:00
Karel Zak df0bd828b1 build-sys: simplify usrlib_execdir initialization
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-12 18:09:28 +02:00
Karel Zak 10a42fb776 build-sys: fix --localstatedir heuristics
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-12 16:36:06 +02:00
Karel Zak 9d57f184cf tests: remove encryption loopdev test
Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-12 14:49:49 +02:00
Karel Zak 4be900c51d 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>
2012-09-12 14:27:12 +02:00
Karel Zak 3de77c2173 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>
2012-09-12 11:57:19 +02:00
Ludwig Nussel 5cf05c7147 mount: losetup: remove obsolete encryption support
kernel cryptoloop is deprecated since ages and support for cryptoloop
in util-linux is incomplete/broken.
- no password hashing
- last 8 bit of key are always set to zero
- no binary keys possible (stops reading key at \n and \0)

In the past some Distros added the above features with patches. So
remove cryptoloop support from util-linux completely to make sure
people won't try using it.

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-11 10:46:11 +02:00
Karel Zak af2e97b56b build-sys: remove static from config-gen.d/{devel,all}.conf
It's impossible to compile static when gcc/ld is forced to
use GNU_RELRO and BIND_NOW for suid binaries (e.g. mount).

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-11 10:25:55 +02:00
Karel Zak 0391552429 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>
2012-09-11 09:30:16 +02:00
Ondrej Oprala 83765871ef hwclock: add a new --compare option
The new option imitates adjtimex -c functionality and outputs
the drift in 10 second intervals.

[kzak@redhat.com: - coding style
                  - print hw and system time columns too]

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-10 16:00:27 +02:00
Karel Zak 6cd3e35c77 Merge https://github.com/hramrach/util-linux 2012-09-10 11:17:53 +02:00
Karel Zak c667aff93f 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>
2012-09-10 10:30:11 +02:00
Karel Zak 2eb5ba0bd4 wdctl: add fallbacks for old kernel headers
Reported-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 18:08:55 +02:00
Karel Zak 7fcccbdfbe build-sys: add --disable-wdctl
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 14:19:17 +02:00
Karel Zak 92fe6e9633 eject: robust strings usage [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 13:43:56 +02:00
Karel Zak 63beec6443 whereis: improve readability for analysers
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 13:43:49 +02:00
Karel Zak 9d48340d44 lib/pager: robust work with file descriptors [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 13:29:55 +02:00
Karel Zak 7a84c0393a sulogin: cleanup file descriptors usage
- use _FILENO macros rather than magic numbers
 - check for dup() result

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 13:18:22 +02:00
Karel Zak 17df84df27 switch_root: check open() return value [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 13:02:42 +02:00
Michal Suchanek 3b4f1aeecc Fix configure to work with multiarch distributions. 2012-09-07 12:58:37 +02:00
Karel Zak fee9431f97 lib/sysfs: more robust sysfs_opendir() [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 12:15:39 +02:00
Karel Zak 67757329cc mark expected fallthrough for static analysers
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 12:05:56 +02:00
Karel Zak a291c7ff51 tunelp: add missing break [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 12:00:53 +02:00
Karel Zak f7fff0096a getopt: make the code more readable for analysers
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 11:42:34 +02:00
Karel Zak 38efd1e2b7 namei: remove dead code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 11:39:38 +02:00
Karel Zak ceaff03b27 libblkid: check fchmod() return value [coverity scan] 2012-09-07 11:01:07 +02:00
Karel Zak c1028673fe libblkid: improve DBG() macro
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-07 10:58:49 +02:00
Karel Zak 1a1c0ad77c docs: add note about /etc/pam.d/su-l to ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-05 14:06:28 +02:00
Björn Jacke 309f26bb5f mount: fix man pahe typo in quota mount option names 2012-09-05 13:56:16 +02:00
Karel Zak bda67d64de su: move long options to main()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-05 11:26:20 +02:00
Karel Zak 4e1834978f su: verify writing to streams was successful
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-05 11:21:07 +02:00
Karel Zak d10028a712 su: more robust getpwuid() for GNU Hurt [coreutils 71b7ddc]
Let's support GNU Hurd over-engineering where a process can exist
without UID and getuid() returns -1 and sets errno.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-05 11:13:34 +02:00
Dave Reisner 6edbca18bb build-sys: install su.1 if building su
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-05 10:45:46 +02:00
Benno Schulenberg b8ccc27c1b wdctl: treat aligned translatable strings in a uniform manner
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2012-09-04 17:28:19 +02:00
Benno Schulenberg 19c19b637d wdctl: gettextize one forgotten word
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2012-09-04 17:28:16 +02:00
Benno Schulenberg e9e7698eb4 textual: add missing comma and colon in some help texts
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2012-09-04 17:27:50 +02:00
Yuri Chornoivan bbac757b1e textual: fix typos in messages 2012-09-04 17:26:31 +02:00
Davidlohr Bueso ca3dbca10b libmount: document LIBMOUNT_DEBUG users
Update the manpages of programs that use this environment variable for
extra debugging information.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-09-04 17:21:57 +02:00