libuuid: Don't run uuidd if it would fail due to permission problems
Some distributions don't like installing uuidd setuid or setgid. So
if the setuid or setigid bit is not set with uuidd, and the current
process does not have write access to the UUIDD work directory, don't
try running uuidd, since it won't work properly.
libuuid, uuidd: Avoid infinite loop while reading from the socket fd
If for some reason the uuidd daemon or the process calling uuidd
exited unexpectely, the read_all() function would end up looping
forever, either in uuidd or in libuuid. Fix this terminating the loop
if no data can be read after five tries to read from the file
descriptor.
uuidd: Avoid closing the server socket when calling create_daemon()
In the event that file descriptors 0-2 are closed when uuidd is
started, the server socket could be created as a file descriptor that
will get closed when create_daemon() tries detaching the uuidd daemon
from its controlling tty. Avoid this case by using dup(2).
Theodore Ts'o [Tue, 30 Jun 2009 01:19:28 +0000 (21:19 -0400)]
libuuid: Make sure fd's 0, 1, and 2 are valid before exec'ing uuidd
When closing all of the file descriptors before starting uuidd, make
sure file descriptors 0, 1, and 2 are reserved by opening /dev/null.
This prevents strange bugs caused by assumptions regarding file
descriptors <= 2 as being special.
Karel Zak [Tue, 30 Jun 2009 11:18:26 +0000 (13:18 +0200)]
libuuid: fix $libdir in uuid.pc
The -L<dir> gcc option is for directories to be searched for .so/.a
files. It means the directory with development stuff. We have devel
libs in /usr/lib[64].
The side effect is that pkg-config does not return -L with standard
system directories (so make(1) output is more readable and shorter).
Karel Zak [Tue, 30 Jun 2009 11:11:05 +0000 (13:11 +0200)]
libblkid: fix $libdir in blkid.pc
The -L<dir> gcc option is for directories to be searched for .so/.a
files. It means the directory with development stuff. We have devel
libs in /usr/lib[64].
The side effect is that pkg-config does not return -L with standard
system directories (so make(1) output is more readable and shorter).
Jeff Mahoney [Mon, 29 Jun 2009 21:05:36 +0000 (23:05 +0200)]
raw: Use the RAW_SETBIND ioctl without stat'ing the raw# file
The in-kernel ioctl code creates a raw# device on-demand. udev will create
the /dev/raw/raw# file when the device is created automatically.
The current raw userspace code wants to stat the file before using it,
which is unnecessary for setting up the raw device.
This patch stats the file only when query() is called as a singleton, and
it's doubtful it's needed even there. I modified as little code as I could,
though.
Tilman Schmidt [Sun, 10 May 2009 11:54:51 +0000 (13:54 +0200)]
ldattach: add N_PPS support
Add support for a line discipline name "PPS" selecting the
Pulse Per Second line discipline N_PPS (18). The number has been
reserved since kernel release 2.6.28, and the implementation is
finally going to be submitted for kernel release 2.6.31.
Karel Zak [Tue, 9 Jun 2009 07:58:46 +0000 (09:58 +0200)]
switch_root: new command
Copied from Dracut project:
git://dracut.git.sourceforge.net/gitroot/dracut
switch_root history in dracut.git repository:
$ git shortlog switch_root.c
Harald Hoyer (5):
replace switch_root shell script with binary
add \n to switch_root
use switch_root code from http://pjones.fedorapeople.org/mkstart/usr/lib/mkstart/switchroot.c
mount move instead of umount and fix the search for fallback inits
setsid() and set controlling terminal for real /sbin/init
Victor Lowther (2):
Simplify switch_root.c a bit
Remove all files on the initramfs before switching root
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 16 Jun 2009 22:30:51 +0000 (00:30 +0200)]
libblkid: don't require udev symlinks verification for non-root users
There is noway how to verify LABEL/UUID for non-root users, we have to
follow udev symlinks or use cached information from blkid.tab. Use
unverified symlinks is faster.
Karel Zak [Wed, 10 Jun 2009 07:37:43 +0000 (09:37 +0200)]
mount: move MS_{PROPAGATION,BIND,MOVE} detection
The previous commit does not properly fix the problem with "none"
fstype and MS_{PROPAGATION,BIND,MOVE} flags. The real fstype has to
be replaced with "none" before we try to use /sbin/mount.<type>
helper.
Allow users to set the "none" class on processes. Using the
none class has the distict advantage that the io priority
is inherited from the cpu nice level. Update the man page
to reflect the change.
Signed-off-by: Jakob Unterwurzacher <jakobunt@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Zdenek Behan [Tue, 19 May 2009 14:19:32 +0000 (16:19 +0200)]
fdisk: add simple test for doslabel stuff
Initial tests/fdisk patch to test most of the doslabel-related stuff.
Coverage of dos-related functions is about 60%, does not test the
verify/fix-PT code.
[kzak@redhat.com: - fix test design to match to
output/expect/diff idea]
Signed-off-by: Zdenek Behan <rain@matfyz.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
Chris Webb [Wed, 13 May 2009 14:54:23 +0000 (15:54 +0100)]
fdisk: (and cfdisk) fix to be consistent about maximum heads
Fix fdisk and cfdisk to be consistent about maximum heads
Without this patch, fdisk allows up to 256 heads to be set via the menu, but
only up to 255 heads by command line -H. Similarly, cfdisk's -H option also
enforces heads <= 255 instead of heads <= 256.
The strange limit of 256 comes about because (heads - 1) should fit in a
single byte for legacy CHS. Geometries of 256 heads and 32 sectors are seen
in disks from other operating systems where cylinder-aligned partitions
which are also aligned to a 4MB boundary are wanted.
Karel Zak [Thu, 14 May 2009 16:29:03 +0000 (18:29 +0200)]
blkid: blkid_do_safeprobe() has to be tolerant to RAIDs
It's pretty generic that RAID signature is on the same device as FS
signature. We have to be tolerant and ignore filesystems signatures
on such devices. The RAID signature is always preferred.
Karel Zak [Thu, 14 May 2009 16:04:55 +0000 (18:04 +0200)]
blkid: fix "hangs forever with partition type mdraid"
> #:> blkid /dev/sda7
> /dev/sda7: UUID="c193d159-1fd4-1a4b-4037-f3433e016f3d" TYPE="mdraid"
>
> The blkid binary build from the util-linux-ng sources just hangs
> forever with 100% cpu load with the same command.
Reported-by: Juergen Daubert <jue@jue.li> Signed-off-by: Karel Zak <kzak@redhat.com>
Mike Frysinger [Sun, 10 May 2009 20:57:31 +0000 (16:57 -0400)]
losetup: handle symlinks in /dev/loop/
The loop_scandir() expects all the files in /dev/loop/ to be actual
devices and not symlinks to devices. However, udev by default sets up
symlinks in /dev/loop/ thereby breaking the fallback scan logic when
looking for devices more than the default number of 8.
Simple way to reproduce is:
- <detach all devices>
- cd /dev/loop
- rm -f [2-7]
- losetup 0 autogen.sh
- mv 1 8
- for n in {1..7} ; do ln -s 0 $n ; done
- losetup -f
<error but should have found /dev/loop/8>
[kay.sievers@vrfy.org:
just a note, udev does not do that by default. It is
devfs-nonsense, which the "default" never did.]
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reported-by: Mario Bachmann <grafgrimm77@gmx.de>