Karel Zak [Tue, 14 Aug 2007 10:04:09 +0000 (12:04 +0200)]
chsh: don't use empty shell field in /etc/passwd
chsh(1) uses empty shell setting (pw->pw_shell="") as a synonym for
/bin/sh. This convention is silly and unnecessary. (The vsftpd server
will not run if the shell assigned to user "ftp" is a null string --
according to bug rh#103004).
Attila Áfra [Mon, 6 Aug 2007 12:48:37 +0000 (15:48 +0300)]
mount: fix incorrect behavior when more than one fs type is specified
"mount" may fail when more than one file system type is specified, and the
requested access mode is read/write, but the device is read-only. The error
message is: "mount: wrong fs type, bad option, bad superblock on...".
It works only if the correct file system type is the last item in the comma
separated list. This is because when it tries to mount the file system again
in read-only mode, the "types" parameter passed to the "try_mount_one"
function contains only the last item instead of the entire list.
For example, you cannot mount a UDF CD/DVD with "-t udf,iso9660" if you
don't also add the read-only option. This means that some Linux distributions
with the default configuration may not be able to mount UDF disks
automatically (e.g. Ubuntu Dapper - Gutsy Tribe 3).
Signed-off-by: Attila Áfra <attila.afra@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 6 Aug 2007 22:36:31 +0000 (00:36 +0200)]
script: fix race conditions
script(1) uses three processes (doinput, dooutput and doshell). It's
possible that the shell process is finished before the input and
output processes are completely initialized. For example:
$ script -c "printf Bingo"
In particular case the output and input processes read/write data from
shell process in time when the shell process is already done -- so it
hangs on read().
The second problem is that the output process can finish although
there are unread data from finished shell process -- an output in
the typescript file and on terminal is incomplete!
script(1) has to pass:
$ for i in `seq 1 1000`; do script -q -c "printf 'Bingo\n'"; done | grep -c Bingo
1000
Karel Zak [Wed, 1 Aug 2007 13:47:33 +0000 (15:47 +0200)]
blockdev: use LU and LLU for BLKGETSIZE and BLKGETSIZE64
The "blkockdev --getsize" returns negative numbers on i386
for 1Tb devices. The BLKGETSIZE and BLKGETSIZE64 have to
use unsigned long and unsigned long long.
When creating the "/etc/mtab~" lockfile (specifically 'linktargetfile' in the
lock_mtab function), the file is created with incorrect permissions ('000')
which necessitates root to leverage CAP_DAC_OVERRIDE. If proper file modes (it
would appear 0600 would be sufficient) were used in the open this would
function properly with CAP_DAC_OVERRIDE revoked.
$ sysctl -w kernel.cap-bound=0xf7fd7df5
$ mount -t tmpfs /dev/swap /mnt
can't open lock file /etc/mtab~: Permission denied (use -n flag to override)
Signed-off-by: Flávio Leitner <fleitner@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
agetty: 8 bit characters on the Linux console lead to input corruption
8 bit characters on the Linux console lead to input corruption (e.g.
German umlauts). This is easily reproducable by inserting a login name with
umlaut and typing backspace afterwards.
agetty supports tty parity, which leads to getty treating these characters
as a 7bit char with set parity.
This patch by Samuel Thibault adds a new option -8 which disables parity
detection for ttys not used for serial logins.
| Note: With this patch, 8bit characters are just silently dropped (that's
| the expected getty behavior), this is quite neat since you then don't
| even need to backspace your 8bit characters :)
The idle class has no class data. It will print a warning if
a prio argument is given for it, since this will be ignored.
Output for idle class will not contain prio data.
Fix inconsistency between kernel profiling and readprofile.
The range of kernel profiling is between _stext and _etext,
and readprofile tries to extract profiling for all the symbols in
/boot/System.map-2.6.16.11-7-ppc64 from /proc/profile, but there
are more symbols in /boot/System.map-2.6.16.11-7-ppc64 than those
between _stext and _etext.
Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
Gabriel Barazer [Fri, 20 Jul 2007 15:11:38 +0000 (17:11 +0200)]
build-sys: missing header when NLS is disabled
Compiling utils fail when disable NLS with the --disable-nls switch.
"mkfs.c:46: error: 'LC_ALL' undeclared (first use in this function)"
It is due to a missing locale.h header : When enabling NLS, nls.h
includes libintl.h, which in turn includes locale.h. When disabling NLS,
libintl.h isn't anymore included nor locale.h, which is needed for the
setlocale() calls.
Signed-off-by: Gabriel Barazer <gabriel@oxeva.fr> Signed-off-by: Karel Zak <kzak@redhat.com>
Mike Frysinger [Tue, 17 Jul 2007 20:47:43 +0000 (16:47 -0400)]
tests: use relative paths when sourcing files
The "." command will search $PATH before $PWD if the argument
specified contains no path qualifiers which can cause problems if
you happen to have something in $PATH named the same. The
attached patch changes all of the ". <foo>" in the tests subdir.
Mike Frysinger [Sat, 14 Jul 2007 17:32:37 +0000 (13:32 -0400)]
fdisk: check returns in fdisk from partition changes
currently the code in fdisk which changes partition types is a bit fragile ...
it assumes the partition type succeeded instead of checking the user input or
for errors. ive tweaked the sub functions to return a value indicative of the
functions' success and fdisk now checks/reports based on that.
Karel Zak [Wed, 11 Jul 2007 10:37:40 +0000 (12:37 +0200)]
sys-utils: add arch(1) back to the official tree
This patch add arch(1) back to util-linux source code tree, but the
command is not installed by defautl.
For more details see "./configure --help".
The arch command is deprecated in favor of "uname -m" (coreutils). The
latest (6.9+) version of coreutils also supports arch(1) as an alias
to "uname -a". Please, if you need arch(1) use the coreutils
implementation.
Masatake YAMATO [Tue, 8 May 2007 11:52:18 +0000 (11:52 +0000)]
lomount.c: don't use mlockall if CRYPT_NONE
loop back mounting emits two system calls: mount and mlockall.
mount is obviously needed. mlockall is needed for encryption.
As the result both CAP_SYS_ADMIN and CAP_IPC_LOCK are needed
to do loopback mounting.
The problem is that CAP_IPC_LOCK is always needed through my
command doesn't need encryption.
With the following patch, mount calls mlockall only when
encryption is needed.
H. Peter Anvin [Sat, 7 Jul 2007 01:32:31 +0000 (18:32 -0700)]
fdisk: when generating a DOS disk label, give it an ID
Newer Micro$oft operating systems (NT 3 and later) put a 4-byte
signature in the MBR at offset 440 decimal. Generate a random such
signature when creating a new disk label, and allow it to be changed.
Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Karel Zak <kzak@redhat.com>
build-sys: fix linking when ncurses is built with --with-termlib=tinfo
When system ncurses is built with --with-termlib=tinfo option
then there are two libraries - libtinfo (which contains terminal
related functions) and libncurses (rest).
David Miller [Fri, 29 Jun 2007 22:50:21 +0000 (15:50 -0700)]
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
Karel Zak [Fri, 29 Jun 2007 09:38:54 +0000 (11:38 +0200)]
blockdev: add BLKFRAGET/BLKFRASET ioctls
In Linux 2.6 the BLKRASET ioctl has the desired effect for mounted
file-systems. In Linux 2.4 it appears to set the number of blocks to
read-ahead on the *device* as opposed to within a *file*, and the
maximum value of this number is 255. As a result the invocation of
blockdev will fail on Linux 2.4 for any usefully large value of
READAHEAD, and will not in any case have the desired affect for
fragmented files.
(Based on the blockdev-getfra-setfra.patch Debian patch.)
Luciano Chavez [Fri, 9 Mar 2007 03:07:52 +0000 (21:07 -0600)]
sfdisk: setting default geometry values
The cfdisk and fdisk set defaults for heads and sectors in order to handle a
situation when the get_geometry() ends up with zeroes for the disk geometry for
device-mapper devices. This patch add same functionally to sfdisk.
You know that a dmsetup setgeometry of the the dm device can be used to
circumvent the issue but users may not immediately realize they need to do
that.
Kay Sievers [Thu, 21 Jun 2007 11:31:52 +0000 (13:31 +0200)]
mount: use encoded labels for volume_id
The current version of libvolume_id exports the encoding function for the
symlinks names, so slashes in labels and other chars, that don't really fit
into symlink names, will work as expected with LABEL=.
Cliff Wickman [Mon, 11 Jun 2007 20:24:45 +0000 (15:24 -0500)]
taskset: independent of hardcoded NR_CPUS max.
This patch makes the taskset command independent of the system's maximum
number of cpus (CONFIG_NR_CPUS). The maximum for CONFIG_NR_CPUS is a
moving target.
With this patch the size of the systems's cpumask_t is gotten from
sched_getaffinity(2).
This patch uses variable length bitmasks borrowed from Paul Jackson's
variable size bitmask routines (hence I kept his copyright notice).
This replaces the use of the glibc CPU_SETSIZE, CPU_SET, CPU_ZERO and
CPU_ISSET macros which depend on a hardcoded size for cpu_set_t.
(also fixes one little nit: the -V option is "-v" in the built-in help, so
changed the built-in help)
Signed-off-by: Cliff Wickman <cpw@sgi.com> Signed-off-by: Karel Zak <kzak@redhat.com>