OSDN Git Service

android-x86/external-parted.git
13 years agotests: init.cfg: copy envvar setings from testlib.sh:
Jim Meyering [Thu, 18 Nov 2010 13:39:42 +0000 (14:39 +0100)]
tests: init.cfg: copy envvar setings from testlib.sh:

Unset TERM and CDPATH; sanitize LC_ALL, TZ, LANG, and set
PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING=1.
* tests/t1101-busy-partition.sh: Expect no output, now that we set
PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING=1.

13 years agomaint: update init.sh and bootstrap from gnulib
Jim Meyering [Thu, 18 Nov 2010 06:36:52 +0000 (07:36 +0100)]
maint: update init.sh and bootstrap from gnulib

* tests/init.sh: Update from gnulib.
* bootstrap: Likewise.

13 years agodoc: also mention KiB, MiB, GiB and TiB suffixes
Jim Meyering [Fri, 19 Nov 2010 18:32:08 +0000 (19:32 +0100)]
doc: also mention KiB, MiB, GiB and TiB suffixes

* doc/parted.texi (unit): Also mention KiB, MiB, GiB and TiB.

13 years agolibparted: ignore zero-length devices
Colin Watson [Wed, 17 Nov 2010 15:14:50 +0000 (15:14 +0000)]
libparted: ignore zero-length devices

* bootstrap.conf (gnulib_modules): Add xstrtoll.
* configure.ac: Create DYNAMIC_LOADING output variable.
* libparted/arch/linux.c (_device_get_length): Return the value of
PARTED_TEST_DEVICE_LENGTH if set in the environment, strictly for use by
the test suite.
(init_generic): If geometry probing fails because the device was
zero-length, return quietly rather than throwing an exception.  This has
been observed in the wild with cciss devices, and it's difficult for
partitioners to tell the difference between that and more serious
errors.
* libparted/tests/Makefile.am (TESTS): Add t2100-zerolen.sh.
(check_PROGRAMS): Add zerolen.
(zerolen_SOURCES): Add.
(TESTS_ENVIRONMENT): Add DYNAMIC_LOADING and ENABLE_DEVICE_MAPPER.
* libparted/tests/t2100-zerolen.sh: New file.
* libparted/tests/zerolen.c: New file.
* tests/test-lib.sh (wait_for_dev_to_appear_): New function, copied from
tests/t-local.sh.
* NEWS (Bug fixes): Mention it.

13 years agodos: fix a bug affecting very small devices (smaller than 1 cylinder)
Jim Meyering [Tue, 9 Nov 2010 09:25:36 +0000 (10:25 +0100)]
dos: fix a bug affecting very small devices (smaller than 1 cylinder)

This bug was introduced in commit c79d91ec, "dos: accommodate very
small devices (useful for testing)".
* libparted/labels/dos.c (_primary_constraint): The bug was to
skip setting start_geom for small devices.  That led to a used-
uninitialized bug in the subsequent ped_constraint_new call.
The fix is to relax the constraint to use a starting sector of "1",
if necessary.  Report and diagnosis by Jean-Christian de Rivaz in
http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10178
* NEWS (Bug fixes): Mention it.

13 years agomaint: don't use obsolete gnulib modules
Jim Meyering [Sun, 10 Oct 2010 17:01:52 +0000 (19:01 +0200)]
maint: don't use obsolete gnulib modules

* bootstrap.conf (gnulib_modules): Use calloc-gnu, malloc-gnu
and realloc-gnu modules, rather than calloc, malloc and realloc.
The shorter-named modules are now deprecated.

13 years agomaint: describe policy on copyright year number ranges
Jim Meyering [Sat, 9 Oct 2010 13:24:48 +0000 (15:24 +0200)]
maint: describe policy on copyright year number ranges

* README: Mention coreutils' long-standing policy on use of M-N
ranges in copyright year lists.  Requested by Richard Stallman.

13 years agobuild: update gnulib submodule to latest, and update bootstrap
Jim Meyering [Sun, 10 Oct 2010 15:59:27 +0000 (17:59 +0200)]
build: update gnulib submodule to latest, and update bootstrap

* bootstrap: update from gnulib

13 years agobuild: suggest libuuid from util-linux-ng package
Petr Uzel [Mon, 23 Aug 2010 12:29:46 +0000 (14:29 +0200)]
build: suggest libuuid from util-linux-ng package

* configure.ac: libuuid was moved from e2fsprogs to
util-linux-ng-2.16.  Because distributions now often
build e2fsprogs without libuuid support, suggest installing
libuuid from util-linux-ng if it is missing, not from e2fsprogs.

13 years agolibparted: remove limits on loop labels
Colin Watson [Thu, 19 Aug 2010 10:07:20 +0000 (11:07 +0100)]
libparted: remove limits on loop labels

There's no reason to impose any particular limit on loop labels, since
they just represent a single large partition.  Sector counts over 2^32
are needed for large RAID arrays.  Change the limit to 2^64 since that's
the upper limit imposed by libparted and it saves us implementing the
limit functions separately.  This bug appears to have been introduced
by commit 2dbc645c.

* libparted/labels/pt-limit.gperf: Change limits on "loop" to 2^64.
* tests/t9021-maxima.sh: Update for the new loop limit.
* NEWS (Bug fixes): Mention it.

13 years agoavoid non-srcdir "make check" failure
Jim Meyering [Wed, 18 Aug 2010 22:52:02 +0000 (18:52 -0400)]
avoid non-srcdir "make check" failure

* tests/Makefile.am (EXTRA_DIST): Add init.cfg.
The failure was introduced by commit 6f7c0f12.

13 years agobuild and tests: update bootstrap and init.sh from gnulib
Jim Meyering [Wed, 18 Aug 2010 22:39:53 +0000 (18:39 -0400)]
build and tests: update bootstrap and init.sh from gnulib

* tests/init.sh: Update from gnulib.
* bootstrap: Likewise.

13 years agobuild: update gnulib submodule to latest
Jim Meyering [Wed, 18 Aug 2010 21:41:43 +0000 (17:41 -0400)]
build: update gnulib submodule to latest

14 years agolinux: recognize scsi disks with a high major number (128-135)
Hans de Goede [Tue, 20 Jul 2010 10:17:53 +0000 (12:17 +0200)]
linux: recognize scsi disks with a high major number (128-135)

* libparted/arch/linux.c (SCSI_BLK_MAJOR): Recognize high major number.

14 years agolibparted: avoid regression when processing a whole-disk FAT partition
Jim Meyering [Thu, 15 Jul 2010 00:16:14 +0000 (19:16 -0500)]
libparted: avoid regression when processing a whole-disk FAT partition

Without this change, we would improperly classify a whole-disk partition
containing a FAT file system as a DOS partition table with no partitions.
Introduced by commit d732a2b7 on 2008-05-28.
* libparted/labels/dos.c (maybe_FAT): New function.
(msdos_probe): Use it.
Reported by ChenMin in
http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10115
* NEWS (Bug fixes): Mention it.
* tests/t3400-whole-disk-FAT-partition.sh: New file.  Test for the bug.
* tests/Makefile.am (TESTS): Add it.

14 years agotests: use init.cfg; required for init.sh-using tests
Jim Meyering [Sat, 17 Jul 2010 12:20:54 +0000 (07:20 -0500)]
tests: use init.cfg; required for init.sh-using tests

* tests/init.cfg: New file.
(require_512_byte_sector_size_): Slightly different function
than the one in test-lib.sh.

* tests/init.cfg: New file.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Wed, 14 Jul 2010 21:39:05 +0000 (16:39 -0500)]
build: update gnulib submodule to latest

14 years agomaint: remove trailing blank
Jim Meyering [Sat, 17 Jul 2010 00:21:44 +0000 (19:21 -0500)]
maint: remove trailing blank

* tests/t1101-busy-partition.sh: Remove trailing blank.

14 years agotests: update resize-fs to use wait_for_dev_to_appear_
Otavio Salvador [Tue, 29 Jun 2010 17:22:34 +0000 (14:22 -0300)]
tests: update resize-fs to use wait_for_dev_to_appear_

* t3000-resize-fs.sh: rely on wait_for_dev_to_appear_ to wait for the
device to be crated.

14 years agotests: rely on require_scsi_debug_module_ to modprobe scsi_debug module
Otavio Salvador [Tue, 29 Jun 2010 12:51:03 +0000 (09:51 -0300)]
tests: rely on require_scsi_debug_module_ to modprobe scsi_debug module

* t2310-dos-extended-2-sector-min-offset.sh: remove explicit modprobe
since it is done by require_scsi_debug_module_.
* t3200-type-change.sh: likewise.
* t9020-alignment.sh: likewise.
* t9030-align-check.sh: likewise.
* t9040-many-partitions.sh: likewise.

14 years agotests: add one: try to remove a busy partition
Otavio Salvador [Mon, 28 Jun 2010 22:45:51 +0000 (19:45 -0300)]
tests: add one: try to remove a busy partition

This test tries to reproduce the issue reported in Debian bug #582818[1].

 1. http://bugs.debian.org/582818

Basically it does:

 * create two primary partitions
 * mount the second one
 * remove the first (must work)
 * try to remove the second (must fail)

* tests/t1101-busy-partition.sh: new file.
* tests/Makefile.am (TESTS): add the new test in check target.

14 years agotests: skip loop-clobber-infloop if mkswap cannot be found
Otavio Salvador [Sat, 26 Jun 2010 22:23:16 +0000 (19:23 -0300)]
tests: skip loop-clobber-infloop if mkswap cannot be found

* tests/t0400-loop-clobber-infloop.sh: Skip the test is case of mkswap
cannot be found.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Sat, 26 Jun 2010 06:59:18 +0000 (08:59 +0200)]
build: update gnulib submodule to latest

* bootstrap: Update from gnulib.
* tests/init.sh: Likewise.

14 years agosun: revert "implement disk flag operations"
Colin Watson [Tue, 15 Jun 2010 18:49:40 +0000 (19:49 +0100)]
sun: revert "implement disk flag operations"

This reverts the libparted/labels/sun.c part of
723ea23c5df68cbe67d1f518ef484f4c77f516fa.  Sun disk labels do
not appear to be able to handle non-cylinder alignment
(http://bugs.debian.org/579948).
* libparted/labels/sun.c: Revert.

14 years agotests: adjust sun-partition-creating test to conform
Jim Meyering [Sat, 26 Jun 2010 07:22:59 +0000 (09:22 +0200)]
tests: adjust sun-partition-creating test to conform

* tests/t4000-sun-raid-type.sh: Adjust partition size so the
end falls on a cylinder boundary.

14 years agomaint: update README-release
Jim Meyering [Fri, 28 May 2010 19:02:45 +0000 (21:02 +0200)]
maint: update README-release

* README-release: Update to match the template used for diffutils,
coreutils, etc.

14 years agomaint: add gettext to list of bootstrapped-with tools in announcement
Jim Meyering [Fri, 28 May 2010 18:49:04 +0000 (20:49 +0200)]
maint: add gettext to list of bootstrapped-with tools in announcement

* cfg.mk (bootstrap-tools): Add gettext to the list.

14 years agopost-release administrivia
Jim Meyering [Fri, 28 May 2010 18:33:10 +0000 (20:33 +0200)]
post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

14 years agoversion 2.3
Jim Meyering [Fri, 28 May 2010 18:26:06 +0000 (20:26 +0200)]
version 2.3

* NEWS: Record release date.

14 years agodoc: regenerate two files using gettext-0.18
Jim Meyering [Fri, 28 May 2010 18:24:45 +0000 (20:24 +0200)]
doc: regenerate two files using gettext-0.18

* doc/pt_BR/partprobe.8.pt_BR.po: Regenerate with gettext-0.18.
* doc/C/po/partprobe.8.pot: Likewise.

14 years agobuild: require gettext-0.18 after all, because
Jim Meyering [Fri, 28 May 2010 17:55:34 +0000 (19:55 +0200)]
build: require gettext-0.18 after all, because

since gnulib is pulling in m4/gettext.m4 from 0.18, and there's
a cross-check between that file and po/Makefile.in.in, it's easiest
simply to require 0.18 of those who run build tools.  Otherwise,
requiring 0.17, build-from-git would fail due to the mismatch:
0.17 in Makefile.in.in and 0.18 in m4/gettext.m4.
* configure.ac (AM_GNU_GETTEXT_VERSION): Require gettext 0.18.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Fri, 28 May 2010 15:27:52 +0000 (17:27 +0200)]
build: update gnulib submodule to latest

14 years agomaint: use the do-release-commit-and-tag module from gnulib
Jim Meyering [Fri, 28 May 2010 15:26:45 +0000 (17:26 +0200)]
maint: use the do-release-commit-and-tag module from gnulib

* bootstrap.conf (gnulib_modules): Add do-release-commit-and-tag.

14 years agodoc: fix a typo
Petr Uzel [Fri, 28 May 2010 15:11:05 +0000 (17:11 +0200)]
doc: fix a typo

* doc/parted.texi: s/onstraints/constraints/

14 years agoparted: do_align_check returns always 1 in interactive mode
Petr Uzel [Fri, 28 May 2010 14:42:20 +0000 (16:42 +0200)]
parted: do_align_check returns always 1 in interactive mode

* parted/parted.c (do_align_check): Always return 1 in interactive mode.

14 years agobuild: really use gettext-0.17
Jim Meyering [Thu, 27 May 2010 14:32:34 +0000 (16:32 +0200)]
build: really use gettext-0.17

* configure.ac: Correct previous change to use 0.17, not 0.18,
since gettext-0.18 is new enough that it makes building from git
a little too inconvenient.  Spotted by Petr Uzel.

14 years agoparted: make align-check work in interactive mode
Petr Uzel [Wed, 26 May 2010 12:29:01 +0000 (14:29 +0200)]
parted: make align-check work in interactive mode

* parted/parted.c (do_align_check): rework the function so that
it reports partition alignment in interactive mode as described in
documentation.

14 years agoparted: initialize align_type to default value
Petr Uzel [Wed, 26 May 2010 12:27:07 +0000 (14:27 +0200)]
parted: initialize align_type to default value

* parted/parted.c (do_align_check): Initialize align_type to
default alignment; this prevents reading of uninitialized memory
later in command_line_get_align_type()

14 years agoparted: plug memory leak
Petr Uzel [Wed, 26 May 2010 12:10:04 +0000 (14:10 +0200)]
parted: plug memory leak

* parted/parted.c (_done_messages): Free unit_msg.

14 years agotests: avoid spurious failure of the root-only many-partitions test
Jim Meyering [Wed, 26 May 2010 10:19:07 +0000 (12:19 +0200)]
tests: avoid spurious failure of the root-only many-partitions test

* tests/t9040-many-partitions.sh: When creating a scsi_debug
device, honor the block size suggested by the PARTED_SECTOR_SIZE
environment variable, and thus required in expected output.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Wed, 26 May 2010 09:30:02 +0000 (11:30 +0200)]
build: update gnulib submodule to latest

14 years agomaint: remove useless definitions
Jim Meyering [Wed, 26 May 2010 09:43:09 +0000 (11:43 +0200)]
maint: remove useless definitions

* libparted/fs/xfs/platform_defs.h [__sparc__] (O_DIRECT):
Remove now-unneeded definition.
* parted/table.c (wchar_t): Remove definition.
* parted/strlist.c (wchar_t): Likewise.
* .x-sc_prohibit_always-defined_macros: New file.
Exempt two files from this syntax-check rule.
* Makefile.am (EXTRA_DIST): Add it here.

14 years agomaint: update helper scripts
Jim Meyering [Wed, 26 May 2010 09:32:56 +0000 (11:32 +0200)]
maint: update helper scripts

* tests/help-version: Update from coreutils.
* bootstrap: Update from gnulib.
* tests/init.sh: Likewise.

14 years agobuild: use gettext-0.17
Jim Meyering [Wed, 26 May 2010 09:29:56 +0000 (11:29 +0200)]
build: use gettext-0.17

* configure.ac: Use gettext-0.17.
* bootstrap.conf (gnulib_modules): Use gettext-h, not gettext.
since the latter drags in a depedency on gettext 0.18.

14 years agofix typo in comment
Jim Meyering [Tue, 25 May 2010 13:42:35 +0000 (15:42 +0200)]
fix typo in comment

14 years agolibparted: fail (don't just warn) upon failure to inform kernel of...
Jim Meyering [Mon, 10 May 2010 11:00:20 +0000 (13:00 +0200)]
libparted: fail (don't just warn) upon failure to inform kernel of...

partition change(s).
* libparted/arch/linux.c (_disk_sync_part_table): Throw an error, not
merely a warning.  When this fails, it indicates that the kernel has
not been informed, and that must translate to an error, since doing
otherwise would violate the contract of ped_disk_commit_to_os.
Suggested by Hans De Goede.

14 years agotests: make the new many-partitions test fail if it takes "too long"
Jim Meyering [Thu, 6 May 2010 16:37:21 +0000 (18:37 +0200)]
tests: make the new many-partitions test fail if it takes "too long"

* tests/t9040-many-partitions.sh: Fail if creating 60 partitions
takes more than a minute.

14 years agomaint: use latest bootstrap script from gnulib
Jim Meyering [Thu, 6 May 2010 13:20:00 +0000 (15:20 +0200)]
maint: use latest bootstrap script from gnulib

* bootstrap: Sync from gnulib.

14 years agogpt: recognize microsoft recovery GUID
Hans de Goede [Thu, 6 May 2010 13:09:35 +0000 (15:09 +0200)]
gpt: recognize microsoft recovery GUID

Microsoft advices creating recovery partitions with a GUID of
de94bba4-06d1-4d40-a16a-bfd50179d6ac, see:
http://technet.microsoft.com/en-us/library/dd744301%28WS.10%29.aspx

This patch makes parted recognize this guid (using the DIAG flag).
* libparted/labels/gpt.c (PARTITION_MSFT_RECOVERY, GPTPartitionData,
_parse_part_entry, gpt_partition_new, gpt_partition_set_system,
gpt_partition_set_flag, gpt_partition_get_flag,
gpt_partition_is_flag_available): Support microsoft recovery GUID.
* NEWS (New features): Add it.

14 years agomsdos: recognize id 27 as a diagnostics (recovery) partition type
Hans de Goede [Thu, 6 May 2010 08:25:35 +0000 (10:25 +0200)]
msdos: recognize id 27 as a diagnostics (recovery) partition type

msdos partitiontable partition id 27 is recommended by microsoft for
use as id for recovery partitions, see:
http://technet.microsoft.com/en-us/library/dd744364%28WS.10%29.aspx
http://bugzilla.redhat.com/show_bug.cgi?id=534066

* libparted/labels/dos.c (PARTITION_MSFT_RECOVERY): Define.
(raw_part_parse): Recognize id 27
(msdos_partition_set_system): Recognize id 27

14 years agotests: add one: create 60 partitions on a scsi device
Jim Meyering [Thu, 6 May 2010 12:11:33 +0000 (14:11 +0200)]
tests: add one: create 60 partitions on a scsi device

* tests/t9040-many-partitions.sh: New test.
* tests/Makefile.am (TESTS): Add it.
(TESTS_ENVIRONMENT): Export AWK to test scripts.
Inspired by the report of a many-partition test
taking far longer on RHEL5 than on RHEL4 in
http://bugzilla.redhat.com/589117

14 years agodoc: update NEWS
Jim Meyering [Wed, 5 May 2010 16:42:26 +0000 (18:42 +0200)]
doc: update NEWS

* NEWS (Bug fixes): Mention the ext2 2TiB FS-creation bug.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Wed, 5 May 2010 16:25:38 +0000 (18:25 +0200)]
build: update gnulib submodule to latest

14 years agoext2: don't overflow when creating a partition of size 2TiB or larger
Martin Poole [Wed, 5 May 2010 16:24:22 +0000 (18:24 +0200)]
ext2: don't overflow when creating a partition of size 2TiB or larger

Without this patch, mkpartfs would succeed in creating an ext2
partition, but the resulting partition would fail a mkfs.ext2 -f check.
* libparted/fs/ext2/parted_io.c (do_read): Avoid overflow 32-bit
sector count overflow for a partition of size 2TiB or larger.
(do_write): Likewise.
See http://bugzilla.redhat.com/584057#c16 a reproducer.

14 years ago_device_unregister: check for unregistering the same device twice
Hans de Goede [Wed, 28 Apr 2010 17:14:36 +0000 (19:14 +0200)]
_device_unregister: check for unregistering the same device twice

_device_unregister() can get called 2 times for the same device if
a libparted user explictly removes the device from the cache using
ped_device_cache_remove(), it gets called and it then becomes the
user's responsibility to free the PedDevice by calling
ped_device_destroy(). ped_device_destroy() will then call
_device_unregister() a second time with the same device, so if the
device is not found in the list, do nothing.

* libparted/device.c(_device_unregister): Check for unregistering
the same device twice.
Reported by Jan Stodola in <http://bugzilla.redhat.com/568346>.

14 years agotests: avoid root-only/XFS limit test failure on 32-bit system
Jim Meyering [Fri, 30 Apr 2010 13:59:14 +0000 (15:59 +0200)]
tests: avoid root-only/XFS limit test failure on 32-bit system

* tests/t4100-msdos-partition-limits.sh: Due to an inherent XFS
limitation on 32-bit systems, this test would fail a set-up
file creation step for simulated sector sizes of 4K and up.
Skip this test in those cases.
Upon dd failure, propagate its diagnostic to output, to make this
sort of problem easier to diagnose.
* tests/t4100-dvh-partition-limits.sh: Likewise.

14 years agolibparted: avoid race in informing the kernel of partition table changes
Jim Meyering [Fri, 30 Apr 2010 10:28:16 +0000 (12:28 +0200)]
libparted: avoid race in informing the kernel of partition table changes

When sync'ing a partition table change using the latest
code, sometimes we'd get an unwarranted failure like this:

    Warning: Partition(s) 1 on /dev/sdd have been written, but we
    have been unable to inform the kernel of the change, probably because
    it/they are in use.  As a result, the old partition(s) will remain in
    use.  You should reboot now before making further changes.

To be precise, when running the partition-resizing root-only test
in a loop:

    for i in $(seq 240); do make -C tests check VERBOSE=yes \
    TESTS=t3000-resize-fs.sh >& log.$i && printf . || echo $i $?; done

I would typically see about 50% of them fail on a Fedora 13 system.
It was obvious that this was due to a race condition when I found that
modifying that tests' parted...resize invocation to go via strace changed
the timing enough to make the test pass every time.

The fix is to retry the partition-removal step upon any EBUSY failure,
currently for up to 1 second (retrying up to 100 times, sleeping 10ms
after each failure).

* libparted/arch/linux.c (_disk_sync_part_table): Allocate "ok" using
calloc, now that its initial values matter.
Retry each removal upon EBUSY-failure.
* bootstrap.conf (gnulib_modules): Use gnulib's usleep module.

14 years agolibparted: variable renaming, minor "goto" reorg
Jim Meyering [Fri, 30 Apr 2010 10:01:08 +0000 (12:01 +0200)]
libparted: variable renaming, minor "goto" reorg

* libparted/arch/linux.c (_disk_sync_part_table): Rename local array:
s/rets/ok/, for readability.
Use only a single label, "cleanup:", rather than two: free_rets
and free_errnums.

14 years agolibparted: remove now-worse-than-useless _kernel_reread_part_table
Jim Meyering [Fri, 30 Apr 2010 09:45:51 +0000 (11:45 +0200)]
libparted: remove now-worse-than-useless _kernel_reread_part_table

Now that we're using BLKPG properly, there's no point in using the
less-functional BLKRRPART ioctl to make the kernel reread the partition
table.
More importantly, this function would fail when any partition is in
use, in spite of our having carefully vetted them via BLKPG ioctls.
* libparted/arch/linux.c (_kernel_reread_part_table): Remove function.
(linux_disk_commit): Don't call it.

14 years agotests: correct a root-only test
Jim Meyering [Thu, 29 Apr 2010 17:02:07 +0000 (19:02 +0200)]
tests: correct a root-only test

* tests/t2310-dos-extended-2-sector-min-offset.sh: Don't hard-code
"/dev/sdd5" in expected output.

14 years agomaint: avoid code duplication
Jim Meyering [Thu, 29 Apr 2010 14:02:40 +0000 (16:02 +0200)]
maint: avoid code duplication

* libparted/labels/dos.c (clear_flags): New function.
Factored (5 times) out of ...
(msdos_partition_set_flag): ...here.  Use the new function.

14 years agodos: add a partition flag for diagnostics / recovery partitions
Hans de Goede [Mon, 19 Apr 2010 11:55:32 +0000 (13:55 +0200)]
dos: add a partition flag for diagnostics / recovery partitions

msdos partition tables can contain diagnostics partitions (often used
nowadays as system recovery partitions).  For some users of libparted
(i.e., anaconda) it is useful to know if a dos partition is a regular
partition or a diagnostic partition.  For example, see
<http://bugzilla.redhat.com/534066>.

* include/parted/disk.h(_PedPartitionFlag): Add PED_PARTITION_DIAG
* libparted/disk.c(ped_partition_flag_get_name): Add PED_PARTITION_DIAG
* libparted/labels/dos.c: Add support for PED_PARTITION_DIAG flag
* doc/parted.texi (set): Document it.

14 years agotests: distribute new file, init.sh
Jim Meyering [Wed, 28 Apr 2010 20:50:35 +0000 (22:50 +0200)]
tests: distribute new file, init.sh

* tests/Makefile.am (EXTRA_DIST): Add init.sh.

14 years agotests: add help-version test (from coreutils)
Jim Meyering [Wed, 28 Apr 2010 17:27:16 +0000 (19:27 +0200)]
tests: add help-version test (from coreutils)

* tests/help-version: New file
* tests/Makefile.am (TESTS_ENVIRONMENT): Pass built_programs and VERSION
to test scripts -- both are required by help-version.
(TESTS): Add help-version.

14 years agoui: make --help tell where to report bugs
Jim Meyering [Wed, 28 Apr 2010 20:26:41 +0000 (22:26 +0200)]
ui: make --help tell where to report bugs

* parted/ui.c (help_msg): Tell where to report bugs.

14 years agotests: use gnulib's init.sh
Jim Meyering [Wed, 28 Apr 2010 20:18:51 +0000 (22:18 +0200)]
tests: use gnulib's init.sh

* tests/init.sh: New file, from gnulib.

14 years agotests: rename generated init.sh to old-init.sh
Jim Meyering [Wed, 28 Apr 2010 17:42:44 +0000 (19:42 +0200)]
tests: rename generated init.sh to old-init.sh

* tests/Makefile.am (old-init.sh): Rename from init.sh.
* libparted/tests/Makefile.am: Likewise.
* tests/test-lib.sh: Rename sole use.
* .gitignore: Rename here, too.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Wed, 28 Apr 2010 16:35:27 +0000 (18:35 +0200)]
build: update gnulib submodule to latest

14 years agotests: improved portability
Jim Meyering [Wed, 28 Apr 2010 17:20:21 +0000 (19:20 +0200)]
tests: improved portability

* tests/test-lib.sh: Don't use test's -a option.

14 years agomaint: remove empty lines at end of file
Jim Meyering [Wed, 28 Apr 2010 17:16:49 +0000 (19:16 +0200)]
maint: remove empty lines at end of file

This lets one more "syntax-check" test pass.
Run this command:
  git ls-files|grep -v gnulib|xargs perl -pi -0777 -e 's/\n\n+$/\n/'

14 years agomaint: pass newer "make syntax-check" tests from gnulib
Jim Meyering [Wed, 28 Apr 2010 17:14:17 +0000 (19:14 +0200)]
maint: pass newer "make syntax-check" tests from gnulib

* cfg.mk (local-checks-to-skip): Add these, to pass "make syntax-check"
sc_error_message_uppercase, sc_error_message_period.
* libparted/fs/ext2/ext2.h: Remove "#if HAVE_INTTYPES_H" guard.

14 years agotests: test all boolean flags
Jim Meyering [Wed, 21 Apr 2010 12:00:26 +0000 (14:00 +0200)]
tests: test all boolean flags

* tests/t3310-flags.sh: New test, suggested by Hans De Goede.
* tests/Makefile.am (TESTS): Add it.

14 years agodoc: use a valid http:.../AUTHORS URL
Jim Meyering [Tue, 27 Apr 2010 10:19:45 +0000 (12:19 +0200)]
doc: use a valid http:.../AUTHORS URL

* debug/clearfat/clearfat.c (AUTHORS): Point to the git repo.
* parted/parted.c (AUTHORS): Likewise.
* partprobe/partprobe.c (AUTHORS): Likewise.

* parted/parted.c: Include "version.h".
(_version): Use Version, not VERSION.

14 years agoui: get version number from a separately-compiled file
Jim Meyering [Mon, 26 Apr 2010 16:44:40 +0000 (18:44 +0200)]
ui: get version number from a separately-compiled file

* parted/Makefile.am (version.c, version.h): Generate.
(parted_LDADD): Add libver.a.
(noinst_LIBRARIES, nodist_libver_a_SOURCES): Define.
(BUILT_SOURCES): Initialize and append.
(MAINTAINERCLEANFILES): Update.
* parted/parted.c: Include "version.h".
(_version): Use the new global variable, Version, not VERSION.

14 years agolibparted: _disk_sync_part_table: allow interactive ignore
Jim Meyering [Fri, 23 Apr 2010 18:11:23 +0000 (20:11 +0200)]
libparted: _disk_sync_part_table: allow interactive ignore

* libparted/arch/linux.c (_disk_sync_part_table): Change diagnostic
so that it makes it clear what failed.  Let an interactive "ignore"
cause the function to succeed.

14 years agotests: remove partition explicitly before mklabel, to avoid new failure
Jim Meyering [Sun, 18 Apr 2010 09:15:45 +0000 (11:15 +0200)]
tests: remove partition explicitly before mklabel, to avoid new failure

* tests/t3000-resize-fs.sh: Before, mklabel was sufficient to clear
the partition table in preparation for the next iteration in this test.
However, with recent BLKRRPART/BLKPG changes that "mklabel" would evoke
a warning.  Remove the sole partition to avoid that.

14 years agolibparted: linux_disk_commit: don't ignore _disk_sync_part_table failure
Jim Meyering [Mon, 12 Apr 2010 10:08:16 +0000 (12:08 +0200)]
libparted: linux_disk_commit: don't ignore _disk_sync_part_table failure

* libparted/arch/linux.c (linux_disk_commit):
When calling _disk_sync_part_table, always return its result.

14 years agolibparted: _disk_sync_part_table: always return 0 upon failure
Jim Meyering [Mon, 12 Apr 2010 10:06:30 +0000 (12:06 +0200)]
libparted: _disk_sync_part_table: always return 0 upon failure

* libparted/arch/linux.c (_disk_sync_part_table):
Return 0 (not 1) upon failure.

14 years agodos: always allow at least two sectors for extended boot record
Colin Watson [Mon, 29 Mar 2010 13:40:54 +0000 (14:40 +0100)]
dos: always allow at least two sectors for extended boot record

Unless specifically told otherwise, the Linux kernel considers extended
boot records to be two sectors long, in order to "leave room for LILO".
When using anything other than cylinder alignment, libparted was only
allowing one sector in the minimum extended partition geometry, which in
some situations (e.g. following Phillip Susi's patch to reintroduce
BLKPG) could confuse the kernel into thinking that the EBR and the first
logical partition overlapped.

* libparted/labels/dos.c (_get_min_extended_part_geom): Allow at least
two sectors for the extended boot record.

14 years agotests: test for new 2-sector minimum ext-logical-separation
Jim Meyering [Tue, 30 Mar 2010 09:57:35 +0000 (11:57 +0200)]
tests: test for new 2-sector minimum ext-logical-separation

* tests/t2310-dos-extended-2-sector-min-offset.sh: New file.
* tests/Makefile.am (TESTS): Add it.

14 years agodos: accommodate very small devices (useful for testing)
Jim Meyering [Tue, 30 Mar 2010 14:50:59 +0000 (16:50 +0200)]
dos: accommodate very small devices (useful for testing)

* libparted/labels/dos.c (_primary_constraint): Don't pass a negative
"device_length" to ped_geometry_init when the underlying device
has fewer sectors than a "cylinder".

14 years agolibparted: allocate storage for diagnostic only when needed
Jim Meyering [Mon, 12 Apr 2010 08:13:18 +0000 (10:13 +0200)]
libparted: allocate storage for diagnostic only when needed

* libparted/arch/linux.c (_disk_sync_part_table): Rename local:
s/parts/bad_part_list/
Allocate space for it only if needed.
Use malloc rather than ped_malloc.
Move decl of FD down to first use.

14 years agolibparted: adjust code formatting
Jim Meyering [Mon, 12 Apr 2010 07:55:38 +0000 (09:55 +0200)]
libparted: adjust code formatting

14 years agolibparted: reword a diagnostic
Jim Meyering [Thu, 15 Apr 2010 11:45:44 +0000 (13:45 +0200)]
libparted: reword a diagnostic

14 years agolibparted: improve BLKPG error checking
Phillip Susi [Fri, 9 Apr 2010 19:22:20 +0000 (15:22 -0400)]
libparted: improve BLKPG error checking

This patch cleans up the BLKPG code that the previous patch put back
to perform proper error checking and in the event that some partitions
are in use, they can not be modified in the running kernel using BLKPG.
Warn the user that this is the case and advise them to reboot, just like
we do when BLKRRPART fails for the same reason, unless the partition in
question is unchanged.

14 years agolibparted: reenable use of BLKPG ioctls
Phillip Susi [Tue, 30 Mar 2010 19:04:43 +0000 (15:04 -0400)]
libparted: reenable use of BLKPG ioctls

This patch effectively reverses commit 1d8f9bec which removed the code
using the new BLKPG ioctls instead of the old BLKRRPART ioctl to update
the in-kernel partition table.  The reason for this is because BLKRRPART
fails if any partition on the disk is in use, but the BLKPG ioctls allow
you to manipulate the other partitions on the disk without requiring a
reboot.  Also BLKRRPART requires that the kernel understand the
partition table on the disk, which may not always be the case.

14 years agolinux: detect dm_task_run failure
Hans de Goede [Fri, 23 Apr 2010 11:08:43 +0000 (13:08 +0200)]
linux: detect dm_task_run failure

We were checking for a return value of < 0 for dm_task_run errors, but
dm_task_run returns 0 on error (and 1 on success). Thanks to Joe Jin
for spotting this, see Red Hat bug 582907.

* libparted/arch/linux.c(_dm_remove_map_name, _dm_is_part,
_dm_remove_parts, _dm_add_partition): dm_task_run returns 0 on error.

14 years agotests: test for palo and prep interaction
Jim Meyering [Tue, 20 Apr 2010 16:30:20 +0000 (18:30 +0200)]
tests: test for palo and prep interaction

* tests/t3300-palo-prep.sh: New file.
* tests/Makefile.am (TESTS): Add it.

14 years agodos: fix prep / palo flag handling
Hans de Goede [Mon, 19 Apr 2010 11:55:33 +0000 (13:55 +0200)]
dos: fix prep / palo flag handling

Setting the prep flag was not clearing the palo flag and vice versa
* libparted/labels/dos.c (msdos_partition_set_flag): Fix prep / palo
flag handling.

14 years agotests: remove unnecessary (duplicate) local var assignment
Jim Meyering [Tue, 20 Apr 2010 16:21:40 +0000 (18:21 +0200)]
tests: remove unnecessary (duplicate) local var assignment

* tests/t9021-maxima.sh: Remove duplicate ss=$sector_size_.

14 years agomaint: make PED_ASSERT and PED_DEBUG if-safe
Colin Watson [Tue, 20 Apr 2010 12:01:33 +0000 (13:01 +0100)]
maint: make PED_ASSERT and PED_DEBUG if-safe

Constructions such as:

  if (foo)
    PED_DEBUG (0, "foo");
  else
    PED_DEBUG (0, "not foo");

did not compile reliably, depending on the configuration.  Make this
work.

* include/parted/debug.h [DEBUG && __GNUC__ && !__JSFTRACE__]
(PED_DEBUG): Remove trailing semicolon.
[!DEBUG] (PED_ASSERT): Use do-while rather than while.
[!DEBUG] (PED_DEBUG): Likewise.

14 years agodoc: add HACKING
Jim Meyering [Sat, 17 Apr 2010 15:39:26 +0000 (17:39 +0200)]
doc: add HACKING

* HACKING: New file.  Copied from coreutils, with s/coreutils/parted/
and a few minor edits.

14 years ago.gitignore: ignore index files generated by ctags and cscope
Petr Uzel [Fri, 16 Apr 2010 08:01:08 +0000 (10:01 +0200)]
.gitignore: ignore index files generated by ctags and cscope

14 years agolibparted: add support for Linux software RAID arrays (mdraid)
Petr Uzel [Fri, 16 Apr 2010 08:01:29 +0000 (10:01 +0200)]
libparted: add support for Linux software RAID arrays (mdraid)

Recognize MD devices, so "parted -s /dev/md0 print" now prints
"Model: Linux Software RAID Array (md)" instead of
"Model: Unknown (unknown)".

* include/parted/device.h (PedDeviceType): Add PED_DEVICE_MD.
* libparted/arch/linux.c (MD_MAJOR): New define.
* libparted/arch/linux.c (_device_probe_type): Recognize MD array.
* libparted/arch/linux.c (linux_new): Handle MD array.
* parted/parted.c(do_print): Add "md" to the list of available
transports.
* NEWS (New features): Mention it.

14 years agotests: propagate recent improvements to copied-from code
Jim Meyering [Tue, 13 Apr 2010 19:17:50 +0000 (21:17 +0200)]
tests: propagate recent improvements to copied-from code

* tests/t1700-ext-probe.sh: Fix typo s/2>1/2>&1/ and use
a tighter regexp also in the preceding loop.
Noted by Colin Watson.

14 years agomaint: constify ped_device_get_constraint interface
Colin Watson [Mon, 12 Apr 2010 09:16:21 +0000 (10:16 +0100)]
maint: constify ped_device_get_constraint interface

* include/parted/device.h (ped_device_get_constraint): Constify "dev"
parameter.
* libparted/device.c (ped_device_get_constraint): Likewise.

14 years agolibparted: uninit_bg and flex_bg features should indicate ext4
Colin Watson [Mon, 12 Apr 2010 23:11:13 +0000 (00:11 +0100)]
libparted: uninit_bg and flex_bg features should indicate ext4

According to tune2fs(8), the uninit_bg and flex_bg features are only
supported by ext4, so libparted should treat their presence as
indicating ext4.  Reported by C de-Avillez in
https://bugs.launchpad.net/ubuntu/+source/parted/+bug/561599.

* libparted/fs/ext2/ext2_fs.h: Define EXT4_FEATURE_RO_COMPAT_GDT_CSUM
and EXT4_FEATURE_INCOMPAT_FLEX_BG.
* libparted/fs/ext2/interface.c (_ext2_generic_probe): Test for
EXT4_FEATURE_RO_COMPAT_GDT_CSUM and EXT4_FEATURE_INCOMPAT_FLEX_BG when
probing for ext4.
* tests/t1700-ext-probe.sh: Test for this.
* NEWS (Bug fixes): Mention this.

14 years agolibparted: fix diagnostics about exceeding partition limits
Colin Watson [Fri, 9 Apr 2010 12:22:27 +0000 (13:22 +0100)]
libparted: fix diagnostics about exceeding partition limits

* libparted/labels/pt-tools.c (ptt_partition_max_start_len): Use the
correct value in the diagnostics that print the upper bound on
partition size and largest starting sector number.  Before, each
would use UINT32_MAX.  Now each prints the partition-table-specific
limit.

14 years agolibparted: add test for /dev/mapper symlink issue
Hans de Goede [Tue, 6 Apr 2010 13:57:17 +0000 (15:57 +0200)]
libparted: add test for /dev/mapper symlink issue

Sometimes, libparted operates on device mapper files with a path of
/dev/mapper/foo.  With newer lvm versions /dev/mapper/foo is a symlink
to /dev/dm-#. However some storage administration programs (anaconda,
for example) may do the following:
1) Create a ped_device for /dev/mapper/foo
2) ped_get_device resolves the symlink to /dev/dm-#, and the path
   in the PedDevice struct points to /dev/dm-#
3) The program does some things to lvm, causing the symlink to
   point to a different /dev/dm-# node
4) The program does something with the PedDevice, which results
   in an operation on the wrong device

Newer libparted versions do not suffer from this problem, as they
do not canonicalize device names under /dev/mapper. This test checks
for this bug.

* libparted/tests/symlink.c: New test which tests for this issue.
* libparted/tests/t3000-symlink.sh: New file.
* libparted/tests/Makefile.am: Include the new files.  Run the new test.

14 years agolibparted: don't canonicalize /dev/mapper paths
Hans de Goede [Tue, 6 Apr 2010 13:57:18 +0000 (15:57 +0200)]
libparted: don't canonicalize /dev/mapper paths

Besides fixing the issue displayed by libparted/tests/symlink.c,
this has the added advantage that the output of parted p on one of these
devices now says:
"Disk /dev/mapper/BigVol2-lv_iscsi_disk2: 34.4GB"

Which is a lot more user friendly then the output before this patch:
"Disk /dev/dm-6: 34.4GB"

* libparted/device.c (ped_device_get): Don't canonicalize names
that start with "/dev/mapper/".
* NEWS (Bug fixes): Mention it.
Thanks to Ales Kozumplik for the analysis.
Details in <http://bugzilla.redhat.com/577824>.