]> err.no Git - util-linux/log
util-linux
14 years agolibblkid: fix MBR detection on iPod and cleanup vfat code
Karel Zak [Thu, 14 Oct 2010 23:33:28 +0000 (01:33 +0200)]
libblkid: fix MBR detection on iPod and cleanup vfat code

 - move all FAT code to superblocks/vfat.c only
 - add a generic function to verify FAT superblock and use it
   in FAT prober as well as in MBR parser
 - add a more robust FAT cluster_count check
   (it seems that iPod contains an "almost valid" FAT superblock before MBR)

Reported-by: Davidlohr Bueso <dave.bueso@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: consolidate magic strings detection code
Karel Zak [Thu, 14 Oct 2010 23:32:13 +0000 (01:32 +0200)]
libblkid: consolidate magic strings detection code

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agopartx: integrate support for mac and sun partitions, based on kpartx.
Davidlohr Bueso [Thu, 7 Oct 2010 14:48:28 +0000 (10:48 -0400)]
partx: integrate support for mac and sun partitions, based on kpartx.

[kzak@redhat.com: - remove unnecessary members from struct slice,
                  - fix gcc warnings]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agopartx: add sun partition table support
Davidlohr Bueso [Thu, 7 Oct 2010 14:48:22 +0000 (10:48 -0400)]
partx: add sun partition table support

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agopartx: add mac partition table support
Davidlohr Bueso [Thu, 7 Oct 2010 14:48:16 +0000 (10:48 -0400)]
partx: add mac partition table support

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agodocs: update TODO
Karel Zak [Thu, 7 Oct 2010 15:57:35 +0000 (17:57 +0200)]
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: don't canonicalize "spec" with --no-canonicalize option
Miklos Szeredi [Thu, 7 Oct 2010 14:05:12 +0000 (16:05 +0200)]
mount: don't canonicalize "spec" with --no-canonicalize option

"Spec" was still canonicalized despite --no-canonicalize.  This
resulted in a hang during login with pam_encfs (Debian Bug#593336).

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
14 years agotests: update namei regression test
Karel Zak [Thu, 7 Oct 2010 08:37:03 +0000 (10:37 +0200)]
tests: update namei regression test

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocal: use EXIT_* and program_invocation_short_name
Karel Zak [Thu, 7 Oct 2010 08:35:32 +0000 (10:35 +0200)]
cal: use EXIT_* and program_invocation_short_name

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolscpu: really use 'mode' argument in path_fopen()
Petr Uzel [Wed, 6 Oct 2010 14:03:34 +0000 (16:03 +0200)]
lscpu: really use 'mode' argument in path_fopen()

14 years agoflock: use more useful example in flock.1
Jakob Unterwurzacher [Wed, 6 Oct 2010 11:32:20 +0000 (13:32 +0200)]
flock: use more useful example in flock.1

The example in the man page does not prevent concurrent execution, as it
obtains a shared lock. More useful is taking an exclusive lock, i.e.
remove "-s".
Additionally, IMO most people want the script to exit when the lock
cannot be acquired, so adding "-n".

14 years agofindmnt: fix support for -a option
Milan Broz [Tue, 5 Oct 2010 15:38:43 +0000 (17:38 +0200)]
findmnt: fix support for -a option

Signed-off-by: Milan Broz <mbroz@redhat.com>
14 years agosfdisk: save errno before calling perror
Forest Bond [Tue, 5 Oct 2010 01:01:30 +0000 (21:01 -0400)]
sfdisk: save errno before calling perror

errno is saved into a local variable to avoid it getting trampled
by perror before it is checked to determine the return value.

This issue seems quite rare, but I have seen it when running sfdisk
via gksudo and using the --quiet command-line option.  From what I
can tell, this combination triggers loading of translations in perror,
which (at least on my machine) ends up changing the value of errno.

Signed-off-by: Forest Bond <forest@alittletooquiet.net>
14 years agocolumn: update manual page to match column switches
Sami Kerola [Mon, 4 Oct 2010 18:57:58 +0000 (20:57 +0200)]
column: update manual page to match column switches

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocolumn: getopt_long and new help output
Sami Kerola [Mon, 4 Oct 2010 18:57:57 +0000 (20:57 +0200)]
column: getopt_long and new help output

[kzak@redhat.com: - remove __progname, cleanup usage()]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofallocate: fix build failure with old linux headers
Mike Frysinger [Sun, 3 Oct 2010 20:00:09 +0000 (16:00 -0400)]
fallocate: fix build failure with old linux headers

If linux/falloc.h does not exist, the build system still enables the
fallocate util, but ultimately fails when it tries to include the
header and use a define from it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
14 years agofsck: inform about nonexistent devices in verbose mode
Karel Zak [Thu, 7 Oct 2010 07:26:37 +0000 (09:26 +0200)]
fsck: inform about nonexistent devices in verbose mode

Reported-by: Serafeim Zanikolas <sez@debian.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: add searching in attributes dir to BeFS
Jeroen Oortwijn [Wed, 22 Sep 2010 17:14:21 +0000 (19:14 +0200)]
libblkid: add searching in attributes dir to BeFS

Add searching for the be:volume_id attribute in the attributes directory
of the root directory. UUID is now always set when the root directory
contains the be:volume_id attribute.

Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com>
14 years agoswapon: warn if file owner is not root
Karel Zak [Thu, 7 Oct 2010 07:03:31 +0000 (09:03 +0200)]
swapon: warn if file owner is not root

Reported-by: Bernhard Voelker <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoumount: use strtosize() for offset=
Karel Zak [Thu, 7 Oct 2010 06:58:00 +0000 (08:58 +0200)]
umount: use strtosize() for offset=

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agonamei: parse all path arguments when an optarg path will fail
Sami Kerola [Thu, 30 Sep 2010 22:33:44 +0000 (00:33 +0200)]
namei: parse all path arguments when an optarg path will fail

Old implementation of namei listed path all the way to non-existing
file or directory, something like:

f: /usr/bin/nxdir/file
 d /
 d usr
 d bin
 ? nxdir - No such file or directory (2)

whiles the current implementation prints:

namei: failed to stat: /usr/bin/nxdir/file: No such file or directory

The new output it's not helpful. I am especially interested see where
the path is broken when a path is symlink to other path with symlink,
and few more like that, and something somewhere is broken.

[kzak@redhat.com: - coding style changes]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotaskset: proper numbers parsing
Karel Zak [Thu, 30 Sep 2010 21:27:42 +0000 (23:27 +0200)]
taskset: proper numbers parsing

Reported-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: eliminate redundant call to open()
Markus Rinne [Wed, 22 Sep 2010 19:11:54 +0000 (22:11 +0300)]
fdisk: eliminate redundant call to open()

Don't use open() in get_boot() if it's called with an argument try_only,
because the file has already been opened by the caller.

Signed-off-by: Markus Rinne <markus.ka.rinne@gmail.com>
14 years agomount: Don't call canonicalize_*(SPEC) for 9p
Sven Eckelmann [Sun, 26 Sep 2010 19:18:15 +0000 (21:18 +0200)]
mount: Don't call canonicalize_*(SPEC) for 9p

When calling "mount -t 9p -o trans=virtio foobar /mnt/bar" and foobar
exists in the current path, the 9p virtio transport driver will be
called with $CWD/foobar and fail with "9p: no channels available".

Similar problems exist with remote file servers
 "mount -t 9p 23.42.08.15 /mnt/bar"
and Plan 9 From User Space applications
 "mount -t 9p -o trans=unix,uname=$USER `namespace`/acme /mnt/bar"

A similar exception like for nfs, cifs and smbfs must be added for 9p.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
14 years agomount: avoid starting a man page line with a single quote
Chris Frost [Mon, 20 Sep 2010 17:27:19 +0000 (10:27 -0700)]
mount: avoid starting a man page line with a single quote

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: fix mount.8, shortname=mixed is now default for vfat
Petr Uzel [Mon, 20 Sep 2010 15:12:42 +0000 (17:12 +0200)]
mount: fix mount.8, shortname=mixed is now default for vfat

Since Linux kernel commit 955234755ce4a2c33cfc558912aa8f2148cc1fc6,
the default mode for vfat filesystem is 'shortname=mixed'.

Reported-by: Harald Koenig <koenig@linux.de>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
14 years agoddate: revert man page typo
Karel Zak [Thu, 30 Sep 2010 20:27:42 +0000 (22:27 +0200)]
ddate: revert man page typo

On Sat, Sep 18, 2010 at 03:10:52AM +0300, Anssi Hannula wrote:
> According to wikipedia [1] 'Holyday' was the correct spelling, I
> guess the first hunk should be reverted.
>
> [1] http://en.wikipedia.org/wiki/Discordian_calendar

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: rewrite is_readonly()
Karel Zak [Mon, 20 Sep 2010 11:10:36 +0000 (13:10 +0200)]
mount: rewrite is_readonly()

This new implementation is more optimistic and always calls access(2).
The fallback solution (modify atime by futimens(2)) should be used
very rarely.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoul: use atexit() to deallocate buffer, print errors by err()
Karel Zak [Fri, 17 Sep 2010 08:35:35 +0000 (10:35 +0200)]
ul: use atexit() to deallocate buffer, print errors by err()

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoul: fix memory leak.
Davidlohr Bueso [Mon, 30 Aug 2010 02:03:32 +0000 (22:03 -0400)]
ul: fix memory leak.

The 'obuf' variable is not being freed after usage and this includes
when SIGINTs occur, hence add some basic signal handling.

[kzak@redhat.com - remove if-before-free ]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolscpu: update lscpu.1 to include new additions.
Davidlohr Bueso [Mon, 30 Aug 2010 22:06:19 +0000 (18:06 -0400)]
lscpu: update lscpu.1 to include new additions.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agoddate: fix typo in ddate.1
Davidlohr Bueso [Thu, 2 Sep 2010 12:40:23 +0000 (08:40 -0400)]
ddate: fix typo in ddate.1

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agomount: add note about context= remount to mount.8
Karel Zak [Thu, 16 Sep 2010 22:09:38 +0000 (00:09 +0200)]
mount: add note about context= remount to mount.8

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: don't probe directories
Karel Zak [Wed, 15 Sep 2010 09:51:09 +0000 (11:51 +0200)]
libblkid: don't probe directories

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: better describe UUIDs usage in man pages
Karel Zak [Mon, 13 Sep 2010 09:43:14 +0000 (11:43 +0200)]
mount: better describe UUIDs usage in man pages

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=632373
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: don't ignore zero for SBMAGIC_OFFSET
Karel Zak [Tue, 7 Sep 2010 09:30:50 +0000 (11:30 +0200)]
libblkid: don't ignore zero for SBMAGIC_OFFSET

The side effect of this bug is that wipefs(8) does not report LUKS...

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: add blkid --list-all to TODO
Karel Zak [Tue, 7 Sep 2010 09:03:45 +0000 (11:03 +0200)]
docs: add blkid --list-all to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocfdisk: don't use size of device based on cylinders
Karel Zak [Mon, 6 Sep 2010 11:30:48 +0000 (13:30 +0200)]
cfdisk: don't use size of device based on cylinders

This patch is enough to make cfdisk usable on non-DOS disks where
partitioning is not based on CHS. cfdisk should not print error
messages for such disks.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=630340
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofindmnt: don't swap source and target if the source is a tag
Karel Zak [Tue, 31 Aug 2010 10:24:00 +0000 (12:24 +0200)]
findmnt: don't swap source and target if the source is a tag

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: clean up fstab.5
Karel Zak [Mon, 30 Aug 2010 09:43:41 +0000 (11:43 +0200)]
mount: clean up fstab.5

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: add note about subtypes to fstab.5
Karel Zak [Mon, 30 Aug 2010 08:48:52 +0000 (10:48 +0200)]
mount: add note about subtypes to fstab.5

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblockdev: fix typo in blockdev.8
Karel Zak [Fri, 27 Aug 2010 22:50:24 +0000 (00:50 +0200)]
blockdev: fix typo in blockdev.8

Reported-by: Marcos Felipe Rasia de Mello <marcosfrm@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: add info about type.subtype to /sbin/mount.<type> API description
Karel Zak [Fri, 27 Aug 2010 18:42:16 +0000 (20:42 +0200)]
mount: add info about type.subtype to /sbin/mount.<type> API description

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: handle filesystems with subtype
Miklos Szeredi [Fri, 27 Aug 2010 14:58:44 +0000 (16:58 +0200)]
mount: handle filesystems with subtype

Linux can handle filesystem types with "MAINTYPE.SUBTYPE" format,
where the main type determines the actual filesystem driver while the
subtype can be interpreted by the filesystem itself.

When searching for mount helpers mount(8) and umount(8) should also
interpret such types, falling back to (u)mount.MAINTYPE if
(u)mount.MAINTYPE.SUBTYPE doesn't exist.

This patch implements this, passing the type with "-t TYPE"
to the mount program in this case.

Reported-by: Josef Bacik <josef@redhat.com>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=625064
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
14 years agomount: sanity check mount flags for MS_PROPAGATION
Karel Zak [Fri, 27 Aug 2010 10:22:27 +0000 (12:22 +0200)]
mount: sanity check mount flags for MS_PROPAGATION

 mount(8) reuses mount flags from fstab/mtab, the problem is that for
 MS_PROPAGATION operations kernel incorrectly evaluates mount flags if
 the flags contains any non-propagation stuff (e.g. MS_RDONLY). For
 example --make-shared on read-only FS:

   # strace -e mount mount --make-shared /mnt/test
   mount("/dev/sda1", "/mnt/test", "none", MS_RDONLY|MS_SHARED, NULL) = 0

 must be:

   # strace -e mount mount --make-shared /mnt/test
   mount("/dev/sda1", "/mnt/test", "none", MS_SHARED, NULL) = 0

Reported-by: Valerie Aurora <vaurora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: Add more pseudo filesystems.
Davidlohr Bueso [Mon, 23 Aug 2010 14:17:36 +0000 (10:17 -0400)]
mount: Add more pseudo filesystems.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agoblockdev: sync man page with code
Karel Zak [Tue, 24 Aug 2010 10:59:41 +0000 (12:59 +0200)]
blockdev: sync man page with code

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoinclude: cleanup blkdev.h
Karel Zak [Tue, 24 Aug 2010 10:04:24 +0000 (12:04 +0200)]
include: cleanup blkdev.h

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblockdev: add BLKDISCARDZEROES
Karel Zak [Tue, 24 Aug 2010 09:43:21 +0000 (11:43 +0200)]
blockdev: add BLKDISCARDZEROES

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: fix alignment check for non-512-byte logical sectors
Karel Zak [Mon, 23 Aug 2010 11:13:36 +0000 (13:13 +0200)]
fdisk: fix alignment check for non-512-byte logical sectors

 # modprobe scsi_debug dev_size_mb=1024 sector_size=4096

 # fdisk /dev/sdb

  Command (m for help): n
  Command action
    e   extended
    p   primary partition (1-4)
  p
  Partition number (1-4, default 1):
  Using default value 1
  First sector (256-262143, default 256): 257
  Last sector, +sectors or +size{K,M,G} (257-262143, default 262143): +100M

  Command (m for help): p

  Disk /dev/sdb: 1073 MB, 1073741824 bytes
  32 heads, 32 sectors/track, 256 cylinders, total 262144 sectors
  Units = sectors of 1 * 4096 = 4096 bytes
  Sector size (logical/physical): 4096 bytes / 4096 bytes
  I/O size (minimum/optimal): 4096 bytes / 262144 bytes
  Disk identifier: 0x16db2bb0

    Device Boot      Start         End      Blocks   Id  System
  /dev/sdb1            257       25855      102396   83  Linux
  Partition 1 does not start on physical sector boundary.
  ^^^^^^^^

 The warning is nonsense. The logical and physical sector size is the
 same. It means that every LBA is always aligned to physical sector
 boundary.

 Note that this bug does not mean that fdisk produces unaligned
 partitions. The problem is that fdisk forces to use bigger gaps
 between aligned LBAs, for example:

   correctly aligned LBA are: 256, 257, 258, ...  [N+1]
   fdisk assumes:             256, 264, 272, ...  [N+(sector_size/512)]

Reported-by: JOB NELSON <job_nelson@hotmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: don't keep internally device size in 512-byte sectors
Karel Zak [Mon, 23 Aug 2010 10:11:26 +0000 (12:11 +0200)]
fdisk: don't keep internally device size in 512-byte sectors

All fdisk code uses sector_size variable, so there should not be an
exception where we use 512-byte sectors.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolib: fix syntax error in blkdev.c
Karel Zak [Mon, 23 Aug 2010 09:06:08 +0000 (11:06 +0200)]
lib: fix syntax error in blkdev.c

Reported-by: Tuco <tuco.xyz@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: update lscpu tests
Karel Zak [Fri, 20 Aug 2010 19:29:04 +0000 (21:29 +0200)]
tests: update lscpu tests

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolscpu: support sysfs without cpu/online file
Karel Zak [Fri, 20 Aug 2010 19:15:51 +0000 (21:15 +0200)]
lscpu: support sysfs without cpu/online file

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: fix blkid MD test (missing tailing whitespaces)
Karel Zak [Fri, 20 Aug 2010 19:02:29 +0000 (21:02 +0200)]
tests: fix blkid MD test (missing tailing whitespaces)

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: make it easier to find mail list address
Alexander Shishkin [Fri, 20 Aug 2010 08:08:48 +0000 (11:08 +0300)]
docs: make it easier to find mail list address

AUTHORS doesn't really have the mail list info, but README does.
Mention it in README.devel.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
14 years agolscpu: add byte order and bogoMIPS information
Davidlohr Bueso [Tue, 17 Aug 2010 14:02:00 +0000 (10:02 -0400)]
lscpu: add byte order and bogoMIPS information

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotailf: fixed timing issue that could cause duplicate data output
Dima Kogan [Sat, 14 Aug 2010 09:15:47 +0000 (02:15 -0700)]
tailf: fixed timing issue that could cause duplicate data output

The issue is that in roll_file() we fstat() to find the file size, then read()
as much data as we can and then use the previously saved file size to mark our
position. The bug occurs if we read past the file size reported by fstat()
because more data has arrived while we were reading it. The attached patch uses
the current file position as the location marker instead, with some extra logic
to handle tailing truncated files.

[kzak@redhat.com: - fix coding style]

Signed-off-by: Dima Kogan <dkogan@cds.caltech.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolosetup: do not distinguish between malloc and realloc
Tobias Klauser [Wed, 11 Aug 2010 21:12:07 +0000 (23:12 +0200)]
losetup: do not distinguish between malloc and realloc

realloc(NULL, size) behaves the same as malloc(size) so there is no need
to distinguish between the two.

[kzak@redhat.com: - better handle realloc() errors]

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibmount: remove unused mnt_strconcat3()
Karel Zak [Fri, 20 Aug 2010 11:03:51 +0000 (13:03 +0200)]
libmount: remove unused mnt_strconcat3()

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agorev: coding style, various fixes
Davidlohr Bueso [Sun, 8 Aug 2010 21:03:56 +0000 (17:03 -0400)]
rev: coding style, various fixes

 * Change indentation to 8 characters and coding style, for better reading the code.

 * Add some memory allocation error handling.

 * Fix memory leaks. In cases when Ctrl-C is used to exit the program,
  'p' cannot be freed, so made it a global var, to share between main()
   and sig_handler(). Signal handing is necessary to fix some leaks, so
   added a very basic, non invasive, mechanism.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoflock: properly report exec() errors
Karel Zak [Fri, 20 Aug 2010 09:45:00 +0000 (11:45 +0200)]
flock: properly report exec() errors

Reported-by: Barry Davis <barry_davis@stormagic.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofsck: improve whole-disk check, detect stacked devices
Karel Zak [Thu, 19 Aug 2010 13:33:45 +0000 (15:33 +0200)]
fsck: improve whole-disk check, detect stacked devices

The current heuristic for conversion from partition to whole-disk
is based on device names. It's pretty poor. This patch replaces this
code with blkid_devno_to_wholedisk(). This solution is based on
/sys FS and it works for arbitrary partitioned devices.

The another problem is the way how fsck determines stacked devices.
The current code checks device name for "md" prefix only. It does not
care about DM, dm-ccypt, and so on. This patch uses
/sys/block/.../slaves/, but it does not fully resolves dependencies
between all devices. The method is simple -- fsck does not check
stacked devices in parallel with any other device.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: add blkid test for partitioned RAID0
Karel Zak [Wed, 18 Aug 2010 07:33:11 +0000 (09:33 +0200)]
tests: add blkid test for partitioned RAID0

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoagetty: add -c to reuse cflags
Karel Zak [Wed, 18 Aug 2010 07:29:59 +0000 (09:29 +0200)]
agetty: add -c to reuse cflags

The agetty command resets terminal cflags setting. The -c option
disables this behavior and serial setting from kernel is used.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoaggety: don't wipe CLOCAL flag
Karel Zak [Mon, 12 Jul 2010 09:57:55 +0000 (11:57 +0200)]
aggety: don't wipe CLOCAL flag

gettey should not clear the flag. It seems that the flag is
automatically enabled for serial consoles tht don't use CD signal.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=598631
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoagetty: add -s to reuse existing baud rate
Karel Zak [Wed, 18 Aug 2010 07:02:03 +0000 (09:02 +0200)]
agetty: add -s to reuse existing baud rate

For example:

/sbin/agetty -s /dev/ttyS0 9600

will reuse the speed the kernel configured on the port. If the setting
from kernel is useless (tty returns BREAK character) then the baud
rate from command line (9600) is used.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=623685
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: wrong PT detection on RAID0
Karel Zak [Fri, 13 Aug 2010 07:59:31 +0000 (09:59 +0200)]
libblkid: wrong PT detection on RAID0

Reported-by: Yulia Kopkova <ykopkova@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolscpu: add -x and {On,Off}-line CPU(s) mask/list
Karel Zak [Wed, 11 Aug 2010 13:41:48 +0000 (15:41 +0200)]
lscpu: add -x and {On,Off}-line CPU(s) mask/list

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolscpu: support offline CPUs
Karel Zak [Wed, 11 Aug 2010 10:43:25 +0000 (12:43 +0200)]
lscpu: support offline CPUs

 # echo 0 >/sys/devices/system/cpu/cpu3/online
 # echo 0 >/sys/devices/system/cpu/cpu2/online

 # grep processor /proc/cpuinfo
 processor       : 0
 processor       : 1

 # lscpu
 lscpu: error: cannot open
 /sys/devices/system/cpu/cpu2/cache/index0/shared_cpu_map: No such file or directory

This patch also add a new "On-line CPU(s):" line to the lscpu(1)
output.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=623012
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: add note about sfdisk to TODO
Karel Zak [Tue, 10 Aug 2010 07:06:29 +0000 (09:06 +0200)]
docs: add note about sfdisk to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocfdisk: fix n+1 again
Karel Zak [Mon, 9 Aug 2010 11:33:17 +0000 (13:33 +0200)]
cfdisk: fix n+1 again

Reported-by: J B <jb.1234abcd@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: update MBR after ID change
Karel Zak [Mon, 9 Aug 2010 11:03:02 +0000 (13:03 +0200)]
fdisk: update MBR after ID change

Reported-by: Bernard Pidoux <bpidoux@free.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocfdisk: fix n+1 bug in error message
Karel Zak [Mon, 9 Aug 2010 09:32:46 +0000 (11:32 +0200)]
cfdisk: fix n+1 bug in error message

 # cfdisk -Ps <devname>

correctly uses 1..N range for partition numbers, unfortunately some
error messages use 0..N. This is confusing.

Reported-by: J B <jb.1234abcd@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: mark line(1) as deprecated
Karel Zak [Wed, 4 Aug 2010 10:14:57 +0000 (12:14 +0200)]
docs: mark line(1) as deprecated

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolosetup: use stdout and return 0 for --help
Karel Zak [Wed, 4 Aug 2010 09:52:41 +0000 (11:52 +0200)]
losetup: use stdout and return 0 for --help

Reported-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodmesg: fix memory leak in dmesg(1).
Davidlohr Bueso [Fri, 30 Jul 2010 15:43:36 +0000 (11:43 -0400)]
dmesg: fix memory leak in dmesg(1).

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agomount: get most recently mounted fs from /etc/mtab.
Valerie Aurora [Wed, 4 Aug 2010 00:09:19 +0000 (20:09 -0400)]
mount: get most recently mounted fs from /etc/mtab.

I spent most of the day tracking down this subtle remount bug.  I
think this is the correct solution but I'd appreciate some
double-checking.  I suspect this bug will munge the mount options
whenever you remount a file system mounted on the same mountpoint as
another file system, using the mountpoint as the handle.

-VAL

commit c010b3a0783430e2b94f3b3dc0929ae299e383eb
Author: Valerie Aurora <vaurora@redhat.com>
Date:   Tue Aug 3 16:32:52 2010 -0700

    mount: get most recently mounted fs from /etc/mtab.

    In mount, when using /etc/mtab to lookup a mount entry, get the most
    recently mounted entry instead of the first mounted entry.  You want
    to manipulate the most recent mount, not a covered mount.  See comment
    to umount_one_bw().

    This bug has been util-linux-ng since the first git checkin.  It
    finally showed up on my system with the change to stop using
    SETLOOP_AUTOCLEAR if /etc/mtab is writable (commit af092544).  If you
    do a remount of a file system mounted on the same dir as another file
    system, it will take the options from the first mount and write them
    out to /etc/mtab as the options to the second mount - including, in
    the case of a loop device, loop=/dev/loop0.  Then when you umount the
    second mount, it grabs the line from /etc/mtab and tries to tear down
    the loop device, which complains because it is still in use by the
    first mount.

    Reproducible test case (on a system with writable /etc/mtab):

    mount -o loop,ro /tmp/ro /mnt
    mount -t tmpfs tmpfs /mnt
    mount -o remount,ro /mnt
    cat /etc/mtab | tail -2

Signed-off-by: Valerie Aurora <vaurora@redhat.com>
14 years agolibblkid: remove dead code section
Valerie Aurora [Thu, 29 Jul 2010 19:55:33 +0000 (15:55 -0400)]
libblkid: remove dead code section

commit 2d12ea54c70c9e6a2b77ca6f7b6a786309a22fa7
Author: Valerie Aurora <vaurora@redhat.com>
Date:   Thu Jul 29 12:47:35 2010 -0700

    libblkid: remove dead code section (duplication of ext* constants)

Signed-off-by: Valerie Aurora <vaurora@redhat.com>
14 years agolook: fix memory leak in look(1)
Davidlohr Bueso [Wed, 28 Jul 2010 21:17:56 +0000 (17:17 -0400)]
look: fix memory leak in look(1)

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agonamei: fix memory leak in namei(1)
Davidlohr Bueso [Wed, 28 Jul 2010 21:20:38 +0000 (17:20 -0400)]
namei: fix memory leak in namei(1)

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agobuild-sys: man aliases don't depend on original man page
Diego Elio 'Flameeyes' Pettenò [Wed, 28 Jul 2010 20:47:55 +0000 (22:47 +0200)]
build-sys: man aliases don't depend on original man page

Avoid rebuilding the man aliases over and over given that they do not
copy the content but only alias it.

Signed-off-by: Diego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com>
14 years agobuild-sys: use the silent-rules prefix when generating man pages.
Diego Elio 'Flameeyes' Pettenò [Wed, 28 Jul 2010 20:47:54 +0000 (22:47 +0200)]
build-sys: use the silent-rules prefix when generating man pages.

This is backward-compatible with automake 1.10 as the AM_V_GEN macro
is going to be null anyway.

Signed-off-by: Diego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com>
14 years agobuild-sys: drop shlibs/Makefile.am that only adds SUBDIRS
Diego Elio 'Flameeyes' Pettenò [Wed, 28 Jul 2010 20:40:04 +0000 (22:40 +0200)]
build-sys: drop shlibs/Makefile.am that only adds SUBDIRS

The same effect is gotten by changing SUBDIRS in the top-level
Makefile.am.

14 years agobuild-sys: drop the getsize test out of Makefile.am
Diego Elio 'Flameeyes' Pettenò [Wed, 28 Jul 2010 20:40:03 +0000 (22:40 +0200)]
build-sys: drop the getsize test out of Makefile.am

The #ifdef TEST_PROGRAM block was removed with commit
3069624180bac35f1cd468249ddb9dfc91d1b7b1 so there is no point in
keeping the tests declared, as it won't build.

Signed-off-by: Diego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com>
14 years agobuild-sys: require automake 1.10 as gtk-doc requires it anyway
Diego Elio 'Flameeyes' Pettenò [Wed, 28 Jul 2010 20:40:02 +0000 (22:40 +0200)]
build-sys: require automake 1.10 as gtk-doc requires it anyway

There's no point into requiring 1.9 if the gtk-doc makefiles only work
with 1.10.

Signed-off-by: Diego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com>
14 years agomkfs: add `mkfs.ext4` to section SEE ALSO of `mkfs.8`.
Paul Menzel [Wed, 28 Jul 2010 16:38:55 +0000 (18:38 +0200)]
mkfs: add `mkfs.ext4` to section SEE ALSO of `mkfs.8`.

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
14 years agochsh: don't suggest ypchsh
Karel Zak [Thu, 29 Jul 2010 12:54:19 +0000 (14:54 +0200)]
chsh: don't suggest ypchsh

  $ chsh
  chsh: can only change local entries; use ypchsh instead.

The 'ypchsh' is an external util that does not have to be installed.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=497329
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: fix "mount -a" for auto-clear loopdevs and /proc/mounts
Karel Zak [Thu, 29 Jul 2010 12:18:46 +0000 (14:18 +0200)]
mount: fix "mount -a" for auto-clear loopdevs and /proc/mounts

The "mount -a" uses /etc/mtab to detect already mounted file systems
from /etc/fstab -- this check requires the same FS name (1st field)
in fstab and mtab.

On systems with enabled auto-clear loop devies or systems without
regular mtab  (symlink to /proc/mounts) there is /dev/loopN rather
than image filename in mtab. For example:

  fstab:
     /mnt/store/foo.ISO /mnt/image auto defaults 0 0

  mtab:
     /dev/loop0 /mnt/image iso9960 rw 0 0

We have to scan all available loop devices to check if some of the
devices is not associated with the image file from fstab.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=618957
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoportability: fix mntent.h and pty.h usage
François Revol [Mon, 26 Jul 2010 09:43:51 +0000 (11:43 +0200)]
portability: fix mntent.h and pty.h usage

Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoportability: use standard constants
François Revol [Mon, 26 Jul 2010 09:41:04 +0000 (11:41 +0200)]
portability: use standard constants

Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: fix use of non portable type
François Revol [Mon, 26 Jul 2010 09:37:19 +0000 (11:37 +0200)]
fdisk: fix use of non portable type

Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: set tolerant flag for HFS
Alexandre Peixoto Ferreira [Mon, 19 Jul 2010 23:04:33 +0000 (18:04 -0500)]
libblkid: set tolerant flag for HFS

An CDROM can contain both HFS and ISO9660 views on the same filesystem.
This confuses mount/KDE/Gnome.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: fix typo filesystem name nilfs to nilfs2
Jiro SEKIBA [Thu, 15 Jul 2010 04:40:27 +0000 (13:40 +0900)]
libblkid: fix typo filesystem name nilfs to nilfs2

The correct filesystem name is nilfs2, not nilfs.

Signed-off-by: Jiro SEKIBA <jir@unicus.jp>
14 years agomount: don't use auto-clear loopdev if mtab is available
Karel Zak [Tue, 20 Jul 2010 09:37:23 +0000 (11:37 +0200)]
mount: don't use auto-clear loopdev if mtab is available

 # mount /home/images/floppy.img /mnt/test2
 # mount | grep loop
 /dev/loop0 on /mnt/test2 type udf (rw)

mount(8) with auto-clear loopdev does not store information about the
original backing file (the image) to /etc/mtab. (Note that this is our
long-term goal, because we want to remove mtab from Linux.)

Unfortunately, losetup(8) is not able to provide full path for the
backing file, because LOOP_GET_STATUS ioctl uses 64 bytes for the
filename...

So, without the information about the backing file in mtab the
information about mapping between the file and the loopdev is
unaccessible from userspace.

From my point of view it would be nice to add all necessary
information about loopdevs to /sys rather than rely on broken
LOOP_GET_STATUS[64] ioctls.

with this patch:

  # mount /home/images/floppy.img /mnt/test2
  # mount | grep loop# mount | grep loop
  /home/images/floppy.img on /mnt/test2 type udf (ro,loop=/dev/loop0)

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=615389
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocfdisk: get_string not calculating correct limits
Karel Zak [Mon, 19 Jul 2010 20:52:58 +0000 (22:52 +0200)]
cfdisk: get_string not calculating correct limits

Reported-by: James L. Hammons <jlhamm@acm.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: add nilfs2 test for libblkid
Jiro SEKIBA [Tue, 13 Jul 2010 07:14:08 +0000 (09:14 +0200)]
tests: add nilfs2 test for libblkid

Signed-off-by: Jiro SEKIBA <jir@unicus.jp>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: add nilfs2 filesystem superblock probe
Jiro SEKIBA [Tue, 13 Jul 2010 07:12:56 +0000 (09:12 +0200)]
libblkid: add nilfs2 filesystem superblock probe

This patch implements nilfs2_idinfo to proble nilfs2 partition.
The patch probes uuid, label, version and verify crc check sum of
superblock.

Signed-off-by: Jiro SEKIBA <jir@unicus.jp>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: add COPYING.lib* files
Karel Zak [Mon, 12 Jul 2010 10:32:12 +0000 (12:32 +0200)]
docs: add COPYING.lib* files

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoflock: fix file number in flock.1 man page
Patrice Dumas [Wed, 7 Jul 2010 08:09:40 +0000 (10:09 +0200)]
flock: fix file number in flock.1 man page

According to a search on the internet, the 200 file number is not a
posix shell feature, since posix shells are only mandated to have 1
through 9.  I haven't verified that this claim is right, but, at least
dash doesn't like the 200. So here is a patch for the flock man page
that replaces 200 with 9.

Signed-off-by: Patrice Dumas <pertusus@free.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>