Fetching contributors…
Cannot retrieve contributors at this time
8663 lines (6480 sloc) 352 KB
2012-03-02 Jim Meyering <>
version 3.1
* NEWS: Record release date.
maint: bump library version to 2.0.0
* libparted/ (CURRENT): Increment, since I removed
maint: update README-release to reflect we now have two libraries
* README-release: Two sets of library version triples to adjust.
* bootstrap: Tiny fix from gnulib.
lib-fs-resize: remove unused probe-related code
* libparted/fs/r/hfs/probe.c: Remove probe-related functions.
There are not used.
* libparted/fs/r/fat/fat.c: Likewise.
* libparted/fs/r/hfs/probe.h: ...and declarations.
2012-02-26 Jim Meyering <>
libparted: avoid unwarranted failed assertion during mklabel
This could happen when running "parted -s $dev mklabel $type" for
nearly any $type, assuming the underlying disk's sector size is
larger than 512 bytes. This particular failure was noticed by
running tests/ with a simulated
sector size of 1024, as is done as part of a top-level "make check",
but so far, this failure has shown up only on RHEL-6.2.
That test attempts to exercise an ugly part of partition table
creation: during creation, parted checks for an existing
partition table by iterating through its list of known types and
attempting to read the disk, looking for a preexisting table.
Knowing this, the test takes all pairs of partition table types,
<A,B> and first creates a type of type A, and then creates on top
of that (erasing the original) a table of type B.
* libparted/labels/mac.c (_disk_analyse_ghost_size): Remove bogus
assertion. If the number of the sector with a matching signature
is too large, simply reject it by returning 0.
* NEWS (Bug fixes): Mention this.
2012-02-25 Jim Meyering <>
doc: improve NEWS
* NEWS: Expand/adjust wording in two entries.
2012-02-21 Jim Meyering <>
tests: sanitize PATH; do not discard mkswap output
* tests/init.cfg (sanitize_path_): New function, from coreutils.
Use it.
* tests/ Do not discard mkswap output
and diagnostics. This test would fail (e.g., on OpenSUSE 12.1), when
run with PATH not including /sbin. Reported by Bruno Haible.
2012-02-18 Jim Meyering <>
tests: skip failing use of mkfs.hfs unless using newer, fixed version
The old, segfaulting version does not recognize the -v option, while
the new one does. Use that to skip the test when it seems that
fsck.hfs is broken.
* tests/ Skip part of this root-only test
when fsck.hfs is the always-segfaulting version.
build,test: update gnulib, bootstrap and
* bootstrap: Update.
* tests/ Update.
* gnulib: Update.
* doc/ Updating gnulib pulls in newer syntax-check rules,
including one that rejects @lower_case@ variables in Makefiles.
Fix the sole violation: s/@mandir@/$(mandir)/
build: avoid non-srcdir build failure
* libparted/fs/ s!fsresize.sym!$(srcdir)/fsresize.sym!
2012-02-10 Jim Meyering <>
maint: placate syntax-check wrt tests/fs-resize.c
* tests/fs-resize.c (main): Remove unused #includes.
Do use set_program_name, to placate syntax-check.
doc: mention HFS+/FAT file system resizing in NEWS
* NEWS (New features): Mention it.
tests: test FAT and HFS file system resizing
* tests/ New test.
* tests/ (TESTS): Add it.
(check_PROGRAMS): Add fs-resize.
(fs_resize_LDADD): Define, so it links with both libraries.
2012-02-10 Christoph Hellwig <>
tests: add FS-resize test driver
* tests/fs-resize.c: New file, to test FAT/HFS resizing.
2012-02-10 Jim Meyering <>
lib-fs-resize: use linker script to expose only selected functions
* libparted/fs/ (libparted_fs_resize_la_LDFLAGS): Define.
(EXTRA_DIST): Distribute the new file.
(libparted_fs_resize_la_DEPENDENCIES): Make the library depend on it.
* libparted/fs/fsresize.sym: New file.
maint: remove r/hfs/DOC,HISTORY,TODO; add VERSION for new library
lib-fs-resize: rewrite ped_file_system_clobber
Before, it would probe for an existing file system type and then,
according to what it found, call the corresponding <FS_TYPE>_clobber
function. Now that we have restored only HFS and FAT FS-writing
support, only those few types have a corresponding _clobber function.
We would obviously fail to clear common types of file systems, and even
if we were to restore all previous _clobber functions, none of those
were able to handle sector sizes larger than 512. Not worth it.
* libparted/fs/r/filesys.c: Include pt-tools.h.
(MIN): Define.
(ped_file_system_clobber): Rewrite not to use hfs*_clobber or
fat_clobber. Instead, simply clear the first three and last two
sectors of the specified "device".
* libparted/fs/ (INCLUDES): Add
-I$(top_srcdir)/libparted/labels for new use of a ptt_* function.
lib-fs-resize: add wrappers for open,close,resize,get_resize_constraint
* libparted/fs/r/filesys.c: Implement ped_file_system_resize,
ped_file_system_open, ped_file_system_close and
* libparted/fs/r/hfs/hfs.c: Give a few functions global scope,
so we can use them from the above.
* libparted/fs/ Use automake's subdir-objects option.
This avoids conflicts with multiple *.o file names
(e.g., fat.o), now that two directories provide that name.
(AM_CFLAGS): Disable $(WERROR_CFLAGS), for now.
maint: update copyrights in r/
2012-02-07 Jim Meyering <>
lib-fs-resize: re-add HFS and FAT file-system-related code
This just adds the code, without hooking it up yet.
* po/ Add all libparted/fs/r/**.c files.
maint: remove now-unused fat-related functions
* libparted/fs/fat/bootsector.c (fat_boot_sector_generate)
(fat_boot_sector_write, fat_info_sector_write): Remove functions.
(fat_boot_sector_set_boot_code): Likewise.
* libparted/fs/fat/bootsector.h: Remove declarations.
* libparted/fs/fat/fat.c (fat_set_frag_sectors, fat_free_buffers):
Remove function.
* libparted/fs/fat/fat.h: Remove declarations.
tests: set PARTED_TEST_NAME, for valgrind
* tests/ (PARTED_TEST_NAME): Define.
* tests/ Clarify a comment.
libparted: gpt: avoid heap-read-overrun when rewriting 9-PTE table
Now that parted can rewrite a corrupt-or-misaligned 9-PTE table,
we have to be careful to allocate space for slightly more data
when the byte-count required for a PTE table is smaller than
the whole number of sectors would imply. I.e., when the PTE table
size is not a multiple of the sector size, there is a fraction of
that final sector for which we do not read data, but we do write.
Ensure we have space for the buffer we'll write and that it is
initialized (to 0's).
* libparted/labels/gpt.c (gpt_write): Allocate the right amount of
space. Use calloc, not malloc+memset.
2012-02-03 Jim Meyering <>
maint: adjust the URL that will appear in the generated announcement
* (url_dir_list): Use this$(PACKAGE)
for the first link listed in the generated announcement.
announce-gen now provides the faster mirror link automatically.
ui: rewrite disk_print_flags and partition_print_flags
* parted/parted.c (disk_print_flags): Avoid NULL-dereference on
failed malloc. Use xrealloc, not ped_realloc.
(partition_print_flags): Likewise; nearly identical code.
tests: avoid relatively harmless new "make syntax-check" failure
* tests/ Reverse compare arguments.
libparted: remove ped_realloc, now unused
* include/parted/ (ped_realloc): Remove declaration.
* libparted/libparted.c (ped_realloc): Remove definition.
2012-02-02 Brian C. Lane <>
doc: update parted documentation
* doc/parted.text: Add disk_set command.
tests: add test for GPT PMBR pmbr_boot flag
* tests/ New test
* tests/ Add new test
* NEWS: Add information about the GPT PMBR pmbr_boot flag
tests: update tests for new disk flags output
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
* tests/ Updated
2012-02-02 Brian C. Lane <>
parted: when printing, also print the new disk flags
This adds a 'Disk Flags:' line the displays the active disk flags.
In machine mode this is appended to the disk info line, after the
device model.
* parted/parted.c (disk_print_flags): New function
(_print_disk_info): Add Disk Flags information.
2012-02-02 Matthew Garrett <>
gpt: add commands to manipulate pMBR boot flag
Some BIOS systems will only boot from GPT partitions if the boot flag is
set on the protective MBR partition. This adds the ability to set this
flag using the disk_set and disk_toggle commands.
* include/parted/ (_PedDiskFlag): Add PED_DISK_GPT_PMBR_BOOT
* libparted/disk.c (ped_disk_flag_get_name): Add PED_DISK_GPT_PMBR_BOOT
* libparted/labels/gpt.c (_GPTDiskData): Add pmbr_boot flag.
(gpt_alloc): Init pmbr_boot to 0.
(gpt_read_headers): Set pmbr_boot state from PMBR boot flag.
(_write_pmbr): Add pmbr_boot flag and set PMBR boot flag from it.
(gpt_write): Pass pmbr_boot flag through to _write_pmbr
(gpt_disk_set_flag): New function
(gpt_disk_is_flag_available): New function
(gpt_disk_get_flag): New function
(gpt_disk_ops): Add disk_set_flag, disk_get_flag, disk_is_flag_available
* parted/parted.c (do_disk_set): New function
(do_disk_toggle): New function
(_init_commands): Add do_disk_set and do_disk_toggle
* parted/ui.c (command_line_get_disk_flag): New function
* parted/ui.h: Add command_line_get_disk_flag prototype.
2012-01-23 Jim Meyering <>
tests: create 128 partitions also in the scsi-backed test
* tests/ Tighten up: use less memory:
1 sector per partition rather than 256.
Exec parted just once, not once per partition.
With that, we can increase the number of partitions to create
from 60 (which used to take 2.5 minutes on an F12-era kernel)
to the standard-GPT-header-imposed maximum of 128.
Suggested by Phillip Susi.
tests: exercise today's bug fix, creating a GPT table with 128 entries
* tests/ New test.
* tests/ (TESTS): Add it.
libparted: gpt: avoid invalid free with many (~100) partitions
* parted/parted.c (do_print): Remove invalid free.
Bug introduced via v1.8.8.1-19-gb56d69c.
* NEWS (Bug fixes): Mention this.
2012-01-22 Jim Meyering <>
tests: test for yesterday's bug fix
* tests/ (TESTS): Add it.
* tests/ New test.
libparted: gpt: rewrite even a 9-partition-entry table properly
The vast majority of GPT partition tables have 128 PTEs (partition
table entries. However, zfs-related ones have only 9, and when
rewriting one (which can happen only in interactive mode), parted
would fail to write the full PTE array whenever the PTE array size
was not a multiple of the sector size. This fixes the same type
of bug as v3.0-45-gce85c51.
* libparted/labels/gpt.c (gpt_write): When computing how many sectors
to write for the PTE array, round up rather than truncating. This
matters only when n_PTEs * 128 is not a multiple of the sector size.
For details on how to reproduce see the test or
* NEWS (Bug fixes): Mention it.
2012-01-21 Jim Meyering <>
maint: clean-up preparing for bug fix
* libparted/labels/gpt.c (gpt_write): Rename local:
s/ptes_size/ptes_bytes/; declare as size_t, not "int".
Move decls "down".
2012-01-19 Phillip Susi <>
libparted: raise dos partition limit from 16 to 64
* NEWS (Bug fixes): Mention it.
* libparted/labels/dos.c (MAX_TOTAL_PART): s/16/64/
* tests/ s/13/61/ (MAX_TOTAL_PART-3)
(adjust/factor some of the logic - jmm)
2012-01-18 Phillip Susi <>
libparted: enforce dos partition limit
The msdos partition table claimed a maximum partition count of 16
but would allow you to go beyond that. This resulted in the kernel
not being informed of those partitions. Corrected to enforce the
* NEWS (Bug fixes): Mention it.
* libparted/labels/dos.c (next_primary): Return -1 upon failure.
(next_logical): Stop no later than MAX_TOTAL_PART.
Throw exception and return -1 upon failure.
(msdos_partition_enumerate): Convert a negative partition number
return value from either of the above two to failure (return 0).
* tests/ New file.
* tests/ (TESTS): Add it.
2012-01-13 Jim Meyering <>
build: revert the recent "fix" to avoid make warnings about linux.lo
It avoided the warning, but introduced a real problem
when building from a clean directory.
The real solution will have to wait, since it appears to
depend on a fix in automake.
This reverts commit a3c351c2d1cf2c0000bbc681959695c612bd19a0.
2012-01-13 Jim Meyering <>
build: don't use -version for convenience libraries
Don't use -release, either. This avoids warnings from libtool.
* libparted/fs/ (libfs_la_LDFLAGS): Remove.
build: use LT_INIT, to make bootstrap run libtoolize
* Use LT_INIT, so that bootstrap runs libtoolize,
which creates build-aux/
2012-01-12 Jim Meyering <>
maint: remove useless BUILD_LINUX conditional
* (BUILD_LINUX): Don't set it.
* libparted/ (BUILD_LINUX): Remove useless use.
2012-01-12 Jim Meyering <>
maint: avoid long-standing warnings from make:
Makefile:1274: warning: overriding recipe for target `linux.lo'
Makefile:1267: warning: ignoring old recipe for target `linux.lo'
* libparted/ (EXTRA_DIST): Rename from
2012-01-12 Jim Meyering <>
libparted: provide a new convenience function: ptt_geom_clear_sectors
* libparted/labels/pt-tools.c (ptt_geom_clear_sectors): New function.
* libparted/labels/pt-tools.h: Declare it.
2012-01-11 Jim Meyering <>
maint: remove "MAINTAINERCLEANFILES =" from's
* debug/ As above.
* debug/test/ Likewise.
* doc/C/ Likewise.
* doc/pt_BR/ Likewise.
* include/ Likewise.
* include/parted/ Likewise.
* libparted/ Likewise.
* libparted/fs/ Likewise.
* libparted/tests/ Likewise.
* partprobe/ Likewise.
* doc/ Likewise, for mdate-sh and texinfo.tex.
2012-01-10 Keshav P R <>
build: insert -I$(top_builddir)/include before -I$(top_srcdir)/include
everywhere, for those who perform non-srcdir builds from a pristine
cloned directory. There is no problem when building from a tarball,
since that includes include/parted/*.h files under $(top_srcdir).
* libparted/ Insert it.
* libparted/fs/ Likewise.
* libparted/labels/ Likewise.
* libparted/tests/ Likewise.
* parted/ Likewise.
* partprobe/ Likewise.
* tests/ Likewise.
2012-01-10 Jim Meyering <>
build: .gitignore: ignore more
maint: hoist libparted/fs/*/ into parent
There was no need to have a separate for each file system
type, and a good reason *not* to do that (reduce duplication).
* (AC_OUTPUT): Remove Makefiles.
* libparted/fs/ (SUBDIRS): Remove.
(EXTRA_DIST): List the two non-src files: hfs/DOC hfs/HISTORY.
(libfs_la_SOURCES): Hoist file names to here from...
* libparted/fs/amiga/
* libparted/fs/ext2/ Likewise.
* libparted/fs/fat/ Likewise.
* libparted/fs/hfs/ Likewise.
* libparted/fs/jfs/ Likewise.
* libparted/fs/linux_swap/ Likewise.
* libparted/fs/nilfs2/ Likewise.
* libparted/fs/ntfs/ Likewise.
* libparted/fs/reiserfs/ Likewise.
* libparted/fs/ufs/ Likewise.
* libparted/fs/xfs/ Likewise.
* libparted/fs/*/ Remove files.
* libparted/fs/amiga/a-interface.c: Now that the .o files are all
in the same place, rename from interface.c, to avoid collision with
name of .o file from ext2/interface.c.
build: correct my typo in preceding commit
* (AC_CONFIG_SRCDIR): Correct preceding commit.
Keshav's patch was correct, but when I attempted to do the same
thing manually I wrote rather than .in.h.
2012-01-10 Keshav P R <>
build: update AC_CONFIG_SRCDIR for non-srcdir-from-clone builds
* (AC_CONFIG_SRCDIR): List, rather than
the now-generated parted.h, for those who run configure not from
a distribution tarball, but from a non-srcdir build using a pristine
2012-01-09 Jim Meyering <>
maint: rename public .h files to .in.h
Generate .h files from .in.h files, so that we can continue
to use _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST in the primary
sources, without including them in publicly-installed files.
Each generated (and later installed) header file gets expansions
of those macros.
* include/parted/ New rules.
* .gitignore: Ignore the generated files.
* (SUBDIRS): Reorder so we build in include/ before
libparted, i.e., so that we generate the .h files we'll need.
parted.h: use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE in VC'd files
However, we will replace those strings with their expansions when
installing them.
* include/parted/parted.h: Revert part of commit v3.0-83-gd51bfc0.
tests: root-only test would fail to remove its loop device
* tests/ Ironically, when skipping this test,
there was a race condition where in more than 7 out of 10 trials,
this test's "losetup -d $dev" command would fail with "device in use".
Hence, with enough testing, I would eventually use up all loop devices
and start getting new test failures due to losetup *creation* failure.
build: fix "make distcheck" failure
Ever since "make distcheck" began using sudo (i.e., running "make check"
as root, and then running it as non-root), the build-after-root would
often fail due to some derived files being owned by root.
This change adds a "chown -R $USER ." to restore order.
* (root-check): Run "chown -R $USER ." after sudo run.
(root_check): Rename variable from root-check, to avoid a warning
from automake about non-POSIX variable.
build: appease gcc's -Werror=suggest-attribute=pure
* parted/strlist.c (wchar_strcasecmp): Add pure attribute; make static.
(wchar_strncasecmp): Likewise.
(wchar_strdup): Likewise.
2012-01-09 Jim Meyering <>
build: update to latest from gnulib
* bootstrap: Update.
* tests/ Likewise.
* gnulib: Update submodule to latest.
maint: remove two generated files in doc/
* doc/fdl.texi: Remove file from version control. It is generated.
* doc/gendocs_template: Likewise.
* doc/parted.texi: Add @node ... before inclusion of fdl.texi,
since fdl.texi dropped that part.
* doc/parted-pt_BR.texi: Likewise.
* doc/.gitignore: Update.
build: accommodate newer bootstrap from gnulib
* bootstrap.conf (gnulib_tool_option_extras): Add both --symlink
and Remove stray use of $bt.
* lib/ Initialize all of the following so that
generated code in may use += to append to those variables:
2012-01-09 Jim Meyering <>
libparted: gpt: a smaller device need not render both headers invalid
Putting a valid GPT-labeled image on a smaller device, (i.e., one that
truncates the backup GPT header, but that does not impact the primary
one) should not render the primary header invalid.
* libparted/labels/gpt.c (_header_is_valid): Do *not* reject a header
when its last_usable value is larger than the device length.
This reverts part of commit v3.0-10-g99f9c6a, "gpt: don't abort for a
truncated GPT-formatted device". With this change, running parted in
interactive mode with such an image/device combination will recognize
that only the backup header is corrupt, and will offer to correct it.
Before, it would report that both headers were corrupt.
* tests/ New file.
* tests/ (TESTS): Add it.
gpt: eliminate four PED_ASSERT uses
* libparted/labels/gpt.c (_parse_header): Convert a few PED_ASSERT
uses to friendlier 'test-and-return-0's. Reported by Graham Markall
2012-01-08 Jim Meyering <>
libparted: don't use _GL_ATTRIBUTE_CONST in public parted.h, ...
Instead, use the bare __attribute__((__const__)).
* include/parted/parted.h (__attribute): Define.
(ped_get_version): Use open-coded __attribute.
Prompted by a report from Keshav P R.
tests: fix misleading mkpart usage
Using "primary" is fine (and common) as a partition *type* for dos
partition tables, but with a partition table of type GPT, it is
downright misleading to specify the partition *name* as "primary".
* tests/ Use "p-name" as partition name,
rather than misleading "primary".
* tests/ Likewise.
2012-01-05 Jim Meyering <>
tests: skip loop-partitioning tests when ext_range is < 2
* tests/init.cfg (require_partitionable_loop_device_): New function.
* tests/ Use it.
* tests/ Use it.
libparted: remove _blkpg_get_partition
[I applied Phillip's initial patch, omitting both my adjustments
and his own v2 changes. This addresses both of those omissions. ]
* libparted/arch/linux.c (_blkpg_get_partition): Remove function
and sole use, per patch from Phillip Susi.
(_kernel_get_partition_start_and_length): Adjust formatting,
remove unnecessary test and correct a diagnostic.
2012-01-05 Phillip Susi <>
libparted: avoid the HDIO_GETGEO ioctl when possible
We were using the long depreciated HDIO_GETGEO ioctl on the
partition to get its start sector. Use the new BLKPG_GET_PARTITION
ioctl instead. This allows for disks > 2TB and partitioned loop
devices, which don't support HDIO_GETGEO. As a fallback when
BLKPG_GET_PARTITION fails or is not availible, try getting the
values from sysfs, and finally use BLKGETSIZE64 and HDIO_GETGEO
as a last resort.
libparted: remove has_partitions check to allow loopback partitions
Commit 1b766b69 added the _has_partitions function to check if a device
was a loop device and if so, skip updating the kernel partition table
because loop devices did not support partitions. This function never
worked anyway, and loop devices now (since linux 3.2) support
partitions, so remove this crufty code.
* libparted/arch/linux.c (_has_partitions): Remove function and
all uses.
libparted: remove _loop_get_partition_range
Commit 1eb0cc30 added support for loop devices to be partitioned,
but it only enabled that support if the kernel parameter max_part
was non zero. This parameter just reserves minor numbers for
partitions in the traditional sequence that hard disks used.
When it is zero, it is still possible to add partitions, they
just will get minor numbers from another pool. Removing this
check allows partitions to be used on loop devices even when the
loop module was not loaded with the max_part argument.
* libparted/arch/linux.c (_loop_get_partition_range): Remove function
and all uses.
2012-01-05 Jim Meyering <>
tests: fix a bug in wait_for_dev_to_disappear_ helper function
* tests/ (wait_for_dev_to_disappear_): Correct
typo: missing expr in subshell.
2012-01-04 Phillip Susi <>
libparted: linux: exclude floppy from device scan
Floppies can't be partitioned anyhow, and some people have a
misconfigured BIOS that thinks there is a floppy when there
actually isn't, and trying to scan it causes hanging.
2012-01-03 Phillip Susi <>
tests: try harder to clean up scsi_debug
Tests were failing because the previous test gave up while trying to
unload the scsi_debug module. Try longer to remove it, and then throw
in a call to udevadm settle for good measure.
* tests/ Try harder to release resources here, rather than...
* tests/ this one test.
* tests/ (require_scsi_debug_module_): Now that
cleanup requires "udevadm settle", add that requirement here:
call require_udevadm_settle_.
2012-01-01 Jim Meyering <>
maint: update all copyright year number ranges
Run "make update-copyright".
2011-12-15 Phillip Susi <>
doc: add NEWS entry for "Add partition separator only when required"
2011-12-12 Phillip Susi <>
Add partition separator only when required
Device mapper type should not automatically
mean add 'p' before the partition number. Fall back to
adding it only if the previous character is a digit.
This complies with kpartx behavior and linux behavior
"since the dawn of time".
2011-12-03 Jim Meyering <>
build: update gnulib submodule to latest
build: address a new "noreturn" suggestion
* parted/ui.h (help_msg): Declare as __noreturn__.
build: use -Wno-format-nonliteral
build: mark functions with "const" or "pure" attribute, per gcc warnings
Use _GL_ATTRIBUTE_PURE or _GL_ATTRIBUTE_CONST. Mark static functions at
point of definition; extern ones at point of declaration.
* include/parted/crc32.h:
* include/parted/device.h: Likewise.
* include/parted/disk.h: Likewise.
* include/parted/exception.h: Likewise.
* include/parted/filesys.h: Likewise.
* include/parted/geom.h: Likewise.
* include/parted/natmath.h: Likewise.
* include/parted/parted.h: Likewise.
* include/parted/unit.h: Likewise.
* libparted/arch/linux.c: Likewise.
* libparted/disk.c: Likewise.
* libparted/exception.c: Likewise.
* libparted/fs/amiga/amiga.h: Likewise.
* libparted/labels/aix.c: Likewise.
* libparted/labels/bsd.c: Likewise.
* libparted/labels/dos.c: Likewise.
* libparted/labels/dvh.c: Likewise.
* libparted/labels/efi_crc32.c: Likewise.
* libparted/labels/gpt.c: Likewise.
* libparted/labels/mac.c: Likewise.
* libparted/labels/pc98.c: Likewise.
* libparted/labels/rdb.c: Likewise.
* libparted/labels/sun.c: Likewise.
* libparted/unit.c: Likewise.
* parted/ui.c: Likewise.
* parted/strlist.c: Likewise.
* parted/strlist.h: Likewise.
* libparted/tests/common.h (_implemented_disk_label): Mark as pure.
* libparted/cs/natmath.c (extended_euclid): Mark as pure.
build: avoid new float-to-double warnings
* libparted/timer.c (ped_timer_new_nested): Mark literal floating point
constants with "f" suffix, since they are compared against "float"s.
* parted/parted.c (_timer_handler): Likewise.
build: tweak how bootstrap manages ChangeLog
* bootstrap.conf: Create ChangeLog only by touching it, so that
it doesn't ever remove my in-use symlink (w/vc-dwim).
tests: two more of these: use "compare exp out", not "compare out exp"
* tests/ Reverse compare arguments.
* tests/ Likewise.
2011-11-29 Jim Meyering <>
tests: use "compare exp out", not "compare out exp"
Likewise, when an empty file is expected, use "compare /dev/null out",
not "compare out /dev/null". I.e., specify the expected/desired contents
via the first file name. Prompted by a suggestion from Bruno Haible
Run these commands:
git grep -l -E 'compare [^ ]+ exp' \
|xargs perl -pi -e 's/\b(compare) (\S+) (exp\S*)/$1 $3 $2/'
git grep -l -E 'compare [^ ]+ /dev/null' \
|xargs perl -pi -e 's,\b(compare) (\S+) (/dev/null),$1 $3 $2,'
2011-11-27 Petr Uzel <>
tests: test for partitions on mdraid
* tests/ New file.
* tests/ Run this test.
2011-11-26 Petr Uzel <>
libparted: use ext_range to find out largest possible partition
Parted uses /sys/block/DEV/range file to find out how many partitions
can the blockdevice hold and uses this number in its algorithm
for informing the kernel about modified partitions. This works
fine for most devices, however, it fails on partitionable MD arrays,
because these have 1 in range file. Using ext_range should be safer
and work for all devices.
* libparted/arch/linux.c (_device_get_partition_range): Use
/sys/block/DEV/ext_range instead of range sysfs file
* NEWS: Mention the change.
2011-11-26 Petr Uzel <>
build: gitignore tests/duplicate
.gitignore: Add tests/duplicate.
2011-11-11 Jim Meyering <>
maint: a little defensive programming in a test script
* tests/gpt-header-munge: Use "local *F;" to limit scope of
file handles.
2011-11-10 Jim Meyering <>
tests: skip a test if Perl's Digest::CRC module is not installed
* tests/init.cfg (require_perl_digest_crc_): New function.
* tests/ Use it.
Reported by Keshav P R in
tests: fix test for udevadm
* tests/init.cfg (sector_size_): Fix syntax error in test invocation.
maint: "make distcheck" now runs the root-only tests
* (root-check): New overridable variable and rule.
(distcheck-hook): Depend on it.
build: update gnulib submodule to latest
maint: adjust the URL that will appear in the generated announcement
* (url_dir_list): Use this$(PACKAGE)
for the first link listed in the generated announcement.
announce-gen now provides the faster mirror link automatically.
Remove now-unnecessary release-related URLs.
2011-11-06 Jim Meyering <>
build: update gnulib submodule to latest
build: stop distributing gzip'd releases; xz is enough
* (AM_INIT_AUTOMAKE): Add no-dist-gzip.
* NEWS (Build-related): Mention that we're dropping .tar.gz.
2011-11-05 Jim Meyering <>
tests: exercise and document the HFS-probe bug fix
Simply zeroing out the total_blocks and block_size members of the
on-disk _HfsMasterDirectoryBlock would provoke a failed assertion
any time parted tried to probe that partition.
* tests/ New script.
* tests/ (TESTS): Add it.
* NEWS (Bug fixes): Mention this.
2011-11-05 Brian C. Lane <>
libparted: HFS/HFS+ probe: don't let a corrupt FS evoke failed assertion
* libparted/fs/hfs/probe.c (hfsplus_probe): Add a check on the
search value and reject it if it is negative.
(hfsx_probe): Likewise.
(hfs_and_wrapper_probe): Likewise.
Reported by Flos Lonicerae in
2011-11-04 Brian C. Lane <>
tests: t9030 wait for partition removal
The removal of the partition may take enough time that the next
mkpart will fail. Wait for it to be removed.
Remove scsi_debug size and set the end of the partition to 800s so that
it will fit inside the default scsi_debug size of 8M, even when sector
size is 4Kb. This prevents failures on machines with limited memory.
* tests/ Wait for partition removal and use
a smaller disk.
2011-11-04 Jim Meyering <>
tests: add a helper function
* tests/ (wait_for_dev_to_disappear_): New function.
tests: exercise the "GPT vs other-sized partition entry arrays" fixes
* tests/ New file.
* tests/ (TESTS): Add it.
(EXTRA_DIST): Add gpt-header-munge.
tests: rewrite/complete GPT-munging perl script
Rewrite and complete this script.
It was incomplete and buggy. Now it works.
* tests/gpt-header-munge: Rename from ...
* tests/perl-munge-9-PTE-table: ...this.
2011-11-03 Jim Meyering <>
gpt: don't misbehave with e.g., a 9-entry partition array
* libparted/labels/gpt.c (_generate_header): Correct size of
partition array entries to round up to nearest multiple of
sector size, so that we set gpt->PartitionEntryLBA correctly
also when the number of partition entries is not a multiple
of sector_size / 128. Problem diagnosed by Robert Herndon
2011-11-03 Robert Herndon <>
gpt: prepare for tables with n_partition_array_entries != 128
* libparted/labels/gpt.c (gpt_read_PE_array): When computing the size
of the partition array entry, use the value of "number of partition
array entries" read from a GPT header, not the default of 128 that we
use when creating new headers. Details here:
2011-11-03 Jim Meyering <>
parted: exit nonzero for certain failures already diagnosed as "Error"
* parted/parted.c (do_print): Do not exit successfully when issuing
an error about an "unrecognised disk label" or when both GPT primary
and backup tables are corrupted.
* tests/ Adjust expected exit code to match
new behavior.
* NEWS (Bug fixes): Mention this.
tests: adjust a test to make its failure easier to diagnose
* tests/ When failing, also
emit parted's diagnostics.
2011-11-02 Jim Meyering <>
maint: correct two comments in gpt.c
* libparted/labels/gpt.c (gpt_read_headers): Correct the comment.
(_header_is_valid): Fix a harmless typo.
2011-11-02 Brian C. Lane <>
tests: add new test to check ped_disk_duplicate
* tests/duplicate.c: New test.
* tests/ New test program.
* tests/ (TEST): Add new test.
(check_PROGRAMS): Add new test program.
libparted: copy flags when duplicating GPT partitions
* libparted/labels/gpt.c (gpt_partition_duplicate): Copy flags to new
* NEWS: Mention this fix.
Reported by Chris Murphy in
2011-11-02 Petr Uzel <>
tests: exercise the new feature
* tests/ New file.
* tests/ Add it.
2011-11-02 Petr Uzel <>
parted: mkpart: DWIM for IEC ending sector numbers like 2MiB and 9GiB
Before, if the user specified start and end in mkpart command using
IEC units, parted created a partition that starts and ends exactly on
these positions. With such behavior, it is impossible to create
partitions as follows: 1MiB-2MiB, 2MiB-3MiB - parted would complain
that it cannot create the second partition, because the first one
occupied sectors 2048-4096 and the second one sectors 4096-3072,
so they would overlap at sector 4096.
With this patch, if the user uses IEC units to specify end of the
partition, parted creates the partition which ends one sector before
the specified position.
See also
* parted/ui.c (command_line_get_sector): Add parameter to retrieve
raw input from user.
* parted/ui.h (command_line_get_sector): Adjust prototype of function.
* parted/parted.c (_adjust_end_if_iec): New function.
(_strip_trailing_spaces): New function.
(_string_ends_with_iec_unit): New function.
(do_mkpart): Call _adjust_end_if_iec(). Use new parameter of
command_line_get_sector function.
(do_rescue): Adjust call to command_line_get_sector.
* bootstrap.conf (gnulib_modules): Add these: c-ctype, c-strcase.
* tests/ Adjust to new semantics.
* NEWS: Mention the changed behavior.
Notable adjustments:
- s/isspace/c_isblank/ so that parsing is locale-independent
- avoid an array-bounds error:
* parted/parted.c (_strip_trailing_spaces): Don't deref str[-1]
for an empty string.
2011-10-19 Brian C. Lane <>
tests: add tests for new pc98 signatures (#646053)
* tests/ New file
* tests/ Add test
2011-10-19 Brian C. Lane <>
libparted: make pc98 detection depend on signatures
pc98 is not a common disk label. Change pc98_probe to only return true
if one of the recognized signatures is present.
Currently these include:
Linux 98
This prevents false-positive detection on msdos labeled disks.
* libparted/labels/pc98.c (pc98_probe): Change to require signature
(pc98_check_ipl_signature): Add more signatures
(check_partition_consistency): Remove unused function
Reported by Zach Carter in
2011-10-15 Stefano Lattarini <>
tests: use more portable fd redirection in TESTS_ENVIRONMENT
* tests/ (TESTS_ENVIRONMENT): Redirection with `exec 9>&2'
is not portable to various Korn shells, and to (at least) HP-UX 11
/bin/sh. Use a more portable idiom.
See <> for
lots of discussion.
2011-10-15 Stefano Lattarini <>
tests: TEST_ENVIRONMENT simplified and made more robust
The test scripts in tests/ are shell scripts, so the current
definition of TESTS_ENVIRONMENT, which adaptively run tests using
either perl or the shell depending on their kind, is overkill.
Moreover, this change is required in order for the testsuite to
continue to work with the new testsuite harness that is planned
to be introduced in Automake 1.12 (which, as of the writing date,
is still under development and in late alpha state).
See also related discussion on bug-coreutils:
* tests/help-version: Moved ...
* tests/ ... to this.
* tests/ (TESTS): Update.
(TESTS_ENVIRONMENT): Remove definition of the `shell_or_perl_' shell
function, which is not required anymore.
(SH_LOG_COMPILER): New, define to `$(SHELL)'.
2011-10-14 Richard W.M. Jones <>
tests: fix the tests for the case where stdout/stderr is different
- More than one bogus ^M[[:space:]]*^M had to be removed, hence
use s,,,g sed expression.
- Test was not expecting any output to stderr. No longer true.
- Another case of s,,,g as above.
- Only testing output to stdout. Fold stdout & stderr together
and test both.
- Another case of s,,,g as above.
Some root tests still fail even with these fixes. The failures appear
to be unrelated to these changes.
2011-10-14 Richard W.M. Jones <>
parted: write a few errors and warnings to stderr instead of stdout
parted: strlist print functions can now send output to any FILE *
This changes the two strlist print functions so that instead of just
sending output to stdout, they can send it to any FILE *. Now the
caller can send errors to stderr instead of stdout.
2011-10-12 Petr Uzel <>
parted: make a warning message more informative
The following parted message is not very useful:
Error: You requested a partition from 2.00MiB to 3.00MiB.
The closest location we can manage is 2.00MiB to 3.00MiB.
Improve the message by including exact geometry (in sectors):
...requested a partition from 2.00MiB to 3.00MiB (sectors 2048..3072).
... location we can manage is 2.00MiB to 3.00MiB (sectors 2049..3072).
* parted/parted.c (do_mkpart): Include exact partition geometry in
the warning message.
* tests/ (normalize_part_diag_): Adapt to
handle the new form of the diagnostic.
* tests/ Adapt and change the name
of a temporary file.
2011-10-03 Petr Uzel <>
doc: update manpage
Remove documentation for removed commands, adjust general description to
match parted's capabilities, add documentation for 'toggle' and
'align-check' commands. Remove 'KNOWN ISSUES' section since it no longer
tests: verify that 'udevadm settle' is available
* tests/init.cfg (require_udevadm_settle_): New function.
* tests/ Call it.
2011-10-01 Petr Uzel <>
libparted: do not omit last sector when creating full-dev geometry
Note that ped_constraint_solve_max() is currently not used anywhere.
* libparted/cs/constraint.c (ped_constraint_solve_max): full_dev now
really represents whole device.
2011-10-01 Petr Uzel <>
maint: unmark PedDeviceType as deprecated
PedDeviceType was marked as deprecated before parted started using
git. Since it proved to be useful to differentiate between different
device types, and nobody seems interested in removing it from the API,
let's clear the deprecated flag.
2011-10-01 Petr Uzel <>
libparted: do not call _device_get_partition_range() twice
PED_MIN can evaluate its arguments twice.
* libparted/arch/linux.c (_disk_sync_part_table): Call
_device_get_partition_range() outside PED_MIN.
2011-10-01 Petr Uzel <>
libparted: optimize _disk_sync_part_table
In _disk_sync_part_table, if the largest partition number (lpn) is 0,
it does not make sense to go through the loops below. Return
immediately instead.
* libparted/arch/linux.c (_disk_sync_part_table): Return immediately
if lpn == 0.
build: ignore more generated files
parted: remove obsolete comments
is_start_exact and is_end_exact were removed from the source.
* parted/parted.c (constraint_from_start_end): Remove obsolete
documentation of the function.
libparted: check return value from ped_geometry_init
If ped_geometry_init() failed in ped_disk_set_partition_geom(),
then new_geom remains uninitialized, but still later used, which
leads to unexpected results.
* libparted/disk.c (ped_disk_set_partition_geom): Check return
value from ped_geometry_init().
2011-09-30 Petr Uzel <>
tests: add test for partitionable loop devices
* tests/ New file.
* tests/ Add test.
2011-09-29 Petr Uzel <>
libparted: improve support for partitions on loopback devices
Since linux-2.6.26, the kernel allows partitions on loopback devices.
Implement support for this feature in parted.
* libparted/arch/linux.c (_sysfs_int_entry_from_dev): New function.
(_loop_get_partition_range): New function.
(_device_get_partition_range): Add special handling for loop devices.
* NEWS: Mention this change.
libparted: differentiate between plain files and loop devices
Stop using PED_DEVICE_FILE for loopback devices;
loopback are significantly different from plain files.
* include/parted/device.h (PedDeviceType): Add PED_DEVICE_LOOP.
* libparted/arch/linux.c (_device_probe_type): Detect loopback device.
* parted/parted.c (do_print): Add "loopback" to list of transports.
dvh: factor out read_sector and use ptt_read_sector
* libparted/labels/dvh.c (read_sector): Factor out this function.
(dvh_probe): Use ptt_read_sector instead of read_sector.
(dvh_read): Likewise.
2011-09-28 Jim Meyering <>
build: update gnulib to latest; adapt use of _GL_ATTRIBUTE_FORMAT
* libparted/arch/linux.c (_GL_ATTRIBUTE_FORMAT): Define here,
now that it's no longer defined by gnulib.
build: avoid new syntax-check failure
* Exempt libparted/arch/beos.c from the PATH_MAX check.
I suspect that this is ok, because parted compiles only on systems
that define PATH_MAX to something reasonable.
doc: mention the origin of the other two bugs
* NEWS: Mention that the other two bugs were introduced long ago.
tests: test for the nilfs2 bug
* tests/ New test.
* tests/ (TESTS): Add it.
libparted: fix a bug in the nilfs2 probe function
* libparted/fs/nilfs2/nilfs2.c (nilfs2_probe): Reject this partition
if we get a negative sb2 offset. Passing a negative offset to
ped_geometry_read_alloc would evoke a failed assertion.
Bug introduced by 2010-07-09 commit d463e7de.
* NEWS: (Bug fixes): Mention it.
Reported by Daniel Fandrich in
2011-06-24 Jim Meyering <>
gpt: don't abort for a truncated GPT-formatted device
This fixes the problem two ways. The first fix (via gpt_alloc)
rejects any device that is too small, but it is insufficient.
Choose a slightly larger truncated device with an otherwise intact
primary GPT header and you can still trigger the failed assertion.
To fix it in general, we make _header_is_valid detect the problem.
* libparted/labels/gpt.c (gpt_alloc): Reject a device that is so
small that there is no room for a single partition.
(_header_is_valid): Validate LastUsableLBA here, as well, so that
we now reject as invalid any GPT header that specifies a
LastUsableLBA larger than the device size.
Leave the assertion in _parse_header.
* tests/ Test for this.
* tests/ (TESTS): Add it.
* NEWS: (Bug fixes): Mention it.
Reported by Daniel Fandrich in
libparted: avoid invalid diagnostic in interactive mode
* libparted/arch/linux.c (linux_read): In interactive mode,
a truncated device with a preexisting GPT could evoke this:
Error: end of file while reading Success
it should have been like this:
Error: end of file while reading /full/name/of/device
Use %0.0s to discard the strerror argument.
2011-06-22 Brian C. Lane <>
tests: add test for value less than 1
* tests/ New file.
* tests/ (TESTS): Add it.
tests: add test for radius divide by 2 fix
* tests/ New file.
* tests/ (TESTS): Add it.
2011-06-22 Brian C. Lane <>
libparted: don't allow values less than 1 (#665496)
When a value < 1 is used there is the possibility that the range can
overlap sector 0. The user should use smaller units instead. 0 is a
special case and is still allowed.
* libparted/unit.c (ped_unit_parse_custom): Throw error if a value
between 0 and 1 is used.
2011-06-22 Brian C. Lane <>
libparted: fix snap radius so that it is using half (#665496)
The snap radius didn't match the documentation, it has been using +/-
unit size instead +/- 0.5 * unit (eg. 500KB for a MB unit). This caused
problems when specifying 1MB, 1GB, etc. as a partition start or end
resulting in partitions being created that were nowhere near the
specified size.
* libparted/unit.c (ped_unit_parse_custom): divide radius by 2
This addresses
2011-06-10 Jim Meyering <>
maint: prefer AC_PROG_LIBTOOL over slightly deprecated AM_PROG_LIBTOOL
* Use AC_PROG_LIBTOOL rather than slightly deprecated
2011-06-07 H. Peter Anvin <>
libparted: simplify kernel version-parsing logic
* libparted/arch/linux.c: (_get_linux_version): Simplify and add
an assertion.
2011-06-07 Jim Meyering <>
libparted: accommodate two-component linux version number like 3.0
* libparted/arch/linux.c (_get_linux_version): Also accept 2-component
version numbers.
* NEWS: (Bug fixes): Mention it.
Reported by Richard W.M. Jones.
2011-05-30 Jim Meyering <>
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* (old_NEWS_hash): Auto-update.
version 3.0
* NEWS: Record release date.
maint: placate coverity: don't ignore some return values
* libparted/cs/constraint.c: Include <assert.h>.
(ped_constraint_exact): Don't ignore ped_alignment_init's return
value or that from ped_geometry_init.
loop: avoid NULL dereference upon failure
* libparted/labels/loop.c (loop_partition_duplicate): Don't dereference
NULL upon failure.
shared library version: increment major: 1.0.0
* libparted/ (CURRENT, REVISION): Update from 0.2.0 to 1.0.0,
due to removed interfaces.
build: update gnulib submodule to latest
2011-05-27 Jim Meyering <>
doc: update NEWS
* NEWS (Changes in behavior): Describe the change.
(Bug fixes): Mention the leak fixes.
doc: reflect removal of FS-related commands
* README (WARNING): Say that all FS-manipulation code is now gone.
* doc/parted.texi (Command explanations): Remove descriptions of and
any examples or references to the following commands: check, cp,
mkfs, mkpartfs, move, resize.
build: remove configure-time options: --disable-fs, --enable-Werror
* Remove support for --enable-fs and --disable-fs.
Remove support for --enable-Werror and --disable-Werror.
* README: Remove paragraph about --disable-fs and
* libparted/libparted.c: Now that --disable-fs is gone (i.e.,
ENABLE_FS would be always 1), remove its #ifdefs.
tests: make t0220 more useful when it fails
maint: update po/
* po/ Remove file names, to reflect file deletions.
doc: remove FS-related documentation and other stale bits
* doc/parted.texi: Remove FS-related documentation and other
stale bits.
linux_swap: remove all-but-probe FS-related code
xfs: remove all-but-probe FS-related code
jfs: remove all-but-probe FS-related code
ufs: remove all-but-probe FS-related code
reiserfs: remove all-but-probe FS-related code
hfs: remove all-but-probe FS-related code
ntfs: remove all-but-probe FS-related code
amiga: build with warning and error options
* libparted/fs/amiga/ (AM_CFLAGS): Add $(WARN_CFLAGS)
ext2: remove all-but-probe FS-related code
fat: remove all-but-probe FS-related code
remove all top-level FS-op code and the clearfat program
UI: remove all file-system-aware sub-commands
Note that we are removing the resize command, even though parted
appears to be the only free tool that provides the ability to
resize FAT16 and FAT32 file systems.
* parted/parted.c (do_mkfs, do_cp, do_mkpartfs): Remove functions.
(do_move, do_check, do_resize): Likewise.
(_init_commands): Remove each command-definition clause.
* parted/parted.c (_partition_warn_loss): Remove now-unused function.
* include/parted/filesys.h: Remove declarations of now-removed
FS-munging functions
tests: t1100: show that adding a partition on a busy device succeeds
* tests/ Demonstrate that adding a partition
succeeds, even when another on the same device is mounted (active).
amiga: avoid NULL-deref-on-OOM and an error-path leak
* libparted/labels/rdb.c (amiga_read): Don't dereference NULL on OOM.
Don't leak a constraint when failing to add a partition.
mac: avoid NULL-deref-on-OOM and an error-path leak
* libparted/labels/mac.c (mac_read): Don't dereference NULL on OOM.
Don't leak a constraint when failing to add a partition.
sun: avoid NULL-deref-on-OOM and an error-path leak
* libparted/labels/sun.c (sun_read): Don't dereference NULL on OOM.
Don't leak a constraint when failing to add a partition.
UI: avoid leak when interactive sector selection matches default
* parted/ui.c (command_line_get_fs_type): Don't leak an input "word".
UI: plug a leak
* parted/ui.c (command_line_get_fs_type): Don't leak an FS type name
bsd: avoid NULL-deref-on-OOM and an error-path leak
* libparted/labels/bsd.c (bsd_read): Don't dereference NULL on OOM.
Don't leak a constraint when failing to add a partition.
linux: don't leak a FILE* upon /proc read failure
* libparted/arch/linux.c (_probe_proc_partitions): Call fclose
upon failure.
linux: plug a file descriptor leak
* libparted/arch/linux.c (read_device_sysfs_file): Don't leak a
file descriptor.
tests: t1100-busy-label: don't use mkpartfs; rework to use scsi_debug
* tests/ Remove one last use of mkpartfs.
Use scsi_debug rather than requiring an explicitly-provided device.
maint: correct coverity-reported "suspicious sizeof"
* parted/table.c (table_add_row): Use sizeof(*VAR), rather than
erroneous sizeof(explicit_type) that just happened to be ok.
maint: remove unreachable code
* libparted/labels/sun.c (sun_partition_new): Remove unreachable stmt.
* libparted/labels/pc98.c (pc98_partition_new): Likewise.
build: update gnulib submodule to latest
2011-05-18 Jim Meyering <>
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* (old_NEWS_hash): Auto-update.
version 2.4
* NEWS: Record release date.
shared library version: increment REVISION
* libparted/ (REVISION): Increment, since there have
been changes to the library, but no interface addition or removal.
* README-release: Mention the shared-library version update procedure.
build: update gnulib submodule to latest
tests: avoid nasty FP-causing race condition
* tests/ Remove all partitions before
exiting -- otherwise, the rmmod-prompted removal of those many
partitions would continue long after rmmod completion and the
release of the scsi_debug lock, and thus partition-device removals
provoked by this test would cause failure in the subsequent test,
e.g., when the devices for partitions 14,15,16 have just been
successfully created (verified that they exist), yet the next
step -- to create a file system on one of them -- fails or is
erroneously skipped because the device has been removed asynchronously.
tests: add double quotes around another use of $VERBOSE
* tests/ (scsi_debug_setup_): Quote another $VERBOSE.
build: list bc as a build-requirement
* bootstrap.conf (buildreq): Also require "bc", since it's used
in some of 'make check's tests.
2011-05-17 Jim Meyering <>
tests: remove tests that are too FS-centric
* tests/ Likewise.
* tests/ Remove file, now that all FS-ops are gone.
* tests/ (TESTS): Remove them here, too.
linux: fix diagnostic about operating on very small file or device
* libparted/arch/linux.c (init_file): Correct diagnostic.
Parted would claim that a small-but-non-empty file has zero length.
bfs: remove unused files
tests: add double quotes around a use of $VERBOSE
* tests/ (scsi_debug_cleanup_): Add missing double quotes.
2011-05-12 Jim Meyering <>
tests: avoid new, spurious test failure
* tests/ Use a "device size"
that is large enough to accommodate 1KiB and 4KiB sectors.
The original size, 3MiB was too small for a dvh partition
with PARTED_SECTOR_SIZE=1024. Increase it to 30MiB.
tests: adapt t1101-busy-partition not to use mkpartfs
* tests/ Use mkfs.vfat instead.
2011-05-11 Jim Meyering <>
tests: write all pairs of partition table types
* tests/ New file.
* tests/ (TESTS): Add it.
2011-05-10 Jim Meyering <>
tests: add a NEWS entry and a test to exercise today's bug fix
* tests/t9041-undetected-in-use-16th-partition: New file.
* tests/ (TESTS): Add it.
* NEWS (Bug fixes): Describe it.
2011-05-10 Phillip Susi <>
linux: also detect "in-use" dmraid and scsi-Nth (N>=16) partitions
Prior to this change, Parted would fail to detect any in-use
partition on a dmraid disk, as well as any in-use partition
numbered 16 or greater on a regular scsi disk.
This was because assumptions were being made about the device node
major/minor numbers and how they relate to the partition number.
These assumptions are invalid for dmraid devices, and for normal
disks with >= 16 partitions.
* libparted/arch/linux.c (_partition_get_part_dev): Remove function.
(_partition_is_mounted): Rewrite to use _partition_is_mounted_by_path
instead of _by_dev.
2011-05-10 Jim Meyering <>
build: update gnulib submodule to latest
tests: avoid subtle shell semantics bug
This bug was causing some root-only tests to be mistakenly skipped.
This bash command will always exit successfully,
i.e., the "return 1" will never happen:
bash -c 'f(){ local f=$(false)||return 1; return 0; }; f'
That's because the assignment always succeeds, and that success
is what determines the return value, not the $(...) command.
This is very counter-intuitive, sigh.
The work-around is to separate the declaration and assignment, as in
local f; f=$(...) || ...
* tests/ (new_sdX_): Do that.
(gpt_corrupt_primary_table_): Likewise.
tests: minor fix; add/adjust comments
* tests/ Don't ignore failed comparison.
Add a comment.
2011-04-21 Brian C. Lane <>
s390/dasd: avoid buffer overrun upon API mismatch diagnostic
* libparted/labels/fdasd.c (fdasd_check_api_version): The static
buffer for the error string was too small. Double its length.
This resolves
2011-04-20 Brian C. Lane <>
linux: fix typo in comment: /path%d => /part%d
* libparted/arch/linux.c (_device_get_part_path): Fix typo in comment.
2011-04-18 Jim Meyering <>
linux: don't free invalid pointer upon asprintf failure
* libparted/arch/linux.c (_device_get_part_path): When asprintf
fails, it leaves its first argument in an undefined state, and
hence that pointer must not be freed. However, here, in two
places we could potentially free an invalid pointer. Use
zasprintf; then the pointer is either NULL or allocated,
and hence always freeable.
linux: clean up device naming code (no semantic change)
* libparted/arch/linux.c (zasprintf): New function.
(_device_get_part_path): Clean up:
Use size_t, not "int" for strlen-returned value.
Combine mostly duplicate snprintf uses.
Use zasprintf instead of malloc+snprintf.
don't reference before start of buffer for short device name
* libparted/arch/linux.c (_device_get_part_path): Avoid invalid
reference to memory before dev->path when its length is 4 or less.
2011-04-14 Jim Meyering <>
maint: s/can not/cannot/ in a comment and documentation
Without this, a new "make syntax-check" rule would fail.
* libparted/filesys.c: s/can not/cannot/
* doc/parted-pt_BR.texi (BIOSes and Firmware): Likewise.
tests: remove now-unused Makefile rule
* libparted/tests/ ( Remove obsolete rule.
tests: improve
* tests/ Fail hard upon timeout while
waiting for device to appear.
tests: make the tests in libparted/tests work properly once again
Since switching to, the root-only tests did not clean up.
* libparted/tests/ (prereq): Always create a symlink
to tests/
* tests/init.cfg: Source $abs_top_srcdir/tests-relative names,
not $srcdir-relative names. This way, it works also when run
from libparted/tests/.
* tests/ Likewise.
tests: avoid a race condition in the scsi_debug-using tests
* tests/ (new_sdX_): New function.
(scsi_debug_setup_): Use new_sdX_ to find the just-created device name,
rather relying on the list of file names in /sys/block/sd* changing.
Sometimes the list would not change, which would lead to tests failing
with I/O errors when run in parallel. Thanks to Brian Lane for the
tip that /sys/block/sd*/device/model contains "scsi_debug" if there
is a device created by our "modprobe scsi_debug" command.
2011-03-24 Jim Meyering <>
make parted "do what I say" with IEC start and end values like 5GiB
In a command like this,
parted -s -- $dev mklabel gpt mkpart P-NAME 4MB -34s
parted interprets the "4MB" as merely a suggestion for the starting
sector number. It uses half of the MB-units value as a "radius"
about the sector containing byte 4,000,000, and it may choose some
other more appropriate sector, based on partition table or alignment
constraints within the range 3,500,000B..4,500,000B.
Before, parted handled IEC units, i.e., KiB, MiB, GiB, etc.,
with identically "helpful" sloppiness, of course honoring the
power-of-two semantics.
Now, however if you use IEC units, i.e., KiB, MiB, GiB, etc.,
the "radius" is taken to be zero, so parted uses precisely
whatever multiple of a power of two you've specified.
Hence, adjusting the example above to use MiB, rather than "MB",
parted -s -- $dev mklabel gpt mkpart P-NAME 4MiB -34s
With this change, that is equivalent to the following:
parted -s -- $dev mklabel gpt mkpart P-NAME 4194304B -34s
I.e., it uses the sector containing precisely that byte, and
does not perform any "extra" adjustment.
* libparted/unit.c (is_power_of_2): New function.
(ped_unit_parse_custom): Use it to avoid interpreting a large
input string as "sloppy" (i.e. large radius) when it uses IEC
binary notation like 34KiB, 3GiB and 65TiB.
* tests/ New test.
* tests/ (TESTS): Add it.
* doc/parted.texi (unit): Describe the new behavior.
* NEWS (Changes in behavior): Mention it here, too.
2011-03-20 Jim Meyering <>
maint: stop using .x-sc_* files to list syntax-check exemptions
Instead, use the new mechanism with which you merely use a
variable (derived from the rule name) defined in to an ERE
matching the exempted file names.
* gnulib: Update to latest, to get that implements this.
* .x-sc_GPL_version: Remove file.
* .x-sc_prohibit_always-defined_macros: Likewise.
* (EXTRA_DIST): Remove them from here, too.
* Define variables to exempt the same files.
2011-03-16 Jim Meyering <>
maint: rename a variable
* libparted/labels/gpt.c (_header_is_valid): Rename a variable,
and switch to more readable range-checking logic.
gpt: avoid division by zero
* libparted/labels/gpt.c (_header_is_valid): Reject as invalid if
FirstUsableLBA < 3.
(gpt_get_max_supported_partition_count): Ensure that we don't divide
by zero: verify that the GPT header is valid before dividing by its
"size of partition entry". Under normal circumstances, the on-disk
PE size field is reasonable because we have just written it. However,
there are two ways it can end up zero: we lose the race when some other
process pokes a 4-byte 0 into just the right location between when
we write it and when we re-read the value we're about to divide by.
Then there's the case that I encountered: using an old USB (8MB) key,
mklabel gpt failed due to division by zero. The device reported no
failure when writing the initial header, yet when reading back that
very same sector (also successful), parted got all 0 bytes.
* NEWS (Bug fixes): Mention it.
build: enable compilation warnings also for new nilfs2 subdir
* libparted/fs/nilfs2/ (AM_CFLAGS): Define.
nilfs2: remove unused nilfs2_clobber function
* libparted/fs/nilfs2/nilfs2.c (nilfs2_clobber): Remove unused
(nilfs2_ops) [clobber]: Always set to NULL.
maint: avoid shadowing warning
* parted/parted.c (do_mkpart): Rename inner added_ok to add_ok.
build: don't let parted_CFLAGS override our AM_CFLAGS setting
* parted/ (parted_CFLAGS): Remove unused (and interfering)
maint: avoid new compiler warnings
* parted/parted.c (do_print): Remove now-unused "error" label.
(_print_disk_info): Use one more "const" attribute, to avoid
compiler warnings.
2011-03-16 Petr Uzel <>
tests: do not fail if some utilities are missing
* tests/ Skip the test if mkfs.ext3 or tune2fs
is missing or is not in $PATH.
tests: test 'parted print' with empty disk
* tests/ New test.
* tests/ Add it.
2011-03-16 Petr Uzel <>
parted: rework 'parted print' so that it works with empty disk
'parted $dev print' on a device without a partition table used to fail
with an 'unrecognised disk label' error, without printing the following:
disk model, transport, size, sector size, BIOS geometry
all of which are available, and do not dependent on the partition table.
With this patch, parted prints all of this information (BIOS geometry
only if 'unit cyl' is specified) and reports success even if the disk
does not have a valid partition table.
As a side efect, 'parted $dev print devices/all/list' now prints
information about all the devices, even if $dev does not have a
partition table.
* parted/parted.c (_print_disk_info): New function.
(do_print): Do not immediately fail if the partition table is not
recognized, but print disk information and report success instead.
* NEWS (Changes in behavior): Mention it.
2011-03-16 Petr Uzel <>
parted: factor out disk geometry printing into separate function
* parted/parted.c (_print_disk_geometry): New function.
(do_print): Use _print_disk_geometry.
2011-03-05 Brian C. Lane <>
Remove PED_ASSERT action argument
The action argument was a leftover from when the PED_ASSERT macro was
last changed. This removes that argument from the macro and from all
occurrences of it.
2011-03-05 Brian C. Lane <>
Remove PED_ASSERT from dos geometry checking
The CHS geometry values are calculated based on the existing partition
information. The values can't always be calculated, and the partition
may be corrupt so instead of throwing an assertion just return 0 and
carry on.
I left the logic for the PED_ASSERT checks the same so that it is clear
that the logic has not changed, it just returns 0 now.
* libparted/labels/dos.c (probe_partition_for_geom): remove PED_ASSERT
2011-03-05 Jim Meyering <>
tests: add a minimal nilfs2 test
* tests/ Adapt to also test nilfs2.
2011-03-04 Jim Meyering <>
tests: rename a test script, before extending it to handle nilfs
* tests/ Rename from ...
* tests/ ...this.
* tests/ (TESTS): Rename it here, too.
2011-02-26 Jiro SEKIBA <>
libparted: add nilfs2 module
* libparted/fs/nilfs2/ New file.
* libparted/fs/nilfs2/nilfs2.c: New file.
(is_valid_nilfs_sb, nilfs2_probe, nilfs2_clobber): New functions.
(ped_file_system_nilfs2_init, ped_file_system_nilfs2_done): Likewise.
(nilfs2_ops, nilfs2_type): Define.
* libparted/fs/ (SUBDIRS): Add nilfs2.
* (AC_OUTPUT): Add the new Makefile.
* libparted/libparted.c: Declare and use the _init and _done functions.
Add a new fs module to provide following:
- probe nilfs2 filesystem partition
- clobber nilfs2 filesystem partition
The is_valid_nilfs_sb function came from the grub nilfs2 module,
which is written by me and assigned to FSF.
2011-02-26 Jim Meyering <>
maint: two files lacked a newline at EOF: add one to each
* include/ Add newline at end of file.
* libparted/fs/jfs/ Likewise.
tests: t3310-flags: check all gpt boolean flags, too
* tests/ Check gpt as well as msdos flags.
Parametrize mkpart usage.
Accommodate gpt-induced difference in parted's print output
GPT partitions have a name, while msdos ones do not.
This also fixes the "on_and_off" perl flag extraction regexp,
which before was using $1 with no corresponding () group.
tests: prepare t3310-flags to check gpt boolean flags, too
* tests/ Put a loop around the body of the test,
and factor out the partition table name.
tests: remove useless commands
* tests/ Remove useless exp-manipulating commands.
2011-02-26 Brian C. Lane <>
gpt: add legacy_boot partition flag
Add support for the Legacy BIOS Bootable flag in the GPT
Attribute field. This is used by software like syslinux to
determine which partition to boot when in BIOS mode.
See Page 105, Table 19 Bit 2 of the UEFI Spec 2.3 book.
* doc/C/parted.8: Document legacy_boot.
* doc/parted.texi: Document legacy_boot.
* include/parted/disk.h: Add PED_PARTITION_LEGACY_BOOT flag.
* libparted/disk.c (ped_partition_flag_get_name): Add legacy_boot flag.
* libparted/labels/gpt.c (_parse_part_entry):
(_partition_generate_part_entry, gpt_partition_new):
(gpt_partition_set_flag, gpt_partition_get_flag):
(gpt_partition_is_flag_available): Add legacy_boot flag support.
2011-02-26 Brian C. Lane <>
gpt: add partition attribute bits: NoBlockIOProtocol, LegacyBIOSBootable
Add NoBlockIOProtocol and LegacyBIOSBootable flags to the GPT partition
Attributes entry.
2011-02-26 Jim Meyering <>
doc: regenerate partprobe .pot and .po files
* doc/C/po/partprobe.8.pot: Slight syntax update induced by newer tool.
* doc/pt_BR/partprobe.8.pt_BR.po: Likewise.
tests: move test_description= variable to a comment tests required a test_description= definition.
When testing switched to, which by convention uses a brief
comment on line 2 instead, some instances were not converted.
* libparted/tests/ Put test description on line 2.
Remove now-unused test_description= definition.
* libparted/tests/ Likewise.
* tests/ Likewise.
2011-02-23 Jim Meyering <>
s390: avoid warnings
* libparted/labels/vtoc.c (vtoc_read_volume_label): Remove decl
of unused var.
* libparted/labels/fdasd.c (fdasd_valid_vtoc_pointer): Return
a value also when successful.
* libparted/labels/dasd.c (dasd_alloc_metadata): Initialize "part"
to NULL solely to avoid a spurious used-uninitialized warning.
2011-02-23 Stephen Powell <>
doc: add NEWS entries for s390 fix and improvements
2011-02-23 Stephen Powell <>
s390: make DIAG driver work for FBA DASD with block size > 512
In order to make the DIAG driver work for FBA DASD with a block
size greater than 512, I had to make a rather awkward patch to
C function vtoc_read_volume_label in libparted/labels/vtoc.c.
The "right" logic would be "If this is an FBA DASD device
using the DIAG driver, and the effective block size used by the
DIAG driver is greater than 512, then do it this way. Else,
do it the normal way." (Note that when using the FBA driver,
the effective block size is always 512, regardless of the CMS
logical block size stored in the volume label. The DIAG driver,
on the other hand, honors the CMS logical block size.)
The problem is that the information needed to make that decision
has not been provided to the routine (via the parameter list).
So what I ended up doing is assuming the normal way, then if
I don't find a recognized volume label header (VOL1, LNX1,
or CMS1, in EBCDIC), then I assumed that it must be the special
case. So in the special case I end up doing an unnecessary
read. It's a kludge, but it works.
2011-02-23 Jim Meyering <>
tests: new script to generate 9-pte-GPT-tables
cleanup: use verify, not PED_ASSERT to check struct sizes
* libparted/labels/gpt.c: Use compile-time "verify" rather than
run-time PED_ASSERT to ensure struct sizes are as expected.
2011-02-23 Stephen Powell <>
s390: improve/correct DASD support
The long title would be "corrections to partition size and location
calculations for type 1 partitions for s390 dasd".
This could be treated as two separate fixes, one to make corrections
for LDL formatted disks and one to add support for CMS formatted
disks. I see CMS formatted disks as a variant of LDL formatted
disks, with the additional twist that CMS formatted disks can
be reserved or recomped, which LDL formatted disks cannot be.
This affects the size and location of the partition.
With these patches, parted matches the behavior of the Linux kernel
in recognizing partitions on CMS- and LDL-formatted disks, as documented
in the Linux kernel source code in routine fs/partitions/ibm.c.
Calculation of the metadata has also been changed so that parted will
show no free space on such a disk. In some cases there are now two
non-contiguous metadata extents: one at the beginning of the disk and
one at the end.
As before, parted only supports CKD DASD using the ECKD driver.
FBA DASD and CKD DASD using the DIAG driver are still not supported.
In my regression testing I have discovered some problems in the area
of recognizing file system options. However, since I can duplicate
these errors on a version of parted which does not contain my changes,
I have concluded that my changes did not cause this and therefore
this is an unrelated bug.
2011-02-22 Jim Meyering <>
maint: update from gnulib
* bootstrap: Update from gnulib.
* tests/ Likewise.
* gnulib: Update submodule to latest.
maint: update copyright year ranges to include 2011
Run "make update-copyright".
maint: update copyright date in parted.texi
* doc/parted.texi: Update copyright date.
2010-12-30 Jim Meyering <>
maint: don't hard-code bug-reporting address
* libparted/exception.c (default_handler): Use PACKAGE_BUGREPORT
rather than hard-coding bug-parted@...
* libparted/labels/gpt.c (_parse_header) [DISCOVER_ONLY]: Don't
mention the bug-reporting address explicitly, since ped_exception_throw
is about to do just that.
2010-12-16 Jim Meyering <>
maint: correct typos in HACKING
* HACKING: Don't reference grep everywhere. I copied grep's
HACKING and forgot to s/grep/parted/ (slightly different for
the repository, since it's at, not Savannah).
2010-11-25 Jim Meyering <>
2010-12-15 Brian C. Lane <>
default to 1MiB alignment when possible
Change the linux_get_optimum_alignment() function to prefer
aligning partitions to PED_DEFAULT_ALIGNMENT (1MiB), if possible.
This helps tools like anaconda better support 4k sector drives.
* include/parted/parted.h (PED_DEFAULT_ALIGNMENT): Define.
* libparted/arch/linux.c (linux_get_optimum_alignment): Adjust.
See comments for details.
* libparted/device.c (ped_device_get_optimum_alignment): Use
PED_DEFAULT_ALIGNMENT rather than hard-coded 1048576.
* tests/ Adjust expectations to match new behavior.
See for details.
2010-11-22 Jim Meyering <>
tests: don't rely on "lockfile" program
* tests/ (scsi_debug_acquire_lock_): Use mkdir, rather
that lockfile. The latter is not always available.
(scsi_debug_lock_dir_): Rename, now that it's a dir.
(scsi_debug_cleanup_): Remove it with rm -rf.
Fix typo in diag: s/rrmod/rmmod/
tests: remove vestiges of
* tests/ (require_mdadm_): Remove vestiges of (aka uses of the "say" and "test_done" functions).
(require_xfs_): Likewise.
tests: avoid spurious failure
* tests/ Sanitize directory name, to avoid spurious
failure due to e.g., mount-related differences.
2010-11-22 Brian C. Lane <>
linux: remove DASD restriction on _disk_sync_part_table
* libparted/arch/linux.c: Include <assert.h>.
(linux_disk_commit): Assert that _have_blkpg returns true
and don't skip _disk_sync_part_table for DASD devices.
Otherwise, when creating a partition on a DASD device,
new /dev/*[12...] device files would not be created.
Also, remove obsolete comment about DevFS.
For details, see
2010-11-21 Jim Meyering <>
build: update gnulib submodule to latest
avoid new syntax-check failures
* .x-sc_cross_check_PATH_usage_in_tests: New file.
* .x-sc_bindtextdomain: New file.
2010-11-20 Jim Meyering <>
tests: adjust cleanup_ handler to work with
* tests/init.cfg (cleanup_, cleanup_fn_, cleanup_final_): Define.
* tests/ (cleanup_final_): Use this to ensure that we
always release the lock and run rmmod. Overriding the trap did not
do the job.
* libparted/tests/ Use cleanup_fn_, not cleanup_.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
tests: don't expect fs-op warning
* tests/ Don't expect fs-op warning.
The testing framework now suppresses it.
tests: (lvm_init_root_dir_): Fix it to use $test_dir_
tests: remove
* tests/ Remove file. No longer used.
* tests/ (EXTRA_DIST): Remove
* tests/ Don't mention this file name.
* tests/ Likewise.
2010-11-20 Jim Meyering <>
tests: switch from to
* tests/init.cfg: Source
* tests/ Replace trap so that we always run
scsi_debug_cleanup_, regardless of the cleanup_ function.
Replace each snippet like this:
-if test "$VERBOSE" = yes; then
- set -x
- parted --version
-: ${srcdir=.}
-. $srcdir/
+. "${srcdir=.}/"; path_prepend_ ../parted
Use this command (LHS elided, because it was too long):
git grep -l 'srcdir/'|xargs perl -p0i -e \
's!...!. "\${srcdir=.}/"; path_prepend_ ../parted\n!'
* tests/ Adjust manually, since the snippet
didn't quite match.
2010-11-20 Jim Meyering <>
tests: remove
* tests/ Remove file. No longer used.
* tests/ (EXTRA_DIST): Remove
( Remove rule and associated uses.
* tests/ (init_root_dir_): Switch to test_dir_,
since that is now the only variable that remains.
tests: remove fail=0 initializations
Now, this is done in
tests: libparted/tests: use, not
tests: make usable also from tests
* tests/ Use fail_, not error for diagnostics.
The former also works in scripts.
(init_root_dir_): Use test_dir_ if $test_dir_rand_ is not set.
tests: new function required for
* tests/ (device_mapper_required_): New function.
tests: convert
tests: don't discard require_dvhtool_ stderr/stdout
tests: dvhtool: use skip_, not skip
tests: convert
tests: (require_dvhtool_): New function.
tests: convert
tests: move more functions to
tests: convert t7000 to
tests: t-lib-helpers: copy emit_superuser_warning from
tests: t0000: convert to use
tests: convert
* tests/ Convert from to
tests: convert
* tests/ Likewise.
tests: convert to use
* tests/ Convert.
tests: convert
* tests/ Use
tests: convert t0220 to use
* tests/ Convert to use
tests: extract functions for use via
Currently there are three test frameworks in use:
- old, don't use this framework any more;
I found it too hard to use and debug.
- newer, I had converted most tests to use this
- newest: successor of, the master copy
of which now resides in gnulib. All new tests should use
this framework.
* tests/ New file, extracted from,
so that init.cfg can source these functions, too.
* tests/ Source it.
* tests/init.cfg: Source it from here, too.
* tests/ (EXTRA_DIST): Add
tests: remove unused function: skip_if_
tests: global subst: s/skip_test_/skip_/
git grep -l skip_test_|xargs perl -pi -e 's/skip_test_/skip_/'
maint: remove unused test function
* tests/ (require_built_): Remove unused function.
It also happened to use skip_, which we're about to make a function.
tests: avoid race condition in t3000-resize
Without the 1-second sleep, this root-only test would
fail about 50% of the time for me.
* tests/ (device_sectors_required): Sleep
one more second after ${dev}1 appears, so that subsequent
commands are more predictable.
Split a long line.
tests: convert to
* tests/t2100-mkswap: Likewise.
tests: convert t1100 to use
* tests/ Convert to use
* tests/init.cfg (require_erasable_): New function, mostly
copied from
tests: init.cfg: copy envvar setings from
Unset TERM and CDPATH; sanitize LC_ALL, TZ, LANG, and set
* tests/ Expect no output, now that we set
maint: update and bootstrap from gnulib
* tests/ Update from gnulib.
* bootstrap: Likewise.
doc: also mention KiB, MiB, GiB and TiB suffixes
* doc/parted.texi (unit): Also mention KiB, MiB, GiB and TiB.
2010-11-18 Colin Watson <>
libparted: ignore zero-length devices
* bootstrap.conf (gnulib_modules): Add xstrtoll.
* 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
* libparted/tests/ (TESTS): Add
(check_PROGRAMS): Add zerolen.
(zerolen_SOURCES): Add.
* libparted/tests/ New file.
* libparted/tests/zerolen.c: New file.
* tests/ (wait_for_dev_to_appear_): New function, copied from
* NEWS (Bug fixes): Mention it.
2010-11-09 Jim Meyering <>
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
* NEWS (Bug fixes): Mention it.
2010-10-10 Jim Meyering <>
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.
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.
build: update gnulib submodule to latest, and update bootstrap
* bootstrap: update from gnulib
2010-08-23 Petr Uzel <>
build: suggest libuuid from util-linux-ng package
* 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.
2010-08-20 Colin Watson <>
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/ Update for the new loop limit.
* NEWS (Bug fixes): Mention it.
2010-08-19 Jim Meyering <>
avoid non-srcdir "make check" failure
* tests/ (EXTRA_DIST): Add init.cfg.
The failure was introduced by commit 6f7c0f12.
build and tests: update bootstrap and from gnulib
* tests/ Update from gnulib.
* bootstrap: Likewise.
2010-08-18 Jim Meyering <>
build: update gnulib submodule to latest
2010-07-20 Hans de Goede <>
linux: recognize scsi disks with a high major number (128-135)
* libparted/arch/linux.c (SCSI_BLK_MAJOR): Recognize high major number.
2010-07-17 Jim Meyering <>
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
* NEWS (Bug fixes): Mention it.
* tests/ New file. Test for the bug.
* tests/ (TESTS): Add it.
2010-07-17 Jim Meyering <>
tests: use init.cfg; required for tests
* tests/init.cfg: New file.
(require_512_byte_sector_size_): Slightly different function
than the one in
* tests/init.cfg: New file.
2010-07-17 Jim Meyering <>
build: update gnulib submodule to latest
maint: remove trailing blank
* tests/ Remove trailing blank.
2010-06-30 Otavio Salvador <>
tests: update resize-fs to use wait_for_dev_to_appear_
* rely on wait_for_dev_to_appear_ to wait for the
device to be crated.
tests: rely on require_scsi_debug_module_ to modprobe scsi_debug module
* remove explicit modprobe
since it is done by require_scsi_debug_module_.
* likewise.
* likewise.
* likewise.
* likewise.
2010-06-30 Otavio Salvador <>
tests: add one: try to remove a busy partition
This test tries to reproduce the issue reported in Debian bug #582818[1].
Basically it does:
* create two primary partitions
* mount the second one
* remove the first (must work)
* try to remove the second (must fail)
* tests/ new file.
* tests/ (TESTS): add the new test in check target.
2010-06-27 Otavio Salvador <>
tests: skip loop-clobber-infloop if mkswap cannot be found
* tests/ Skip the test is case of mkswap
cannot be found.
2010-06-26 Jim Meyering <>
build: update gnulib submodule to latest
* bootstrap: Update from gnulib.
* tests/ Likewise.
2010-06-26 Colin Watson <>
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
* libparted/labels/sun.c: Revert.
2010-06-26 Jim Meyering <>
tests: adjust sun-partition-creating test to conform
* tests/ Adjust partition size so the
end falls on a cylinder boundary.
2010-05-28 Jim Meyering <>
maint: update README-release
* README-release: Update to match the template used for diffutils,
coreutils, etc.
maint: add gettext to list of bootstrapped-with tools in announcement
* (bootstrap-tools): Add gettext to the list.
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* (old_NEWS_hash): Auto-update.
version 2.3
* NEWS: Record release date.
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.
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/, 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 and 0.18 in m4/gettext.m4.
* (AM_GNU_GETTEXT_VERSION): Require gettext 0.18.
build: update gnulib submodule to latest
maint: use the do-release-commit-and-tag module from gnulib
* bootstrap.conf (gnulib_modules): Add do-release-commit-and-tag.
2010-05-28 Petr Uzel <>
doc: fix a typo
* doc/parted.texi: s/onstraints/constraints/
parted: do_align_check returns always 1 in interactive mode
* parted/parted.c (do_align_check): Always return 1 in interactive mode.
2010-05-28 Jim Meyering <>
build: really use gettext-0.17
* 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.
2010-05-26 Petr Uzel <>
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
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()
parted: plug memory leak
* parted/parted.c (_done_messages): Free unit_msg.
2010-05-26 Jim Meyering <>
tests: avoid spurious failure of the root-only many-partitions test
* tests/ When creating a scsi_debug
device, honor the block size suggested by the PARTED_SECTOR_SIZE
environment variable, and thus required in expected output.
build: update gnulib submodule to latest
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.
* (EXTRA_DIST): Add it here.
maint: update helper scripts
* tests/help-version: Update from coreutils.
* bootstrap: Update from gnulib.
* tests/ Likewise.
build: use gettext-0.17
* Use gettext-0.17.
* bootstrap.conf (gnulib_modules): Use gettext-h, not gettext.
since the latter drags in a depedency on gettext 0.18.
2010-05-25 Jim Meyering <>
fix typo in comment
2010-05-10 Jim Meyering <>
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.
2010-05-06 Jim Meyering <>
tests: make the new many-partitions test fail if it takes "too long"
* tests/ Fail if creating 60 partitions
takes more than a minute.
maint: use latest bootstrap script from gnulib
* bootstrap: Sync from gnulib.
2010-05-06 Hans de Goede <>
gpt: recognize microsoft recovery GUID
Microsoft advices creating recovery partitions with a GUID of
de94bba4-06d1-4d40-a16a-bfd50179d6ac, see:
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.
2010-05-06 Hans de Goede <>
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:
* libparted/labels/dos.c (PARTITION_MSFT_RECOVERY): Define.
(raw_part_parse): Recognize id 27
(msdos_partition_set_system): Recognize id 27
2010-05-06 Jim Meyering <>
tests: add one: create 60 partitions on a scsi device
* tests/ New test.
* tests/ (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
2010-05-05 Jim Meyering <>
doc: update NEWS
* NEWS (Bug fixes): Mention the ext2 2TiB FS-creation bug.
build: update gnulib submodule to latest
2010-05-05 Martin Poole <>
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 a reproducer.
2010-04-30 Hans de Goede <>
_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 <>.
2010-04-30 Jim Meyering <>
tests: avoid root-only/XFS limit test failure on 32-bit system
* tests/ 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/ Likewise.
2010-04-30 Jim Meyering <>
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 \ >& 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.
2010-04-30 Jim Meyering <>
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.
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
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.
2010-04-29 Jim Meyering <>
tests: correct a root-only test
* tests/ Don't hard-code
"/dev/sdd5" in expected output.
maint: avoid code duplication
* libparted/labels/dos.c (clear_flags): New function.
Factored (5 times) out of ...
(msdos_partition_set_flag): Use the new function.
2010-04-29 Hans de Goede <>
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
* 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.
2010-04-28 Jim Meyering <>
tests: distribute new file,
* tests/ (EXTRA_DIST): Add
tests: add help-version test (from coreutils)
* tests/help-version: New file
* tests/ (TESTS_ENVIRONMENT): Pass built_programs and VERSION
to test scripts -- both are required by help-version.
(TESTS): Add help-version.
ui: make --help tell where to report bugs
* parted/ui.c (help_msg): Tell where to report bugs.
tests: use gnulib's
* tests/ New file, from gnulib.
tests: rename generated to
* tests/ ( Rename from
* libparted/tests/ Likewise.
* tests/ Rename sole use.
* .gitignore: Rename here, too.
build: update gnulib submodule to latest
tests: improved portability
* tests/ Don't use test's -a option.
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/'
maint: pass newer "make syntax-check" tests from gnulib
* (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.
tests: test all boolean flags
* tests/ New test, suggested by Hans De Goede.
* tests/ (TESTS): Add it.
2010-04-27 Jim Meyering <>
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.
2010-04-27 Jim Meyering <>
ui: get version number from a separately-compiled file
* parted/ (version.c, version.h): Generate.
(parted_LDADD): Add libver.a.
(noinst_LIBRARIES, nodist_libver_a_SOURCES): Define.
(BUILT_SOURCES): Initialize and append.
* parted/parted.c: Include "version.h".
(_version): Use the new global variable, Version, not VERSION.
2010-04-23 Jim Meyering <>
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.
tests: remove partition explicitly before mklabel, to avoid new failure
* tests/ 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.
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.
libparted: _disk_sync_part_table: always return 0 upon failure
* libparted/arch/linux.c (_disk_sync_part_table):
Return 0 (not 1) upon failure.
2010-04-23 Colin Watson <>
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.
2010-04-23 Jim Meyering <>
tests: test for new 2-sector minimum ext-logical-separation
* tests/ New file.
* tests/ (TESTS): Add it.
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".
libparted: allocate storage for diagnostic only when needed
* libparted/arch/linux.c (_disk_sync_part_table): Rename local:
Allocate space for it only if needed.
Use malloc rather than ped_malloc.
Move decl of FD down to first use.
libparted: adjust code formatting
libparted: reword a diagnostic
2010-04-23 Phillip Susi <>
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.
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.
2010-04-23 Hans de Goede <>
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.
2010-04-21 Jim Meyering <>
tests: test for palo and prep interaction
* tests/ New file.
* tests/ (TESTS): Add it.
2010-04-21 Hans de Goede <>
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.
2010-04-21 Jim Meyering <>
tests: remove unnecessary (duplicate) local var assignment
* tests/ Remove duplicate ss=$sector_size_.
2010-04-21 Colin Watson <>
maint: make PED_ASSERT and PED_DEBUG if-safe
Constructions such as:
if (foo)
PED_DEBUG (0, "foo");
PED_DEBUG (0, "not foo");
did not compile reliably, depending on the configuration. Make this
* 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.
2010-04-17 Jim Meyering <>
doc: add HACKING
* HACKING: New file. Copied from coreutils, with s/coreutils/parted/
and a few minor edits.
2010-04-16 Petr Uzel <>
.gitignore: ignore index files generated by ctags and cscope
2010-04-16 Petr Uzel <>
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
* NEWS (New features): Mention it.
2010-04-13 Jim Meyering <>
tests: propagate recent improvements to copied-from code
* tests/ Fix typo s/2>1/2>&1/ and use
a tighter regexp also in the preceding loop.
Noted by Colin Watson.
2010-04-13 Colin Watson <>
maint: constify ped_device_get_constraint interface
* include/parted/device.h (ped_device_get_constraint): Constify "dev"
* libparted/device.c (ped_device_get_constraint): Likewise.
2010-04-13 Colin Watson <>
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
* libparted/fs/ext2/ext2_fs.h: Define EXT4_FEATURE_RO_COMPAT_GDT_CSUM
* libparted/fs/ext2/interface.c (_ext2_generic_probe): Test for
probing for ext4.
* tests/ Test for this.
* NEWS (Bug fixes): Mention this.
2010-04-09 Colin Watson <>
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
2010-04-06 Hans de Goede <>
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/ New file.
* libparted/tests/ Include the new files. Run the new test.
2010-04-06 Hans de Goede <>
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 <>.
2010-03-30 Colin Watson <>
doc: add @dircategory to Info documentation
The Texinfo documentation says that Info files should use @dircategory,
and suggests consulting the Free Software Directory to select a category
name. The directory places Parted under "System administration".
* doc/parted.texi: Add `@dircategory System administration'.
2010-03-30 Jim Meyering <>
build: update gnulib submodule to latest
tests: disable new texinfo-acronym syntax-check from gnulib
* (local-checks-to-skip): Add new sc_texinfo_acronym, to skip it.
maint: avoid using test's -o and -a operators: they are not portable
* tests/ Don't use test ... -o.
* Don't use test ... -a.
maint: remove unneeded #include
* libparted/disk.c: Don't include "intprops.h". It was unused.
build: prepare for gnulib's updated lib-ignore
* parted/ (parted_LDFLAGS): Now that we're using
gnulib's newer lib-ignore, add $(IGNORE_UNUSED_LIBRARIES_CFLAGS).
2010-03-30 Colin Watson <>
tests: distribute a few more tests and documentation files
* debug/test/ (noinst_SCRIPTS): Add test_fs_hfs and
* libparted/fs/hfs/ (EXTRA_DIST): Add DOC and HISTORY.
* tests/ (TESTS): Add
2010-03-16 Jim Meyering <>
build: avoid warning from bootstrap about obsolete strdup module
* bootstrap.conf (gnulib_modules): Use the strdup-posix module,
rather than the "strdup" one.
2010-03-11 Jim Meyering <>
tests: reenable a "bsd" partition table test
* libparted/tests/common.c (_implemented_disk_label): Remove "bsd" from
the list of not-implemented-yet partition table types, since it appears
to pass the tests.
libparted: remove "HIGHLY EXPERIMENTAL" warning for >512B-sector devices
* libparted/arch/linux.c (_device_set_sector_size): Remove the
"HIGHLY EXPERIMENTAL" warning, now that support for >512-byte sectors
seems to be usable. Suggested by Colin Watson.
* NEWS (Changes in behavior): Note this
2010-03-02 David Cantrell <>
libparted: msdos_partition_is_flag_available: fix hidden on extended
Since the hidden flag cannot be set on extended partitions,
msdos_partition_is_flag_available() should return 0 for hidden on
extended partitions. Also change msdos_partition_get_flag()
to always return 0 for hidden on extended partitions.
* libparted/labels/dos.c (msdos_partition_is_flag_available):
Return 0 for hidden on extended partitions.
* libparted/labels/dos.c (msdos_partition_get_flag):
Always return 0 for hidden on extended partitions.
* NEWS (Bug fixes): Mention it.
Reported by Flóki Pálsson in
Patch forwarded by Hans De Goede.
2010-03-02 Petr Uzel <>
tests: skip tests that require mkfs.hfs, when it is unavailable would fails if mkfs.hfs is not installed.
* tests/ (require_hfs_): New function.
* tests/ Use require_hfs_.
2010-03-01 Jim Meyering <>
tests: convert more tests to the newer infrastructure
* tests/ Convert from to
* tests/ Likewise.
* tests/ Likewise.
2010-02-26 Colin Watson <>
libparted: don't export linux_get_*_alignment functions
These functions are only used in libparted/arch/linux.c or via
linux_dev_ops, so do not export them.
* libparted/arch/linux.c (linux_get_minimum_alignment): Declare static.
(linux_get_optimum_alignment): Likewise.
2010-02-26 Petr Uzel <>
Add support for ATA over Ethernet (AoE) devices
Recognize AoE Devices, so "parted -s /dev/etherd/eX.Y" now
prints "Model: ATA over Ethernet Device (aoe)" instead of
"Model: Unknown (unknown)".
* include/parted/device.h(PedDeviceType): Add PED_DEVICE_AOE.
* libparted/arch/linux.c(AOE_MAJOR): New define.
* libparted/arch/linux.c(_device_probe_type): Recognize AoE devices.
* libparted/arch/linux.c(linux_new): Handle AoE devices.
* parted/parted.c(do_print): Add "aoe" to the list of available
* NEWS (New features): Mention it.
2010-02-26 Jim Meyering <>
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* (old_NEWS_hash): Auto-update.
version 2.2
* NEWS: Record release date.
2010-02-26 Curtis Gedak <>
dos: set HFS/HFS+ partition identifier to proper value
The correct value for an "hfs" partition identifier is 0xAF.
Previously the partition identifier was incorrectly set to 0x83.
* libparted/labels/dos.c (PARTITION_HFS): Define.
(msdos_partition_set_system): Use it.
2010-02-26 Jim Meyering <>
tests: exercise today's HFS partition type fix
* tests/ New script.
* tests/ Add it.
* NEWS (Bug fixes): Mention it.
tests: gpt-pmbr: don't ignore stdout comparison result
* tests/ Fail if we get unexpected output.
2010-02-25 Jim Meyering <>
build: update gnulib submodule to latest
* bootstrap: Copy from gnulib.
tests: convert t4001 to use the new framework
* tests/ Convert.
* tests/ (TESTS): Add it to the list.
2010-02-25 Karel Zak <>
sun: initialize basic partition table fields
libparted completely ignores basic fields (version, nparts and sanity)
in the sun VTOC, then for example fdisk prints warnings for such
partition table:
# fdisk -lu /dev/sdb
Detected sun disklabel with wrong version [0x00000000].
Detected sun disklabel with wrong sanity [0x00000000].
Detected sun disklabel with wrong num_partitions [0].
It seems that the current libparted sun support follows old Linux
kernel code, but the code was changed 3 years ago (see kernel commit
Note that the number of partitions (nparts) is optional for Linux
kernel, but fdisk(8) strictly requires SUN_DISK_MAXPARTITIONS (=8)
there. This patch sets nparts to SUN_DISK_MAXPARTITIONS rather then
use a real number of partitions.
* NEWS (Bug fixes): Mention it.
* libparted/labels/sun.c: Update from kernel.
* tests/ New file. Test for this.
2010-02-25 Jim Meyering <>
tests: wrap the dup-clobber test in a script, ...
so that its artifacts are created in the usual temporary subdir
* tests/ (TESTS): Remove dup-clobber, and instead...
* tests/ New script.
2010-02-23 Jim Meyering <>
build: update gnulib submodule to latest
tests: test for the ped_disk_duplicate needs_clobber fix
* tests/dup-clobber.c: New file.
Exercise the fix in commit jabb411b, "libparted: copy the
needs_clobber value in ped_disk_duplicate()".
* tests/ (TESTS, check_PROGRAMS): Add dup-clobber.
2010-02-22 Hans de Goede <>
libparted: copy the needs_clobber value in ped_disk_duplicate()
Most duplicate disk_ops use ped_disk_new_fresh, which sets needs_clobber
to 1. This would lead to clobbering the disk when committing a duplicate
disk even when the original disk was not made with ped_disk_new_fresh.
* libparted/disk.c (ped_disk_duplicate): Copy the needs_clobber member.
* NEWS (Bug fixes): Describe it.
2010-02-22 Curtis Gedak <>
linux: add wait time and retries to kernel partition reread
Occasionally when using parted with newer GNU/Linux kernels (2.6.31)
and udev (145), the kernel would fail to reread the partition table.
This could lead to problems with subsequent actions such as formatting
the partition.
Basically this patch increases the retry_count, and adds one sleep(1)
function call prior to the the last few ioctl() calls.
This patch might not be a perfect solution to this problem of "failure
to inform kernel of partition changes", but it does significantly
reduce the likelihood of encountering the problem.
Details on the testing results and procedures used can be found at
the following link:
* libparted/arch/linux.c (_kernel_reread_part_table): Sleep for a
full second if retry_count makes it down to "3". Start it at 9
rather than at 5.
* NEWS (Bug fixes):
2010-02-20 Jim Meyering <>
maint: remove now-unused <partition_table_type>_clobber functions
All of these functions were rendered unused by commit 376b143045,
"ped_disk_clobber: change semantics" on 2009-11-13.
Also, Update each <...>_disk_ops "clobber:" member to be NULL.
* libparted/labels/aix.c (aix_clobber): Remove function.
* libparted/labels/bsd.c (bsd_clobber): Likewise.
* libparted/labels/dasd.c (dasd_clobber): Likewise.
* libparted/labels/dos.c (msdos_clobber): Likewise.
* libparted/labels/dvh.c (dvh_clobber): Likewise.
* libparted/labels/gpt.c (gpt_clobber): Likewise.
* libparted/labels/loop.c (loop_clobber): Likewise.
* libparted/labels/mac.c (_clobber_part_map, mac_clobber): Likewise.
* libparted/labels/pc98.c (pc98_clobber): Likewise.
* libparted/labels/rdb.c (amiga_clobber): Likewise.
* libparted/labels/sun.c (sun_clobber): Likewise.
Suggested by Hans De Goede.
2010-02-13 Jim Meyering <>
doc: update release procedure to account for soname version number
* README-release: Add a step "0", and update step 3 to match reality.
libparted: set the shared library version number manually
* libparted/ (CURRENT, REVISION, AGE): Define here.
(libparted_la_LDFLAGS): Use them, rather than using the
automatically-defined LT_-prefixed variables.
Stop using the "-release" option.
Hans De Goede pointed out that the build process was automatically
changing the shared library name.
2010-02-12 Jim Meyering <>
gpt: clean-up wrt write_back (no semantic change)
* libparted/labels/gpt.c (gpt_read): Initialize write_back to 0
once again, and set it to 1 on the sole path that requires that.
2010-02-10 Jim Meyering <>
gpt: "read-only" operation could clobber the pMBR in another way
A read-only operation like "parted $dev print" would overwrite $dev's
pMBR when exactly one of the primary and backup tables was corrupt.
* libparted/labels/gpt.c (gpt_read): Clear "write_back" in those
two cases. Hans De Goede spotted this bug by inspection.
* NEWS (Bug fixes): Mention it.
* tests/ New test.
* tests/ (TESTS): Add
tests: factor utility functions into "library"
...since we're about to use them from a second test.
* tests/ (peek_, poke_, gpt1_pte_name_offset_): New functions.
(gpt_corrupt_primary_table_, gpt_restore_primary_table_): New functions.
* tests/ Remove local copies of those functions.
Use the new ones.
2010-02-10 Hans de Goede <>
dasd: don't dereference a NULL pointer in dasd_read
* libparted/labels/dasd.c (dasd_read): Avoid NULL pointer dereference.
parted: change default alignment to "optimal"
* NEWS (Changes in behavior): Mention it.
* parted/parted.c: Change --align default value to optimal.
* tests/ Adjust for alignment changes where necessary.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
2010-02-10 Hans de Goede <>
parted: change warnings when initial constrained mkpart fails
In do_mkpart we first try to create a partition using a constraint
derived from the user input intersected with the devices alignment
needs. And if that fails we try again without any constraint.
However the warning given when this happens only takes into account
the user not getting what he asked for, while the alignment might be
a problem too (or even the only problem). So this patch adds a check
to see if the user really did not get what he asked before giving that
warning, and adds a new check + warning to see if the created partition
is properly aligned.
*parted/parted.c (do_mkpart,do_mkpartfs): change warnings when initial
constrained mkpart fails.
2010-02-10 Hans de Goede <>
parted: honor --align option also in mkpartfs, resize and print cmds
* parted/parted.c (do_mkpartfs,do_print,do_resize): Honor --align.
linux: handle incomplete topology information
The topology information returned by libblkid is not always complete
(as the kernel does not always have complete information).
This patch makes the linux_get_*_alignment() alignment functions handle
this. The algorithm used for linux_get_optimum_alignment is:
1) Always use the reported aligment offset as offset
2a)If optimal io size is present in the topology info use that as grain
2b)If optimal io size is not present in topology info and aligment
offset is 0 and minimum io size is a power of 2, use the device.c
default optimal alignment (grain 1MiB).
2c) If neither 2a and 2b, use the minimum io size, or if that is not
defined, use the physical sector size as grain (iow the minimum
The algorithm used for linux_get_minimum_alignment is:
1) Always use the reported aligment offset as offset
2) Use the minimum io size, or if that is not defined the physical
sector size as grain.
* libparted/arch/linux.c (linux_get_*_alignment): Handle incomplete
topology information.
libparted: Give device_get_*_alignment sane defaults
When the topology info is incomplete or non existent, return something
more sensible than NULL (which ends up being interpreted as
PedAlignmentAny in most cases). The default minimum alignment aligns to
physical sector size, the default optimal alignment is 1 MiB, which is
what vista and windows 7 do.
* libparted/device.c (device_get_*_alignment): Add default aligments.
* NEWS (New features): Mention it.
linux: correct phys_sector_size setting
1) Use the logical sector size as physical sector size instead of 512
when not compiled with libblkid support, this fixes problems
with logical sector size > physical sector size.
2) blkid_topology_get_physical_sector_size() returns 0 when it fails
to determine the physical sector size, handle this.
* libparted/arch/linux.c (_device_set_sector_size): Correct
phys_sector_size setting.
* NEWS (Bug fixes): Mention it.
2010-02-09 Jim Meyering <>
build: update gnulib submodule to latest
doc: NEWS: mention the install-related bug fix
* NEWS (Bug fixes): Mention the fix.
gpt: read-only operation could clobber MBR part of hybrid GPT+MBR table
* libparted/labels/gpt.c (gpt_read): Fix a bug introduced by me in
commit 7f753b1b, "gpt: rewrite GPT header-reading code".
Set write_back=0 in one more code path.
* tests/ (TESTS): Add
* tests/ New test.
* NEWS (Bug fixes): Mention this.
Reported by aix27249 in
2010-02-08 Peter Breitenlohner <>
do not install the test programs disk and label
2010-02-04 Otavio Salvador <>
Fix minor spelling errors
This fixes minor spelling errors in the source code. Basically:
2010-02-04 Jim Meyering <>
tests: avoid another spurious test failure with newer xfsprogs
* tests/ Likewise.
tests: avoid spurious test failure with newer xfsprogs
* tests/ Use mkfs.xfs' -f (force)
option. It is required at least for xfsprogs-3.1.0.
2010-01-31 Hans de Goede <>
build: fix check-other-sector_sizes
"make check-other-sector_sizes" was running tests of 512-byte sectors
four times, rather than simulating larger sector-sizes for the latter
three iterations.
* (ss-1024 ss-2048 ss-4096): Fix the typo (missing "subst").
2010-01-31 Jim Meyering <>
tests: adjust t9021-maxima not to fail with 2048-byte sectors
* tests/ At 10,000*512 bytes, the backing file
was too small to support a test simulating a sector size of 2048 bytes.
Use 10,000*$sector_size bytes instead.
build: avoid -Wshadow warnings
* parted/parted.c (do_print): Avoid two shadowing warnings.
2010-01-29 Hans de Goede <>
linux: remove PED_DEVICE_FILE check from _device_set_sector_size
_device_set_sector_size is never called for devices with a type of
* libparted/arch/linux.c (_device_set_sector_size): Remove
linux: remove unused blkpg.h header file
* libparted/arch/linux.c: Don't include blkpg.h.
* libparted/arch/blkpg.h: Deleted.
* libparted/ (libparted_la_SOURCES): Remove arch/blkpg.h.
linux: use blkid_topology_get_physical_sector_size
The official 2.17 release of util-linux-ng, has added a function to
get the physical sector size. Use that instead of getting the
minimum io size.
* libparted/arch/linux.c (_device_set_sector_size): Use
2010-01-18 Jim Meyering <>
maint: remove unreachable code
* parted/parted.c (do_print): Remove unreachable ped_disk_destroy call.
2010-01-15 Jim Meyering <>
build: update gnulib submodule to latest
dos: don't leak a constraint upon partition-add failure
* libparted/labels/dos.c (read_table): Free constraint upon failure.
gpt: don't leak a constraint upon partition-add failure
* libparted/labels/gpt.c (gpt_read): Free constraint upon failure.
gpt: do not leak a GPT header on an error path
* libparted/labels/gpt.c (gpt_write): Avoid a leak by freeing the
header buffer after pth_get_raw call where it's used, but before
checking whether that pth_get_raw call succeeded.
Avoid another leak in identical just 10 lines down.
Add "FIXME: caution..." comments to warn about the duplication.
libparted: remove unreachable code
* libparted/labels/gpt.c (gpt_write): Remove dead code.
* libparted/labels/bsd.c (bsd_partition_new): Likewise.
* libparted/disk.c (_ped_disk_alloc): Likewise.
libparted: avoid double-free on an OOM failure path
* libparted/disk.c (ped_disk_check): Don't double-free "fs_size".
2010-01-08 Jim Meyering <>
build: update gnulib submodule to latest
maint: update old_NEWS_hash
* (old_NEWS_hash): Update for GFDL license update.
maint: update all GFDL licenses to version 1.3
* NEWS: Use 1.3, not 1.2.
* doc/API: Use 1.3, not 1.1.
* doc/FAT: Likewise.
* doc/ Likewise.
* doc/fdl.texi: Likewise.
* doc/parted-pt_BR.texi: Likewise.
* doc/parted.texi: Likewise.
maint: update all FSF copyright year lists to include 2010
Run this command: make update-copyright
maint: record update-copyright options for this package
* Next time, just run "make update-copyright".
2009-12-31 Jim Meyering <>
maint: newer gnulib; don't hard-code my GPG key ID
* (gpg_key_ID): Remove definition, now that automates it.
* gnulib: Update to latest.
2009-12-20 Jim Meyering <>
maint: make build-aux/gnu-web-doc-update work
* (manual_title): Define.
* doc/parted.texi (Concept index): Rename from "Index".
Remove @ifnotplaintext..@end around its menu entry.
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* (old_NEWS_hash): Auto-update.
version 2.1
* NEWS: Record release date.
doc: NEWS: mention the flag-truncation fix
* NEWS (Bug fixes): Mention it.
2009-12-19 Hans de Goede <>
dos: honor cylinder alignment disk flag when allocating metadata
* libparted/labels/dos.c (add_startend_metadata): Honor cylinder
alignment flag.
2009-12-18 Hans de Goede <>
libparted: push/pop update mode around ped_disk_set_flag
Disk flags can change how the metadata gets allocated, so push/pop
update mode around ops->disk_set_flag, so that the metadata gets
* libparted/disk.c (ped_disk_set_flag): push/pop update mode.
linux: fix use-after-free in devicemapper code
* libparted/arch/linux.c (_dm_add_partition): Fix use of dm_task
information after freeing it.
2009-12-18 Hans de Goede <>
ui: Do not truncate flag names when printing
The partition_print_flags() function was truncating the flag names,
but these are translated strings, and thus can contain multibyte
characters. Truncating multibyte chars in a non multibyte aware way
is not good and was causing issues when printing tables in Russian:
Since the truncating does not seem to make sense at all this patch
simply removes it (it was likely an attempt to stay within 80 chars
when printing, but as one partition can have multiple flags set this
won't work)
* parted/parted.c (partition_print_flags): Don't truncate flag names.
2009-12-16 Jim Meyering <>
libparted: plug a leak in mac_write
* libparted/labels/mac.c (mac_write): Free mac_driverdata.
maint: use "int", not "bool" for value returned by ped_device_write
* libparted/labels/gpt.c (gpt_write): Correct type of local.
* libparted/labels/mac.c (mac_clobber): Likewise.
* libparted/labels/sun.c (sun_write): Likewise.
libparted: plug a leak in mac's write_block_zero
* libparted/labels/mac.c (write_block_zero): Don't leak a
1-sector-sized buffer.
dos: remove unreachable code
* libparted/labels/dos.c (msdos_partition_new): Remove dead code.
libparted: plug a leak in gpt_probe
* libparted/labels/gpt.c (gpt_probe): Avoid a leak when dev->length
is one sector or smaller.
2009-12-14 Jim Meyering <>
maint: improve rules
* (null_AM_MAKEFLAGS): Remove LIBTOOL. Adding it was
erroneous, since it is required when building from a distribution
tarball of a libtool-using project. Reported by Ralf Wildenhues.
(my-distcheck): Reorganize to use a subshell and set -e, so that
failures propagate "out". Without this change, setting LIBTOOL=false
would cause a failure that would then be ignored, probably due to a
problem in $(install-transform-check).
maint: adapt to parted-specific details
* (built_programs): Use parted/, not src/.
(install-transform-check): Search sbin/, not /bin.
Expect man pages to be in man8/*.8.
2009-12-13 Jim Meyering <>
maint: sync from coreutils
* Sync from coreutils.
* gnulib: Update to latest.
maint: sync from coreutils
* Sync from coreutils.
* gnulib: Update to latest.
build: distribute gperf-generated file, pt-limit.c
* libparted/labels/ (EXTRA_DIST): Distribute the
gperf-generated file, pt-limit.c, so that people don't need to
run gperf at build-from-tarball time.
2009-12-12 Jim Meyering <>
ui: mkpart: avoid double free
* parted/parted.c (do_mkpart): This function frees "part_name"
immediately after the final use, but also upon e.g., ped_disk_commit
failure. Set part_name to NULL after the first free, to make
the second a no-op after the first.
build: update spec: gperf is a new build-requirement
* (BuildRequires): Add gperf.
Reported by Jeff Darcy.
2009-12-11 Jim Meyering <>
build: update gnulib submodule to latest
tests: ensure that parted can partition a loop device
* tests/ Reverse sense of tests, now that
partitioning a loop device succeeds again.
* NEWS (Bug fixes): Mention it.
2009-12-11 Hans de Goede <>
linux: treat loopback devices as files
We cannot do partition related ioctl's on loopback devices,
so treat them as files.
* libparted/arch/linux.c (LOOP_MAJOR): Define.
* libparted/arch/linux.c (_device_probe_type): Treat loopback
devices as files.
Reported by Josef Bacik in
2009-12-10 Hans de Goede <>
libparted: missing pop update mode in ped_disk_delete_all error path
* libparted/disk.c(ped_disk_delete_all): Add missing update mode pop
call in error path.
libparted: make pop/push update mode propagate sanity check errors
Sanity check errors indicate something is really really wrong, still
sometimes they happen, when they happen it helps a lot in debugging
them when the libparted caller immediately errors out at the first
moment, rather then slugging along until things crash somewere.
* libparted/disk.c(_disk_push_update_mode,_disk_pop_update_mode):
Change return value from void to int, and return 0 when the sanity
check calls fail.
* libparted/disk.c(*): Update all _disk_push_update_mode /
_disk_pop_update_mode callers to propagate the return value.
2009-12-10 Joel Granados Moreno <>
libparted: add missing update mode pop in duplicate error path
* libparted/disk.c(ped_disk_duplicate): Add missing update mode
pop call in error path.
gpt: Add support for appletv partitions
* include/parted/disk.h(PedPartitionFlag): Add
* libparted/disk.c(ped_partition_flag_get_name): Handle
* libparted/labels/gpt.c(PARTITION_APPLE_TV_RECOVERY_GUID):
New define.
* libparted/labels/gpt.c(GPTPartitionData): Add atvrecv member.
* libparted/labels/gpt.c(_parse_part_entry, gpt_partition_new,
gpt_partition_set_system, gpt_partition_set_flag,
gpt_partition_get_flag, gpt_partition_is_flag_available):
build: don't install s390 dasd internal headers into /usr/include
* include/parted/ (partedinclude_HEADERS):
Remove $(S390_HDRS).
(noinst_HEADERS): Put them here instead.
2009-12-10 Hans de Goede <>
ui: add --align command-line option to specify mkpart alignment
The new --align command-line option can have the following values:
none: Use the minimum alignment allowed by the disk type
cylinder: Align partitions to cylinders (the default)
minimal: Use minimum alignment as given by the disk topology information
optimal: Use optimum alignment as given by the disk topology information
Note the "minimal" and "optimal" values will use layout information
provided by the disk to align the logical partition table addresses
to actual physical blocks on the disks. The "minimal" value is the
minimum aligment needed to align the partition properly to physical
blocks, which avoids performance degradation. Whereas the "optimum"
alignment align's to a multiple of the physical block size in a way
that guarantees optimal performance.
The "minimal" and "optimal" values are useful only when parted is
compiled with libblkid >= 2.17 and running on a kernel >= 2.6.31,
otherwise they are equivalent to --align=none.
* parted/parted.c (ALIGNMENT_ enum values): New enum.
(options, options_help): Add --align option.
(align_args, align_types, alignment): New global variables.
(do_mkpart): Honor aligment variable.
(_parse_options): handle --align option.
* bootstrap.conf (gnulib_modules): Add argmatch.
* NEWS: Mention the new --align option.
* doc/parted.texi: Document --align option.
* doc/C/parted.8: Likewise.
2009-12-10 Hans de Goede <>
NEWS: update with libblkid and kernel requirements for alignment funcs
* NEWS: Change the note for the align-check command to also reference
libblkid, add a note to the libparted alignment functions NEWS entry
about libblkid and kernel requirements.
NEWS: Add new disk flag functions to NEWS
* NEWS: Add new disk flag functions.
msdos, sun: implement disk flag operations
* libparted/labels/dos.c (DosDiskData): New struct.
* libparted/labels/dos.c (msdos_alloc, msdos_duplicate, msdos_free):
Handle per disk DosDiskData.
* libparted/labels/dos.c (msdos_disk_set_flag, msdos_disk_get_flag,
msdos_disk_is_flag_available): New functions.
* libparted/labels/sun.c (sun_disk_set_flag, sun_disk_get_flag,
sun_disk_is_flag_available): New functions.
2009-12-10 Hans de Goede <>
libparted: add disk flag functions and PED_DISK_CYLINDER_ALIGNMENT flag
Sometimes we want to be able to set flags at the disk level rather then
at the parition level, to influence how new partitions will be created
for example. This patch adds functions to do this (modelled after the
partition flag functions), and adds a PED_DISK_CYLINDER_ALIGNMENT flag.
This flag (which defaults to true) controls if disk types for which
cylinder alignment is optional do cylinder alignment when a new
partition gets added. This flag is available for msdos and sun
disklabels (for sun labels it only controls the aligning of the end of
the partition).
* include/parted/disk.h (PedDiskFlag): New type
* include/parted/disk.h (ped_disk_set_flag, ped_disk_get_flag,
ped_disk_is_flag_available): new functions and PedDiskOps members
* include/parted/disk.h (ped_disk_flag_get_name,
ped_disk_flag_get_by_name, ped_disk_flag_next): new functions
* libparted/disk.c (ped_disk_set_flag, ped_disk_get_flag,
ped_disk_is_flag_available, ped_disk_flag_get_name,
ped_disk_flag_get_by_name, ped_disk_flag_next): new functions
2009-12-10 Hans de Goede <>
dasd: fix leak in dasd_free
* libparted/labels/dasd.c (dasd_free): Free disk_specific data.
2009-12-09 Jim Meyering <>
build: update gnulib submodule to latest
build: make it clear which sector size is in use upon test failure
* (ss-1024 ss-2048 ss-4096): New targets.
Before this, top-level "make check" would lead to four separate
runs through all the regression tests, one for each of the following
simulated sector sizes: 1024 2048 4096, and one more for the native
(usually 512), and it was not easy to tell which sector size was
in use for a failing test. Now, we still perform exactly the same
tests, but the sector size is now part of each target name.
2009-12-08 Jim Meyering <>
tests: exercise the new interfaces
* tests/print-max.c: New file.
* tests/ New file.
* tests/ (TESTS): Add
(check_PROGRAMS): Add print-max.
libparted: new interfaces: max start sector, max partition length
* libparted/disk.c (ped_disk_max_partition_start_sector): New function.
(ped_disk_max_partition_length): New function.
* include/parted/disk.h: Declare them.
* NEWS (New features): Mention them.
libparted: factor out duplication, hook up new APIs
* include/parted/disk.h [struct _PedDiskOps]:
(max_length, max_start_sector): New members.
* libparted/labels/pt-common.h: New file.
* libparted/labels/ (liblabels_la_SOURCES): Add it.
* libparted/labels/dos.c: Include "pt-common.h".
(msdos_partition_check): Remove function.
(msdos_disk_ops): Remove factored out initializers.
* libparted/labels/gpt.c: Likewise.
* libparted/labels/dvh.c: Likewise.
* libparted/labels/aix.c:
(aix_disk_ops, aix_partition_check): Likewise.
* libparted/labels/bsd.c:
(bsd_disk_ops, bsd_partition_check): Likewise.
* libparted/labels/dasd.c:
(dasd_disk_ops, dasd_partition_check): Likewise.
* libparted/labels/loop.c:
(loop_disk_ops, loop_partition_check): Likewise.
* libparted/labels/mac.c:
(mac_disk_ops, mac_partition_check): Likewise.
* libparted/labels/pc98.c:
(pc98_disk_ops, pc98_partition_check): Likewise.
* libparted/labels/rdb.c:
(amiga_disk_ops, amiga_partition_check): Likewise.
* libparted/labels/sun.c:
(sun_disk_ops, sun_partition_check): Likewise.
* libparted/labels/gpt.c (NULL_IF_DISCOVER_ONLY): Remove definition,
now that it's in pt-common.h.
libparted: use gperf-generated lookup function
* libparted/labels/pt-tools.c (ptt_partition_max_start_len):
Rewrite to use the gperf-generated look-up function.
(ptt_partition_max_start_sector): New function.
(ptt_partition_max_length): New function.
* libparted/labels/pt-tools.h: Declare them.
* libparted/labels/ (GPERF, GPERF_OPTIONS): Define.
(liblabels_la_SOURCES): Append pt-limit.gperf.
(pt-limit.c): New rule.
(MAINTAINERCLEANFILES): Remove useless definition.
* libparted/labels/pt-limit.gperf: New file.
* (bootstrap-tools): Mention gperf.
* bootstrap.conf (buildreq): Require gperf-3.0.3.
pc98: avoid segfault with simulated large sectors
The pc98 partition table is by no means ready for >512-byte sectors,
but at least it now gets past mklabel. E.g., this usage no longer
provokes double-free and read-uninitialized errors:
dd if=/dev/zero of=F bs=512 count=1 seek=10000
PARTED_SECTOR_SIZE=4096 valgrind ../parted/parted -s F mklabel pc98
* libparted/labels/pc98.c (pc98_write): Rewrite to avoid
invalid access with >512-byte sectors.
libparted: ptt_read_sectors: new function
* libparted/labels/pt-tools.c (ptt_read_sectors): New function.
(ptt_read_sector): Rewrite to use it.
* libparted/labels/pt-tools.h: Declare it.
2009-12-03 Jim Meyering <>
mac: hook up the partition_check function for this partition table type
* libparted/labels/pt-tools.c (ptt_partition_max_start_len): Define
for MAC partition tables. They too have 32-bit-limited partition
starting sector number and partition length (in sectors).
* libparted/labels/mac.c (mac_partition_check): Use
2009-11-30 Jim Meyering <>
tests: exercise new align-check command
* tests/ New file.
* tests/ (TESTS): Add it.
2009-11-30 Jim Meyering <>
ui: new command: align-check TYPE N
parted -s /dev/sda align-check min 1 && echo partition 1 is min-aligned
parted -s /dev/sda align-check opt 2 && echo partition 2 is opt-aligned
* parted/parted.c:
* parted/ui.c:
* parted/ui.h:
* NEWS (New features): Mention it.
* doc/parted.texi (align-check): Describe it.
2009-11-30 Jim Meyering <>
tests: correct a comment
* tests/ Correct a comment.
2009-11-27 Jim Meyering <>
libparted: ped_disk_clobber_exclude: remove now-unused function
I see no utility in ped_disk_clobber_exclude (just a thin wrapper
around ped_disk_clobber), so am removing the interface.
* include/parted/disk.h (ped_disk_clobber_exclude): Remove prototype.
* libparted/disk.c (ped_disk_clobber_exclude): Remove function.
Now that all callers use NULL as 2nd argument, replace each call
with one to ped_disk_clobber.
* scripts/data/abi/baseline_symbols.txt: Remove it.
Reviewed-by: Karel Zak <>
2009-11-27 Jim Meyering <>
ped_disk_clobber: change semantics
Why? Because if we're going to clobber a partition table,
it is wasteful and error prone to try to interpret as a partition
table whatever existing data there may be. It may be corrupt, or
a mix of two or more types. It is far cleaner just to zero out
the key sectors.
The previous mechanism was like this:
for each partition table type, T,
# See if the device has a partition of type T.
# If so, run the partition-table-specific code to clear it.
if t->ops->probe (dev)
t->ops->clobber (dev)
Instead, simply zero out the first few and last few sectors.
Except for GPT, for which we exempt the first sector (the pMBR).
In order to zero out even the bits DASD uses for its identifying
strings, we have to clobber at least the 8.5KiB at the beginning
of the disk, so round up to 9KiB.
* libparted/disk.c: Include "labels/pt-tools.h".
(find_disk_type): New helper function.
Reviewed-by: Karel Zak <>
2009-11-27 Jim Meyering <>
dasd: allow the use of a *regular* backing file
Before this change, dasd partition tables had to be associated with
very specialized block devices available only on IBM s390 systems.
This made testing especially hard. Not only did you need access
to one of those relatively uncommon systems, but you also needed
access to a spare block device. In addition, many of Parted's
tests may be run as a non-privileged user, using regular files,
and those tests would fail when run on an s390.
This change makes it so you may now write a DASD partition table
to a regular backing file, just as you may with any other supported
partition table type. However, note that even now, DASD support
is conditionally compiled and hence enabled only when compiling
for an s390 target.
* libparted/arch/linux.c (_device_set_sector_size) [__s390__]:
Allow operation on a device of type PED_DEVICE_FILE, as well as
those of type PED_DEVICE_DASD.
* libparted/labels/fdasd.c: Include <parted/device.h>.
(fdasd_get_geometry): Add a new "dev" parameter, required for
dev-phys-sector_size, which is needed in order to initialize
the "anc" structure without using the device-specific ioctls.
When file descriptor "f" refers to a regular file, initialize
"anc", "dasd_info", etc. from other sources (fstat and dev->).
Update all callers to reflect added parameter.
(fdasd_check_api_version): Skip ioctl-calling tests when "f" is
a regular file.
* include/parted/fdasd.h: Update fdasd_get_geometry prototype.
* libparted/labels/dasd.c (dasd_probe): Also allow PED_DEVICE_FILE.
(dasd_alloc_metadata): Initialize arch_specific->real_sector_size,
which is used in calculating vtoc_end.
Reviewed-by: Karel Zak <>
2009-11-27 Jim Meyering <>
loop: simplify/correct loop_clobber
Before, it would clear a sector only if it recognized its own
signature. In addition, it would continue clearing subsequent
sectors as long as loop_probe succeeded. Now we simply clear
the first sector.
* libparted/labels/loop.c (loop_clobber): Simplify.
Reviewed-by: Karel Zak <>
2009-11-26 Jim Meyering <>
tests: indicate that we expect t3200-type-change to fail, for now
* tests/ (TESTS): Move to ...
2009-11-24 Jim Meyering <>
tests: correct
* tests/ The initial version was incomplete.
tests: provide a new function: fail_
* tests/ (fail_): New function.
tests: avoid spurious failure when run as root.
* tests/ Control characters were getting in the way.
Filter them out.
2009-11-23 Jim Meyering <>
dasd: avoid NULL-dereference via disk->type->ops->partition_check
Commit f387fee8 added the new ops->partition_check() function,
and a <type>_partition_check function for each partition table
format _except_ dasd. This change adds one for dasd, too.
* libparted/labels/dasd.c: Include "pt-tools.h".
(dasd_partition_check): New function.
* libparted/labels/pt-tools.c (ptt_partition_max_start_len): Add "dasd"
to the list of partition table type names for which the 32-bit
limits on starting sector and partition length apply.
Correct a comment.
Considering the 32-bit fields in "struct fdasd_hd_geometry",
it is safe to assume that larger offset or size is not possible.
2009-11-18 Jim Meyering <>
build: "make stable" emitted an invalid gnupload command
* (gnu_ftp_host-stable): Rename from gnu_ftp_host-major.
2009-11-17 Jim Meyering <>
test for partition-type-changing bug
* tests/ New file.
* tests/ (TESTS): Add it.
2009-11-13 Jim Meyering <>
gpt: greatly simply gpt_clobber; minor semantic change, too
* libparted/labels/gpt.c (gpt_clobber): Don't bother to read and
parse existing headers. Instead, simply clear three sectors:
the pMBR, the primary header (LBA1), and the last sector.
There is no point in clearing what the primary header says is the
AlternateLBA, since once the primary header and the last sector
are cleared, there is no risk of any tool using it by mistake.
tests: minor correction
* tests/ When zeroing out the first sector,
use dd's conv=notrunc. Otherwise, we'd also truncate the
backing file size to 4KiB.
linux_read: give a proper diagnostic for an "end of file" error
Before today's gpt_probe bug fix, its test case would provoke
an invalid diagnostic. This makes the diagnostic useful.
* libparted/arch/linux.c (linux_read): When hitting EOF while reading,
diagnose it properly, rather than via strerror(0) (i.e., "Success").
gpt_probe: don't attempt to read beyond end of a very small disk
* libparted/labels/gpt.c (gpt_probe): Don't try to read the
2nd sector if that's beyond the end of the disk.
* tests/ New test, to expose the above boundary-case bug.
Part of the msdos-partition-creation process involves probing for
other types of partition tables. Probing for gpt would evoke a
nonsensical diagnostic.
* tests/ (TESTS): Add
dvh: replace open-coded dvh_clobber with equivalent, shorter code
* libparted/labels/dvh.c (dvh_clobber): Simply use ptt_clear_sectors.
tests: weaken t0202-gpt-pmbr to assume a preexisting GPT table
* tests/ Lay down an initial GPT table before
writing to the MBR, so this test passes with the new semantics.
tests: rewrite t0202 to use new framework
* tests/ Rewrite.
ped_disk_type_get_next: fix a const-correctness bug
* libparted/disk.c (ped_disk_type_get_next): Make param const.
* include/parted/disk.h (ped_disk_type_get_next): Update prototype.
2009-11-12 Hans de Goede <>
NEWS: mention recent changes
2009-11-12 Jim Meyering <>
maint: more const-correctness fixes
2009-11-12 Hans de Goede <>
dasd: fix ped_disk_new_fresh to not read old data from disk
dasd_write(), was reading the volume label from the disk (trough
fdasd_check_volume()) and later writing it back again, this is fine for
existing dasd labels, but when creating a fresh label, this would
also cause the old volume label to be re-used, and if the old label
was corrupt, it would cause fdasd_check_volume() and thus dasd_write()
to fail. Reported here:
* libparted/arch/linux.c: include fdasd.h.
(init_dasd): Do BIODASDINFO ioctl, and store the dasd devno in
(init_dasd): Remove dead (never reached) code.
* libparted/arch/linux.h (struct _LinuxSpecific): Add devno member.
* libparted/labels/dasd.c (DasdDiskSpecific): add vlabel member.
(dasd_alloc): Init DasdDiskSpecific.vlabel for fresh disks
(dasd_read): Store read vlabel in DasdDiskSpecific.vlabel.
(dasd_write): Write DasdDiskSpecific.vlabel instead of on disk vlabel.
2009-11-10 Jim Meyering <>
build: avoid s390-specific compilation failiure
* libparted/labels/vtoc.c (vtoc_volume_label_init): Don't use
strncpy to copy 84 bytes into a 4-byte field. Instead, use
memcpy to copy "sizeof *vlabel" bytes into the "vlabel".
maint: fix s390-specific const correctness problems
* libparted/labels/vtoc.c (vtoc_error, vtoc_ebcdic_enc):
(vtoc_ebcdic_dec): Declare parameters to be const, as required.
* libparted/labels/fdasd.c (fdasd_error): Likewise.
* include/parted/vtoc.h (vtoc_ebcdic_enc, vtoc_ebcdic_enc): Update
gpt: fix a bug in the new PE-array CRC checks on big-endian systems
* libparted/labels/gpt.c (check_PE_array_CRC, gpt_read): Always
convert the PartitionEntryArrayCRC32 to CPU endianness before
comparing with a just-computed CRC.
2009-11-08 Jim Meyering <>
build: use gnulib's canonicalize-lgpl module
Replace Parted's private version of canonicalize_file_name.
* libparted/device.c: Include <stdlib.h>.
(canonicalize_file_name) [!HAVE_CANONICALIZE_FILE_NAME]:
Remove definition.
* bootstrap.conf (gnulib_modules): Add canonicalize-lgpl.
2009-11-07 Jim Meyering <>
libparted: linux: don't deref NULL upon failed malloc or realloc
* libparted/arch/linux.c (_read_fd): Handle allocation failure.
build: update gnulib submodule to latest
maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exit
Convert all uses automatically, via these two commands:
git grep -l '\<exit *(1)'|xargs --no-run-if-empty \
perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/'
git grep -l '\<exit *(0)'|xargs --no-run-if-empty \
perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/'
* libparted/fs/fat/table.c (fat_table_get): Use symbolic exit codes.
* libparted/labels/vtoc.c (vtoc_update_format5_label_add): Likewise.
(vtoc_update_format5_label_del): Likewise.
(vtoc_update_format7_label_add): Likewise.
(vtoc_update_format7_label_del): Likewise.
* m4/parted.m4 (PARTED_CHECK_LIBPARTED): Likewise.
* parted/parted.c (do_quit): Likewise.
* parted/strlist.c (gettext_to_wchar, wchar_to_str): Likewise.
* parted/ui.c (reset_env, help_msg, non_interactive_mode): Likewise.
2009-11-06 Hans de Goede <>
dasd: fix unused variable warning
* libparted/labels/dasd.c (dasd_get_partition_alignment): Fix unused
variable warning.
linux: use cached major minor instead of statting the device again
* libparted/arch/linux.c (_dm_remove_parts): Use cached major/minor
2009-11-06 Hans de Goede <>
linux: use devicemapper task name instead of device node name
Use devicemapper task name instead of device node name as basename for
devicemapper disk partitions.
This is needed for upcoming lvm changes where the /dev/mapper/foobar
files are becoming symlinks, so we will end up opening /dev/dm-#,
and naming our partitions dm-#p1, dm-#p2, instead of foobarp1,
foobarp2, etc.
2009-11-06 Hans de Goede <>
linux: use major / minor to specify device mapper device in dm_task
Use major / minor to specify device mapper device instead of
dm_task_set_name. This is needed for upcoming lvm changes where the
/dev/mapper/foobar files are becoming symlinks, so we will end up
opening /dev/dm-#, and dm-# is not a valid dm_task name.
This is only needed in this one place, as in the other places where we
use dm_task_set_name, the name we use was returned by libdevicemapper
itself in an earlier function call.
2009-11-06 Jim Meyering <>
tests: enable the FS-resizing (tests only HFS and FAT)
* tests/ (TESTS): Add
maint: remove stray "types and" in the big FS-op warning
* parted/parted.c (issue_fs_op_warning): Correct grammar in diagnostic.
tests: convert more tests to new framework
* tests/ Convert.
* tests/ Likewise.
* tests/ Likewise, and convert it to use scsi_debug.
* tests/ (require_512_byte_sector_size_): Copy this
function from
2009-11-04 Hans de Goede <>
dasd: fix disk duplication
Fix dasd_duplicate and add a dasd_partition_duplicate function.
* libparted/labels/dasd.c(dasd_partition_duplicate): New function.
(dasd_duplicate): Don't set the disk_specific pointer to NULL!
(dasd_duplicate): Copy DasdDiskSpecific from old disk to new disk.
dasd: set disk_specific->format_type in dasd_alloc
Set disk_specific->format_type in dasd_alloc, so that the disk
returned by ped_disk_new_fresh is a valid dasd disk.
* libparted/labels/dasd.c (dasd_alloc): Set disk_specific->format_type.
2009-11-04 Hans de Goede <>
dasd: cache real_sector_size in linux_probe
dasd_alloc was doing an ioctl to get the real sector size for the dasd
device (we are faking 512 bytes sectors), but when called directly
from ped_disk_new_fresh(), the device is not open causing this to fail.
This patch fixes things by caching the real_sector_size in the linux
arch_specific data and making the dasd label handling use this.
libparted/arch/linux.c(_device_set_sector_size): Cache real sector size.
(_device_set_sector_size, init_dasd, linux_new): Only compile dasd code
on s390 and s390x.
2009-11-04 Hans de Goede <>
dasd: remove bogus part_info pointer from DasdPartitionData
The part_info pointer in DasdPartitionData was only used to
pass fdasd partition_info_t pointers from dasd_write to
the dasd_write dasd_update_type utility function. Since these
pointers are not valid outside the lifetime of dasd_write, they
should not be stored in the longer lived DasdPartitionData.
* libparted/labels/dasd.c(DasdPartitionData): Remove part_info member.
(dasd_read): Stop setting DasdPartitionData part_info.
(dasd_update_type): Add part_info argument to pass fdasd
partition_info_t pointers from dasd_write.
(dasd_write): Stop setting DasdPartitionData part_info, pass
partition_info_t pointers to dasd_update_type as a separate argument.
2009-11-04 Hans de Goede <>
dasd: clean up anchor handling
The current dasd label code keeps an fdasd anchor struct in the
DasdDiskSpecific struct, and fills this during dasd_read. However this
anchor does not get updated with any future mods, until dasd_write,
at which points it gets completely re-initialized.
Since the contents of the anchor saved during read does not get used
anywhere else, this patch switches to using local anchor structs in
dasd_read and dasd_write. This will also allow writing a significantly
simpler duplicate implementation, then the one which is currently
added to the Fedora package with a patch from Joel Granados (The
current master dasd_duplicate implementation is not functional).
This patch also fixes several missing calls to fdasd_cleanup() fixing
several memory leaks.
* libparted/arch/linux.h (struct _LinuxSpecific): Drop anchor member.
* libparted/labels/dasd.c (DasdDiskSpecific): Drop anchor member.
(dasd_clobber): Add missing fdasd_cleanup().
(dasd_read, dasd_write): Use local anchor struct instead of a
dynamically allocated one in DasdDiskSpecific.
(dasd_read): Don't leak a PedConstraint in 2 error paths.
(dasd_update_type): Pass in the used anchor as argument.
2009-11-03 Jim Meyering <>
tests: distribute new files, and
* tests/ (EXTRA_DIST): Add and
tests: appease "make syntax-check"
* tests/print-align.c: Include "progname.h". Call set_program_name.
tests: update and adapt to changed LVM2
* tests/ Rewrite to use new test framework and
to disable multipath testing, since LVM2 has changed in such
a way that it no longer works with loop devices.
tests: do not invoke scsi_debug_setup_ in a subshell
* tests/ Do not invoke scsi_debug_setup_ in
a subshell, since it sets a variable that cleanup machinery expects
to see.
* tests/ Likewise.
tests: tweak temporary dirname prefix
* tests/ (t_): Use "pe-" as prefix, not "gz-".
tests: update from lvm2
* tests/ Merge in changes from lvm2.
tests: adapt/update lvm-related infrasture, too
* tests/ Source
* tests/ Clone and update of,
for when we retire that file in favor of this one.
tests: adapt
* tests/ Rewrite in new style, and adjust to
expect new diagnostic.
tests: print and check partition alignment info, too
* tests/print-align.c: Print partition alignment info, too
* tests/ Check partition alignment too.
tests: serialize tests that use the scsi_debug module
* tests/ (scsi_debug_lock_file_): New global.
(scsi_debug_acquire_lock_): New function.
(scsi_debug_setup_): Call it, to acquire the lock.
(scsi_debug_cleanup_): Release the lock.
tests: test the new alignment functions
* tests/ New test.
* tests/ (TESTS): Add it to the list.
tests: factor out some more
* tests/ (require_scsi_debug_module_): New function.
* tests/ Use it.
tests: perform scsi_debug cleanup automatically...
...rather than requiring each test to do it.
* tests/ ($cleanup_eval): New variable. Initialize.
(remove_tmp_): Use it.
* tests/ Record whether modprobe succeeded.
(cleanup_eval_): Append an invocation of scsi_debug_cleanup_
so that it is always run.
(scsi_debug_cleanup_): Run rmmod only if the modprobe succeeded.
* tests/ (cleanup_): Remove.
2009-11-02 Jim Meyering <>
tests: move scsi_debug framework into shared script
* tests/ (-scsi_debug_cleanup_, wait_for_dev_to_appear_):
(print_sd_names_, scsi_debug_setup_): New functions, factored out of ...
* tests/ ...this file.
tests: document and begin to factor out scsi_debug framework
* tests/ Add comments, fix a bug in
"comm" usage, prepare to factor out scsi_debug framework.
tests: add a helper program to print alignment info for a device
* tests/print-align.c: New file.
* tests/ (check_PROGRAMS): Define.
(AM_CFLAGS): Enable warnings here, too, by adding
2009-11-01 Hans de Goede <>
Implement get_partition_alignment DiskOp for all labels which need it
Implement get_partition_alignment DiskOp for all labels which require
an alignment with a grain_size != 1.
libparted: add ped_disk_get_partition_alignment() function
This functions get the alignment needed for partition boundaries on this disk.
The returned alignment describes the alignment for the start sector of the
partition, for all disklabel types which require alignment, except Sun
disklabels, the end sector must be aligned too. To get the end sector
alignment decrease the PedAlignment offset by 1.
2009-11-01 Hans de Goede <>
libparted: add ped_device_get_xxx_aligned_constraint() functions
Add ped_device_get_minimal_aligned_constraint() and
ped_device_get_optimal_aligned_constraint() functions to libparted.
These functions can be used to get a device constraint taking alignment into
2009-11-01 Hans de Goede <>
ped_device_get_constraint: return constraint without alignment
In libparted-1.9 ped_device_get_constraint() would always return a constraint
without any start / end aligning (grain_size == 1). Now that we are starting to
support disks with a physical sector size other then 512, the old
ped_device_get_constraint() code may actually start returning constrains
with alignment info with a grain_size != 1.
Since this is a behavior change and since the old code does not take a possible
alignment info into account, this patch removes the aligning code from
ped_device_get_constraint(), so that its behavior is unchanged.
This patch also updates the functions doxygen documentation to reflect what
it has actually done all these years.
2009-11-01 Hans de Goede <>
linux: add get_xxx_alignment() functions
* libparted/arch/linux.c (get_minimum_alignment): New function.
(get_optimum_alignment): New function.
linux: save blkid topology in arch_specific data for later use
This is a preparation patch for adding get_minimum_alignment
and get_optimum_alignment functions to linux's _PedDeviceArchOps.
* libparted/arch/linux.h (struct_LinuxSpecific) [probe, topology]:
Add members.
* libparted/arch/linux.c (linux_new): initialize
arch_specific->probe and arch_specific->topology to NULL,
(linux_destroy): Free arch_specific->probe.
(get_minimum_io_size): Remove function.
(get_blkid_topology): New function.
(_device_set_sector_size): Call get_blkid_topology() instead of
get_minimum_io_size() and retrieve minimum io size from the cached
2009-11-01 Hans de Goede <>
libparted: add ped_device_get_xxx_alignment() functions
Add ped_device_get_minimum_alignment() and ped_device_get_optimum_alignment()
functions to libparted.
Note this is a resent of my previous patchset with a number of typos corrected:
aligment -> alignment
minimal_alignment -> minimum_aligment
optimal_alignment -> optimum_aligment
Sorry for the noise.
2009-10-29 Jim Meyering <>
tests: protect t7000 from the environment
* tests/ Initialize fail=0, so that an
environment setting cannot perturb the test.
tests: convert to new testing framework
* tests/ Convert to new testing framework.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
dvh: document an as-yet-unplugged (but not serious) leak
* libparted/disk.c (ped_disk_add_partition): List some of the
things I've tried to plug a leak exposed by a root-only test
on dvh's partition-creation error path. This leak is enough
of a corner case that I may even leave it for now, and add a
suppression for it, so that we're not distracted by it.
2009-10-28 Jim Meyering <>
dvh: plug three constraint-sized leaks
* libparted/labels/dvh.c (dvh_read, dvh_alloc_metadata):
Free constraint upon failure, too.
ui: plug multiple command_line_get_word leaks
* parted/parted.c (do_mkpart, do_print):
check: plug an even smaller (formatted "unit") leak
* libparted/disk.c (ped_disk_check): Free fs_size also upon success.
check: plug a geometry-sized leak
* libparted/disk.c (ped_disk_check): Destroy "geom", when done with it.
loop: don't leak a sector in loop_clobber
* libparted/labels/loop.c (loop_clobber): Replace leaky open-coded
version with a use of Use ptt_clear_sectors.
tests: t7000: remove mkpartfs tests
This test tested both mkpart and mkpartfs.
* tests/ Remove the mkpartfs tests.
tests: remove tests that are too FS-centric
* tests/ Remove file.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ Likewise.
* tests/ (TESTS): Remove them here, too.
2009-10-27 Jim Meyering <>
ui: plug a constraint leak in do_mkpart
* parted/parted.c (do_mkpart): Free constraint after using it to
add partition.
gpt: plug two gpt-header leaks in gpt_read_headers
* libparted/labels/gpt.c (gpt_read_headers): Free locals pri and/or
bak if they are not valid.
gpt: plug a 1-sector leak in gpt_read_headers
* libparted/labels/gpt.c (gpt_read_headers): Free a sector.
ui: plug a leak (partition_print_flags)
* parted/parted.c (do_print): Free flags, after printing.
libparted: plug an FS-alias-related leak
* libparted/filesys.c (ped_file_system_alias_unregister):
Free the alias we've just unregistered.
2009-10-26 Jim Meyering <>
doc: update NEWS
* NEWS (Bug fixes): Describe two.
2009-10-23 Jim Meyering <>
gpt: header validity: also consider whether a PE array crc matches
* libparted/labels/gpt.c (check_PE_array_CRC): New function.
(_header_is_valid): Use it to verify that partition entry array
checksums match, too.
Karel Zak noticed that this check was not being performed.
* tests/ Adapt to changed diagnostic.
gpt: tweak interfaces to pass disk, not disk->dev
* libparted/labels/gpt.c: required for upcoming CRC-checking function.
gpt: don't ignore an improbable (1-in-2^32) failure
pth_crc32 mapped failure to a crc32 value of 0. If that happened
to match the stored value, there would be no indication that there
had been a malloc failure.
* libparted/labels/gpt.c (pth_crc32): Change interface so we can
distinguish failure from a CRC value of 0.
Update all callers.
(_generate_header): Now that we recognize pth_crc32 can fail,
we must admit that its void-returning caller _generate_header
may fail, too. Return "int" and adjust *its* callers.
gpt: factor out code that is about to be reused
* libparted/labels/gpt.c: Include <errno.h>.
(gpt_read_PE_array): New function, ...
(gpt_read): ...factored out of this one. Use it.
gpt: don't dereference NULL upon OOM (pth_get_raw callers)
Handle each case in which pth_get_raw may return NULL.
* libparted/labels/gpt.c (pth_get_raw): Upon OOM error, return 0
rather than dereferencing NULL.
(gpt_write): Don't dereference NULL upon OOM error.
(gpt_read): Yet another.
gpt: don't dereference NULL upon OOM (in pth_get_raw)
* libparted/labels/gpt.c (pth_get_raw): Don't dereference NULL
on out of memory error.
gpt: remove dead store
* libparted/labels/gpt.c (pth_crc32): Remove useless initialization.
gpt: make an internal function "const"-correct
* libparted/labels/gpt.c (_parse_header): Make "gpt" const.
tests: convert t0280 to new test style.
* tests/ Convert to new test style.
* tests/ Source
* tests/ New file.
gpt: clean up
* libparted/labels/gpt.c (gpt_probe): Remove now-useless test before
(gpt_read): Use ptt_clear_sectors in place of open-coded equivalent.
* (useless_free_options): Add --name=pth_free.
2009-10-23 Jim Meyering <>
gpt: make its header check a tiny bit more strict
* libparted/labels/gpt.c (_header_is_valid): Declare a header
to be invalid if its AlternateLBA is the same as MyLBA.
2009-10-21 Jim Meyering <>
complete most of gpt-CRC-related rewrite
* libparted/labels/gpt.c (_read_header): Remove now-unused function.
2009-10-23 Jim Meyering <> adapt for new output, improve test
gpt: rewrite GPT header-reading code
* libparted/labels/gpt.c (read_header): Remove now-unused function.
(gpt_read_headers): New function.
(gpt_read): Rewrite to use gpt_read_headers.
gpt: require that the backup table's AlternateLBA is 1
* libparted/labels/gpt.c (_header_is_valid): When checking
the backup header, ensure that its AlternateLBA is 1.
tests: gpt: test for detection of corrupt backup partition header
* tests/ Corrupt the backup partition header's
MyLBA, and require that an attempt to print the table fails.
tests: hook up new GPT-crc-corrupting script
* tests/ (TESTS): Add
* libparted/labels/gpt.c (gpt_read): Change diagnostic to say that
the PTE CRC mismatch is in the primary table.
* tests/ Tweak diagnostic to match
what the code now prints.
gpt: also verify MyLBA when checking table validity
* libparted/labels/gpt.c (_header_is_valid): Add parameter, my_lba.
(_read_header): Update caller.
(_parse_header): Comment out this use of _header_is_valid
in an assertion.
gpt: clean up formatting of static initializers
* libparted/labels/gpt.c (NULL_IF_DISCOVER_ONLY): Define.
(gpt_disk_ops): Use it to avoid in-decl #if directives.
2009-10-20 Jim Meyering <>
gpt.c: filter through indent --no-tabs...
and manual fix-up to shorten long lines.
Also, manually format the static initializers in e.g., gpt_disk_ops,
since GNU indent botches that.
2009-10-19 Jim Meyering <>