2023-04-10 Brian C. Lane version 3.6 * NEWS: Record release date. NEWS: Releasing stable version 3.6 2023-03-24 Brian C. Lane maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.5.28 * NEWS: Record release date. NEWS: Update news tests: Fix syntax-check warning about grep -q maint: Update copyright statements to 2022 By running make update-copyright maint: Bump library REVISION number for release maint: Update README-release maint: Update to latest gnulib and bootstrap script 2023-03-17 Brian C. Lane parted: Fix ending sector location when using kibi IEC suffix This fixes a bug when using KiB to specify the ending location of a partition. It was not subtracting 1s like it does with the other units because it was looking for a 'k' not a 'K'. This also fixes a quirk of the suffix checking code, it would check for matching case, but converting to the actual IEC value was case insensitive. This now uses common functions for the matching so that case doesn't matter. It also adds tests to check for the fix. The only change in behavior is that using KiB to specify the ending location of a partition will now correctly create the end 1s lower than the specified location like it does for MiB, GiB, etc. 2023-02-15 Brian C. Lane tests: Fix formatting and snprintf warnings in tests. The assert message includes sector values, which are long long int, so use the proper formatting of %lld. The snprintf warning complained about trying to write 258 bytes so I bumped the buffer size up to 259. The return value is already being checked for truncation so this is just to keep the compiler happy without having to suppress the warning. 2023-02-15 Brian C. Lane ui: Add checks for prompt being NULL Also removes a cast from const char* to char* when passing to readline that doesn't appear to be necessary any longer. Added asserts to make sure prompt isn't NULL after strdup and realloc calls. 2023-02-15 Brian C. Lane strlist: Handle realloc error in wchar_to_str It could return a NULL if the realloc fails. This handles the failure in the same way as other failures in wchar_to_str, it exits immediately with an error message. libparted: Fix potential NULL dereference in ped_disk_next_partition filesys: Check for null from close_fn If the filesystem type name isn't known it can return a NULL. 2023-02-07 Brian C. Lane tests: Fixing libparted test framework usage The fail and fail_if functions from libcheck are deprecated, replace them with ck_abort_msg and ck_assert_msg. Note that the logic of assert is the opposite of fail_if. 2023-02-06 Brian C. Lane libparted: Fix problem with creating 1s partitions There was a 1-off error in _partition_get_overlap_constraint that prevented partitions from being created in 1s free space. You could create 1s partitions as long they were done in order, but not after leaving 'holes'. This fixes this and adds tests for it on msdos and gpt disklabels. 2022-12-13 Brian C. Lane tests: XFS requires a minimum size of 300M 2022-12-13 Mike Fleetwood gpt: Add no_automount partition flag Add user requested support for GPT partition type attribute bit 63 [1] so the no-auto flag in the systemd originated Discoverable Partitions Specification [2] can be manipulated. The UEFI specification [3] says partition attribute bits 48 to 63 are partition type specific, however the DPS [2] and Microsoft [4] use the bit 63 to mean no automounting / assign no drive letter and apply it to multiple partition types so don't restrict its application. [1] Request for GPT partition attribute bit 63 "no automount" editing support https://gitlab.gnome.org/GNOME/gparted/-/issues/214 [2] The Discoverable Partitions Specification (DPS), Partition Attribute Flags https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ [3] UEFI Specification, version 2.8, Table 24. Defined GPT Partition Entry - Attributes https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf [4] CREATE_PARTITION_PARAMETERS structure (vds.h) https://learn.microsoft.com/en-gb/windows/win32/api/vds/ns-vds-create_partition_parameters 2022-09-30 Arvin Schnell parted: Add display of GPT UUIDs in JSON output This adds 2 new disk type features, one for the whole disk UUID and another for the per-partition UUID. It adds ped_disk_get_uuid and ped_partition_get_uuid functions to retrieve them. It adds them to the JSON output on GPT disklabeled disks as "uuid" in the disk and partitions sections of the JSON output. 2022-08-15 Brian C. Lane tests: Add a libparted test for ped_partition_set_system on msdos Test the libparted API to make sure the flag is not cleared by calling ped_partition_set_system. 2022-08-15 Brian C. Lane libparted: Fix handling of msdos partition types This restores the previous behavior by testing the partition type against the list of known types and skipping the filesystem type reset. Now the sequence of: ped_partition_new(...) ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1); ped_partition_set_system(part, ped_file_system_type_get("ext4")); Will keep the type set to PED_PARTITION_BLS_BOOT, which is how it used to behave. 2022-08-15 Brian C. Lane tests: Add a libparted test for ped_partition_set_system on gpt Test the libparted API to make sure the flag is not cleared by calling ped_partition_set_system. 2022-08-15 Brian C. Lane libparted: Fix handling of gpt partition types This restores the previous behavior by testing the GUID against the list of known types and skipping the filesystem GUID reset. Now the sequence of: ped_partition_new(...) ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1); ped_partition_set_system(part, ped_file_system_type_get("ext4")); Will keep the GUID set to PED_PARTITION_BIOS_GRUB, which is how it used to behave. 2022-08-04 Brian C. Lane disk.in.h: Remove use of enums with #define The preprocessor doesn't evaluate the enum, so it ends up being 0, which causes problems for library users like pyparted which try to use the _LAST value to conditionally include support for newer flags. Instead just define the int that is the first and last entry in each enum. Thanks to adamw and dcantrell for help arriving at a solution. 2022-07-27 Arvin Schnell parted: Simplify code for json output _PedDiskOps::get_max_primary_partition_count is always available, the macro PT_op_function_initializers ensures it. So use ped_disk_get_max_primary_partition_count instead of _PedDiskOps::get_max_primary_partition_count directly. libparted: Fix check for availability of _type_id functions Fix a copy/paste error. In practice this didn't cause any problems because the *_set_type_id and *_get_type_id are either both NULL or both set to the function. 2022-05-13 Brian C. Lane tests: t3200-type-change now passes parted: Reset the filesystem type when changing the id/uuid Without this the print command keeps showing the type selected with mkpart, which doesn't match the id/uuid set by the user. So rescan the partition for a filesystem. 2022-05-13 Arvin Schnell libparted: add swap flag for DASD label Support the swap flag and fix reading flags from disk. Also cleanup code by dropping the 2 flags "raid" and "lvm" from DasdPartitionData and instead use "system" directly. parted: add type command Include the partition type-id and type-uuid in the JSON output. Also add the the command 'type' to set them. Remove redundant flags from DosPartitionData and use only the system variable. 2022-04-18 Brian C. Lane maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.5 * NEWS: Record release date. NEWS: Mention gnulib update maint: Update to latest gnulib and bootstrap script 2022-04-05 Brian C. Lane maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.4.64.2 * NEWS: Record release date. NEWS: Mention bugfix 2022-03-31 Benno Schulenberg bug#54649: [PATCH] usage: remove the mention of "a particular partition" This complements commit b20227adf5 from five months ago. 2022-03-30 Brian C. Lane maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.4.64 * NEWS: Record release date. 2022-03-29 Brian C. Lane NEWS: Add new features and bugs 2022-03-28 Brian C. Lane doc: Add KiB and mention rescue in documentation 2022-03-25 Brian C. Lane configure.ac: Add AC_CONFIG_MACRO_DIR configure.ac: Add -Wno-portability This is to quiet automake warnings about Makefile.am files using GNU make extensions like pattern rules. configure.ac: Update macros for autoconf 2.71 tests: Remove trailing blanks parted: Fix config.h include in jsonwrt.c libparted: Fix syntax-check sc_avoid_if_before_free error It is safe to free even if they are NULL. 2022-03-23 Brian C. Lane gpt: Include xalloc-oversized.h maint: Add ./lib/malloc and libparted-fs-resize.pc to .gitignore maint: Update copyright statements to 2022 By running make update-copyright maint: Bump library REVISION number for release maint: Update to latest gnulib and bootstrap script 2021-12-01 Brian C. Lane doc: Add bios_grub to parted manpage 2021-10-06 Brian C. Lane docs: Update documentation to be consistent This fixes some missing commands in the parted.texi file used to generate the web manual and info document. It also removes documentation for the never-implemented 'print NUMBER' command which only returns 1. The parted manpage has been updated to document the available print options, disk_set, and disk_toggle commands. 2021-09-30 Brian C. Lane gpt: Revert to filesystem GUID when setting flag to off tests: Add a test to make sure GPT GUIDs default to filesystem When no flag is set on a GPT partition the GUID should fall back to the filesystem type for fat32, swap, and hfs+ and if no filesystem is found it should default to linux filesystem data type, showing no filesystem and no flags. doc: Document gpt linux-home flag 2021-09-30 Arvin Schnell gpt: Add linux-home flag This sets the partition GUID to the linux home type: 933AC7E1-2EB4-4F13-B844-0E14E2AEF915 2021-09-29 Arvin Schnell gpt: Map PED_PARTITON_ flags to GUID values Drop the 14 flags from _GPTPartitionData that correspond to a partition type/uuid. Use the type/uuid directly instead. 2021-09-23 Arvin Schnell keep GUID specific attributes Keep GUID specific attributes when writing GPT. 2021-09-22 Colin Watson hurd: Implement partition table rereading We have to tell both the device for the drive itself, it case it implements the partitioned devices, and tell the partition devices to go away, in case they are implemented on their own by using parted. 2021-09-22 Samuel Thibault hurd: Support rumpdisk-based device names 2021-09-22 Colin Watson hurd: Fix partition paths We have always had an 's' to separate drive number from partition number. 2021-08-25 Arvin Schnell parted: Add --json cmdline switch to output JSON This outputs the disk's details as a JSON object. eg. a disk image with a single partition from 1M to 100M: { "disk": { "path": "/root/disk1.img", "size": "2097152s", "model": "", "transport": "file", "logical-sector-size": 512, "physical-sector-size": 512, "label": "gpt", "max-partitions": 128, "partitions": [ { "number": 0, "start": "34s", "end": "2047s", "size": "2014s", "type": "free" },{ "number": 1, "start": "2048s", "end": "200703s", "size": "198656s", "type": "primary", "name": "root" },{ "number": 0, "start": "200704s", "end": "2097118s", "size": "1896415s", "type": "free" } ] } } 2021-08-25 Arvin Schnell parted: Allow empty string for partition name This makes it possible to pass an empty string in script mode e.g. to set no partition name (on GPT): parted -s ./disk.img mklabel gpt mkpart '""' ext2 1 100M Includes a new test for this feature. 2021-08-25 Brian C. Lane libparted: Check devpath before passing to strlen 2021-08-10 Brian C. Lane libparted: Tell libdevmapper to retry remove when BUSY This sets the libdevmapper retry remove flag, which will retry a remove command if it is BUSY. parted already has it's own BUSY retry code, but when run with device-mapper an error can be printed by libdevmapper which can be confusing to the user. Resolves: rhbz#1980697 2021-08-10 Brian C. Lane parted: Escape colons and backslashes in machine output The device path, device model, and partition name could all contain colons or backslashes. This escapes all of these with a backslash. Thanks to Arvin Schnell for the patch. 2021-08-10 Ross Burton tests: check for vfat kernel support and tools t1100-busy-label.sh and t1101-busy-partition.sh create and mount VFAT partitions, so check for both the tools and the kernel support. Fixes bug#49594. 2021-08-10 Ross Burton tests: add a helper to check the kernel knows about a file system Some tests need both the file system tools (eg mkfs.vfat) and kernel support (eg vfat kernel module) to pass. There are already helpers such as require_fat_ which check for mkfs.vfat, but if the kernel doesn't support the filesystem then mounting the disk image will fail. Add require_filesystem_, which checks for either the filesystem name in /proc/filesystems (so it's built-in, or already loaded) or if the name is a valid module (so can be loaded on demand). 2021-08-10 Ross Burton tests: add aarch64 and mips64 as a valid 64-bit machines require_64_bit_ in t-lib-helpers.sh has a hard-coded list of uname machines that are 64-bit, so add aarch64 and mips64 to cover the major architectures. 2021-08-10 Brian C. Lane libparted: Add swap flag to msdos disklabel Previously you had to set the filesystem type to one of the linux-swap options at creation time. With this change you can now toggle the partition swap type using the 'swap' partition flag in the same way that you can on gpt disklabels. Thanks to Arvin Schnell for this patch. 2021-08-10 Brian C. Lane Move Exception Option values into enum Adding enums together doesn't create a new enum value, so when compiling with warnings you will get warnings like: warning: case value ‘96’ not in enumerated type for PED_EXCEPTION_IGNORE_CANCEL This moved the defines into the enum as new values so that they are recognized as valid members of the enum with the values staying the same. NOTE: PED_EXCEPTION_OPTION_LAST *MUST* be the last of the individual options, not the combined options. Thanks to D. Hugh Redelmeier for this patch. 2021-07-29 Brian C. Lane tests/t3000: Use mkfs.hfsplus and fsck.hfsplus for resize tests 2021-07-15 Brian C. Lane tests/t3000: Check for hfs and vfat support separately Previously the whole test would be skipped if either mkfs.hfs or mkfs.vfat were not installed, leading to missing test coverage. This change checks for them individually so that the test will run with either or both of them installed 2021-07-14 Brian C. Lane tests/t6006: Change dev_size_mb to 10 This is backed by memory, so using more than is needed limits the size of the system it can run on. tests/t3200: Change dev_size_mb to 10 This is backed by memory, so using more than is needed limits the size of the system it can run on. 2021-07-14 Brian C. Lane tests/t3000: Change dev_size_mb to 267 FAT32 needs a minimum partition size of 256MB so this is as small as we can make it. This is backed by memory, so using more than is needed limits the size of the system it can run on. 2021-07-12 Brian C. Lane tests/t1701: Change dev_size_mb to 10 This is backed by memory, so using more than is needed limits the size of the system it can run on. tests/t1102: Change dev_size_mb to 10 This is backed by memory, so using more than is needed limits the size of the system it can run on. tests/t1101: Change dev_size_mb to 10 This is backed by memory, so using more than is needed limits the size of the system it can run on. tests/t1100: Change dev_size_mb to 10 This is backed by memory, so using more than is needed limits the size of the system it can run on. 2021-06-14 Brian C. Lane tests: t9050 Use /dev/zero for temporary file and mkswap and clean up the usage a little bit by giving it a proper name and removing the file when finished. tests: t0400 - Work around a mkswap bug by using /dev/zero mkswap gets stuck, in some situations, when operating on a file full of holes (see https://bugzilla.redhat.com/show_bug.cgi?id=1971877) so work around that by using /dev/zero instead of /dev/null 2021-06-11 Brian C. Lane libparted: Fix potential memory leak in gpt_write _generate_header() can return with 1 after allocating gpt so it needs to be freed in the error path. libparted: Fix warning about buffer size in Atari label When the Atari table is empty it copies 'PARTEDATARI' into the id, and the start and size bytes. This can be confusion, so turn it into a union of the string and the non-empty values. parted: Fix memory leaks in do_resizepart parted: Free tmp usage inside do_print str_list_create calls gettext_to_wchar which makes a copy of it. parted: Fix end_input leak in do_mkpart fs: Fix copy-paste error in HFS journal code libparted: Fix potential memory leak in sdmmc_get_product_info libparted: Fix fd check in _flush_cache In theory open() could return 0 so the correct error value is -1. 2021-02-09 Brian C. Lane t0501-duplicate.sh: Add some more disk label types to the duplicate test Add sun, atari, mac, and pc98 to the disklabels that we test ped_disk_duplicate on. aix isn't included because it doesn't support adding partitions. dvh doesn't support boot partition loop cannot be partitioned 2021-02-09 Brian C. Lane tests: Increase disk size for duplicate test Increase it from 8MiB to 32MiB and start the first partition at 2048 sector boundary instead of 32 so that no matter the sector size it will be aligned. 2021-01-28 Cristian Klein tests: Fix t9041-undetected-in-use-16th-partition Sometimes fails with: ``` + mkfs.ext3 /dev/sda15 mke2fs 1.45.5 (07-Jan-2020) /dev/sda15: Not enough space to build proposed filesystem while setting up superblock ``` 2021-01-28 Cristian Klein tests: Fix test t1700-probe-fs mkfs.ext3 (see version below) was complaining that the filesystem is too small for a journal, which made the test fail. ``` $ mkfs.ext3 -V mke2fs 1.45.5 (07-Jan-2020) Using EXT2FS Library version 1.45.5 ``` 2021-01-28 Cristian Klein tests: Add tests for --fix doc: Document --fix flag Also fix copyright year, to please `make syntax-check`. 2021-01-28 Cristian Klein parted: add --fix to "fix" in script mode Use-case: VMs are booted from images that are smaller than their virtual disk. This means that -- almost by definition -- the secondary GPT header will be "misplaced", i.e., not at the end of the virtual disk. Without this patch, parted cannot be used for custom/exotic partitioning when the VM boots (e.g., in cloud-init's `bootcmd`). Specifically, it will fail as follows: ``` $ sudo parted --script /dev/vda "mkpart 2 10GB -1" Warning: Not all of the space available to /dev/vda appears to be used, you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting? Error: Unable to satisfy all constraints on the partition. ``` This happens because, in script mode, exceptions are usually not resolved. This patch adds `--fix`. This allows exceptions to be automatically resolved with Fix. As a result, the following command will work: ``` $ sudo parted --fix --script /dev/vda "mkpart 2 10GB -1" ``` 2021-01-28 Brian C. Lane libparted: Add includes for gnulib redefining free gnulib redefines free using #define, causing problems with the pt-common.h file. Work around that by including standard header files as suggested by gnulib maintainer: https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00315.html 2021-01-27 Brian C. Lane maint: Update bootstrap script from latest gnulib maint: Update to latest gnulib maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.4 * NEWS: Record release date. NEWS: Mention the non-public gnulib commit 2021-01-26 Brian C. Lane cfg.mk: disable submodule checks to work around broken upstream gnulib Include local gnulib change to version-etc.c date 2021-01-18 Brian C. Lane maint: Update copyright statements to 2021 By running make update-copyright README-release: Add information for updating the Translation Project 2020-12-14 Brian C. Lane maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.3.52 * NEWS: Record release date. 2020-12-11 Brian C. Lane libparted/fs: Add ./lib to include search path libparted: Check for NULL flag_name in ped_partition_flag_get_by_name strcasecmp parameters cannot be NULL according to gcc -Wanalyzer-null-argument po/POTFILES.in: Remove xstrtol-error.c Appears to no longer be needed, results in an error when running make check syntax-check. maint: Update copyright statements to 2020 By running make update-copyright configure.ac (AC_PREREQ): Require 2.64 maint: Bump library REVISION number for release maint: Update bootstrap script from latest gnulib maint: Update to latest gnulib 2020-12-04 Brian C. Lane labels/bsd.c: Drop alpha_bootblock_checksum from bsd_probe Thanks to Alpine Linux for catching this. In commit a5f69f396713ab8ac1e57458cbb9af552d2c1659 I change label to actually point to the label and failed to pass the new s0 to alpha_bootblock_checksum() instead of label. So it was writing the so-called checksum off the end of the 512b sector buffer. bug: https://gitlab.alpinelinux.org/alpine/aports/-/issues/12161 upstream report: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45026 2020-11-20 Brian C. Lane libparted/fs: Fix GCC warnings suggesting pure for PED_ASSERT functions There was some question about whether or not pure should be used for functions with PED_ASSERT (or exit) in them. It should be fine, since the values checked by the ASSERT are passed to the function directly. Behavior should be exactly the same for the same inputs. libparted: Remove disabled code fs/r/hfs: Remove disabled code fs/r/fat: Remove disabled code hfs/reloc_plus: Fix gcc 10 warnings about cast alignment hfs/reloc: Fix gcc 10 warnings about cast alignment ui: Fix gcc 10 warning about snprintf truncating an int Double the storage to 20 bytes. ui: Fix command_line_get_disk_flag It was using PedPartitionFlag instead of PedDiskFlag when walking the available flags. ped_assert: Fix incorrect exception option PED_EXCEPTION_FATAL is a type, not an option. A PED_EXCEPTION_BUG should always select CANCEL. ufs: Fix gcc 10 warnings about cast alignment ntfs: Fix gcc 10 warnings about cast alignment nilfs2: Fix gcc 10 warnings about cast alignment ext2: Fix gcc 10 warnings about cast alignment hfs/hfs: Fix gcc 10 warnings about cast alignment hfs/advfs_plus: Fix gcc 10 warnings about cast alignment hfs/advfs: Fix gcc 10 warnings about cast alignment hfs: Fix gcc 10 bounds check warning binfo is actually a list of structs that cannot be known until runtime, so use a variable length array. tests: Fix unsigned warning in duplicate.c linux: Fix gcc complains about signed sccanf variables dos: Fix gcc complaints when using boot_code pointer bsd: Fix gcc complaints when using boot_code pointer 2020-11-20 Shin'ichiro Kawasaki libparted: Fix warnings from GCC 8 -Wsuggest-attribute=const As GCC 8 suggests, add 'const' attribute to six functions. After adding const attributes, GCC suggested two more functions to add const attributes. Add const attributes to those functions also. In total, add const attributes to 8 functions. I read code of the functions and confirmed they are const: they examine only their arguments and have no effect other than return value. 2020-11-20 Shin'ichiro Kawasaki libparted: Fix warnings from GCC 8 -Wsuggest-attribute=pure As GCC 8 suggests, add 'pure' attribute to 17 functions. After adding pure attributes, GCC suggested three more functions to add pure attributes. Add pure attribute to those functions also. In total, add pure attributes to 20 functions. I read code of the functions and confirmed the 20 functions are pure: they have no effect except the return value, and their return value depend only on the parameters and/or global variables. 2020-11-05 Shin'ichiro Kawasaki libparted: Avoid a GCC warning for unused functions libparted/fs/r/hfs/hfs.c has a '#if 0' block. The block refers two functions hfsplus_clobber() and hfs_clobber(). It have GCC report a warning below. CC r/hfs/hfs.lo r/hfs/hfs.c:343:1: warning: 'hfsplus_clobber' defined but not used [-Wunused-function] 343 | hfsplus_clobber (PedGeometry* geom) | ^~~~~~~~~~~~~~~ To avoid the warning, add two more '#if 0' to disable the two functions. 2020-11-05 Shin'ichiro Kawasaki libparted: Fix warnings from GCC's -Wimplicit-fallthrough Two case statements have intentional fall-throughs but do not have comments to note it. GCC detects and warns those case statements. To avoid the warning, add fall-through comments. 2020-11-05 Shin'ichiro Kawasaki libparted: Fix warnings from GCC 8 -Wunused-variable and -Warray-bounds GCC 8 reports two warnings as follows. r/fat/bootsector.c: In function 'fat_boot_sector_set_boot_code': r/fat/bootsector.c:274:15: warning: unused variable 'fs_info' [-Wunused-variable] FatSpecific* fs_info = FAT_SPECIFIC (fs); ^~~~~~~ In function 'memcpy', inlined from 'fat_boot_sector_set_boot_code' at r/fat/bootsector.c:283:2: /usr/include/bits/string_fortified.h:34:10: warning: '__builtin_memcpy' forming offset [126, 128] is out of the bounds [0, 125] [-Warray-bounds] return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To avoid the warnings, remove the unused variable. Use strcpy in place of memcpy checking copy length. 2020-11-05 Shin'ichiro Kawasaki libparted: Fix a GCC warning -Wunused-but-set-variable GCC warns that a variable 'prealloc' defined for _generic_affs_probe() in fs/amiga/affs.c is set but its value is never used. CC amiga/affs.lo amiga/affs.c: In function '_generic_affs_probe': amiga/affs.c:54:35: warning: variable 'prealloc' set but not used [-Wunused-but-set-variable] 54 | int blocksize = 1, reserved = 2, prealloc = 0; | ^~~~~~~~ Remove the variable for simplicity and to avoid the warning. 2020-11-05 Brian C. Lane tests: Update all the dmsetup tests to use ENABLE_DEVICE_MAPPER 2020-11-05 Joe Slater t6001-psep: modify device manage support detection Use the method other tests use -- test an environment variable. 2020-11-05 Petr Lautrbach Do not link to libsepol or libselinux Given that there's no code which would use it there's no reason to link to libsepol or libselinux even when they are available. 2020-09-01 Brian C. Lane tests: Add a test for resizepart on a busy partition This makes sure that the resizepart on a busy partition with the size on the cmdline will work. 2020-08-31 Brian C. Lane parted: Preserve resizepart End when prompted for busy partition Resizing busy partitions is allowed, but the user is prompted, which erases the cmdline. It is annoying to have to re-end the ending location after answering Yes. This saves the word and pushes it back onto the cmdline after the user agrees to resize the busy partition. 2020-05-04 Romain Perier tests: Add f2fs to the fs probe test Add support for the F2FS filesystem This adds a basic support for the Flash-Friendly File System. So we can manipulate the file system by using the PedFileSystem API and we can do basic device probing for autodetecting the current fs. 2020-03-09 Max Campbell Removed reference to ped_file_system_create Removed a reference to the removed function ped_file_system_create in the docs for ped_file_system_clobber. 2019-12-20 Brian C. Lane NEWS: Add bls_boot to new features libparted: Add support for bls_boot to GPT disks This sets the partition GUID to bc13c2ff-59e6-4262-a352-b275fd6f7172 to indicate that the partition is a Boot Loader Specification compatible /boot partition. libparted: Add support for MSDOS partition type bls_boot (0xea) This type is used by the Boot Loader Specification to identify a compatible /boot boot partition. 2019-12-20 Alper Nebi Yasak libparted: Add ChromeOS Kernel partition flag This adds a GPT-only partition type flag, chromeos_kernel, for use on Chrome OS machines, with GUID FE3A2A5D-4F32-41A7-B725-ACCC3285A309. The firmware/bootloader in these machines relies on special images being written to partitions of this type. Among multiple such partitions, it decides which one it will boot from based on the GUID-specific partition attributes. This patch is not intended to and does not manipulate these bits. Google refers to these partitions as "ChromeOS kernel" partitions. They also define partitions for rootfs, firmware, and a reserved one; but these are not necessary for the boot flow and are not included here. Relevant ChromiumOS documentation: https://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format 2019-12-16 Brian C. Lane Fix end_input usage in do_resizepart It needs to be set to NULL, since it may not get set by the call to command_line_get_sector tests: Test incomplete resizepart command 2019-10-11 Brian C. Lane maint: Add note about gpg key selection for gnupload Switch gpt-header-move and msdos-overlap to python3 python2 is EOL on January 1, 2020 so it is time to switch to python3. 2019-10-10 Brian C. Lane maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.3 * NEWS: Record release date. NEWS: Note the fix for the s390 bug 2019-09-30 Viktor Mihajlovski libparted/s390: Re-enabled virtio-attached DASD heuristics DASDs attached to KVM guest as virtio-blk devices are only handled properly, if the unique DASD geometry is detected. Commit id 61dd3d4c5eb782eb43caa95342e63727db3f8281 has prevented proper geometry detection. Fixed by making sure that HDIO_GETGEO takes precedence on s390[x]. 2019-08-21 Brian C. Lane README-release: Add link to upload registration page Without this you cannot use gnupload to send the new release tarball to the ftp servers. 2019-08-12 Brian C. Lane maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.2.153 * NEWS: Record release date. maint: Move NEWS template to line 3 maint: Update copyright statements to 2019 By running make update-copyright maint: Bump library REVISION number for release maint: Update bootstrap script from latest gnulib maint: Update to latest gnulib 2019-08-09 Brian C. Lane libparted: Fix bug in bsd.c alpha_bootblock_checksum I flubbed this in e35af6cbc43f5b279e6f0d65ccc904b1ac6c63d2 by trying to switch to using a pointer and ended up writing off the end. Switch the loop in alpha_bootblock_checksum back to use [i] index. It's easier to read anyway. doc: Create po directory if missing When running 'make distcheck' the directory tree it uses is created without the po directory. Create it if it is missing. dist-check.mk: Remove empty .deps directories Borrowed from coreutils commits 373ba16f332d and 40434e566e52 Turn off c_prohibit_gnu_make_extensions po: Add argmatch.h bsd.c: Rewrite disklabel code to prevent gcc warnings Constructing a pointer into a char array results in warnings about casting changing alignment. This changes how the boot sector is handled by adding the label to BSDDiskData with the correct offset (64 bytes). Add gcc malloc attribute to ped_alloc and ped_calloc 2019-08-09 Shin'ichiro Kawasaki libparted: Replace abs() with llabs() GCC 9 fails to compile a few C source files which call abs() function. An example of the error messages was as follows: CC dos.lo dos.c: In function '_best_solution': dos.c:1773:13: error: absolute value function 'abs' given an argument of type 'long long int' but has parameter of type 'int' which may cause truncation of value [-Werror=absolute-value] 1773 | a_delta = abs (part->geom.start - a->start); | ^~~ dos.c:1774:13: error: absolute value function 'abs' given an argument of type 'long long int' but has parameter of type 'int' which may cause truncation of value [-Werror=absolute-value] 1774 | b_delta = abs (part->geom.start - b->start); | ^~~ cc1: all warnings being treated as errors To avoid the errors, replace abs() function calls with llabs(). 2019-08-09 Brian C. Lane sun.c: Aligned _SunRawLabel to 16bit boundary gpt.c: Drop cast of efi_guid_t to unsigned char * This confuses gcc, making it think the uuid_t is unaligned when it really comes from a efi_guid_t entry in _GPTDiskData. gpt.c: Align _GPTDiskData to 8 byte boundary dvh.c: Use memcpy instead of strncpy The strings are short, so using memcpy isn't much slower (if at all). This fixes gcc complaining about strncpy possibly copying a non-terminated string. 2019-08-09 Shin'ichiro Kawasaki include/parted/unit.in.h: Specify const attribute to ped_unit_get_name() GCC 8 fails to compile libparted/unit.c with an error: CC unit.lo unit.c:155:1: error: function might be candidate for attribute 'const' [-Werror=suggest-attribute=const] ped_unit_get_name (PedUnit unit) ^~~~~~~~~~~~~~~~~ CC disk.lo cc1: all warnings being treated as errors Const attribute is required for the function ped_unit_get_name() because its return value is not affected by program status. To avoid the build failure, change attribute of the function from pure to const. 2019-08-09 Shin'ichiro Kawasaki libparted/labels/pt-tools.c: Fix gperf generated function attribute GCC 8 fails to compile libparted/labels/pt-tools.c with an error: CC pt-tools.lo In file included from pt-tools.c:114: pt-tools.c: In function 'pt_limit_lookup': pt-limit.gperf:78:1: error: function might be candidate for attribute 'pure' [-Werror=suggest-attribute=pure] cc1: all warnings being treated as errors "Pure" attribute is required for the function pt_limit_lookup() because it does not change program status other than its return value. To avoid the build failure, add _GL_ATTRIBUTE_PURE to the function. The attribute cannot be added in libparted/gperf/pt-limit.c because it is generated by gperf during the build process. Instead, add the attribute in libparted/gperf/pt-tools.c which includes the generated function. 2019-08-09 Shin'ichiro Kawasaki configure.ac: Check ABI against ABI version 2 GCC 8 fails to compile libparted/labels/aix.c with an error: CC aix.lo cc1: error: -Wabi won't warn about anything [-Werror=abi] cc1: note: -Wabi warns about differences from the most up-to-date ABI, which is also used by default cc1: note: use e.g. -Wabi=11 to warn about changes from GCC 7 cc1: all warnings being treated as errors make[4]: *** [Makefile:1250: aix.lo] Error 1 To avoid the build failure, specify ABI version 2 to check ABI change from GCC 4.9. 2019-08-09 Brian C. Lane Adjust the gcc warnings to recognize FALLTHROUGH dos.c: Fix cast alignment error in maybe_FAT atari.c: Align the AtariRawTable on a 16bit boundary The casts to uint16_t need to know that this will be aligned. The struct is actually 512 bytes, so it normally does end up aligned. This just makes sure the compiler knows it and stops warning about the casts. Change 'time stamp' to 'timestamp' Caught by make syntax-check Fix double semi-colons Caught by make syntax-check Update syntax-check NEWS hash to cover 3.2 release notes. Fix syntax-check complaints about tests Remove trailing whitespace Caught by make syntax-check Remove unnecessary if before free checks Caught by make syntax-check 2019-08-09 Brian C. Lane configure.ac: Remove default -Werror flag Warnings as errors does not make sense with the current state of the codebase and it is making it difficult to do new releases. We should *show* the warnings, and handle them as time permits, but they should not block building a new release. 2019-08-09 Brian C. Lane README-release: Updating the release instructions 2019-08-05 A. Wilcox libparted: Fix endian bug in bsd.c You have to add 1 *before* doing the endian conversion, not after. 2019-07-15 Max Staudt libparted/fs/amiga/affs.c: Remove printf() to avoid confusion Currently, the affs code in libparted prints a debug line to stdout when an Amiga FFS partition is probed. This confuses tools that parse stdout. A prominent example is the partitioner (partman) in Debian's installer, which parses stdout from a tool (parted_devices) that uses libparted to scan the system's block devices. As of now, Debian cannot be installed on a typical Amiga: https://lists.debian.org/debian-68k/2019/07/msg00015.html This patch removes this unexpected printf(). Cc: glaubitz@debian.org 2019-04-09 Michael Small Tests case for sigsegv when false nilfs2 superblock detected. 2019-04-09 Michael Small Avoid sigsegv in case 2nd nilfs2 superblock magic accidently found. 1. is_valid_nilfs_sb: make sure the subtraction bytes - sumoff - 4 won't give a negative number. That as the len argument to __efi_crc32() would give a very large number for the latter's for loop limit, since len is unsigned long. 2. nilfs2_probe: Read and allocate enough sectors to hold a struct nilfs2_super_block. is_valid_nilfs_sb() will be passing up to 1024 bytes to __efi_crc32(). If only one 512 byte sector had been allocated with alloca and read from disk that would cause reads off the the end of the stack even if bytes were more than sumoff - 4. 2019-02-11 Brian C. Lane Fix align-check help output 2019-01-31 Hans-Joachim Baader Added support for Windows recovery partition (WINRE) on MBR Windows 10 uses a recovery partition which is sometimes marked with partition type 0x27 on MBR systems. It wasn't possible to handle such a partition with parted. Therefore the partition type PARTITION_MSFT_RECOVERY is now used properly also on MBR when the flag msftres is set. 2019-01-31 Brian C. Lane parted: Remove PED_ASSERT from ped_partition_set_name Asserts should only check logic, not wrap functions with side-effects. When compiled with --disable-debug this causes the name field of mkpart to be ignored. 2019-01-30 Brian C. Lane docs: Update GNU License version in parted .text files 2018-10-16 dann frazier Read NVMe model names from sysfs parted currently shows the same generic model name for all NVMe devices: # parted /dev/nvme0n1 -s print | grep Model Model: NVMe Device (nvme) If the model information is available in sysfs, display that instead: # parted /dev/nvme0n1 -s print | grep Model Model: THNSN5512GPU7 NVMe TOSHIBA 512GB (nvme) 2018-10-16 dann frazier Fix warnings from GCC 7's -Wimplicit-fallthrough All of these locations appear to have intentional fallthroughs. Add comments that GCC will detect to mute warnings w/ -Wimplicit-fallthrough. 2018-10-16 dann frazier ped_unit_get_name: Resolve conflicting attributes 'const' and 'pure' The const and pure attributes conflict: error: ignoring attribute 'const' because it conflicts with attribute 'pure' [-Werror=attributes] pure functions may access global memory, const functions may not. ped_unit_get_name() accesses non-local variable unit_names, so drop const. 2018-10-16 Brian C. Lane Add udf to t1700-probe-fs and to the manpage If mkfs.udf is installed this will test to make sure that the filesystem is detected. 2018-10-16 Pali Rohár libparted: Add support for MBR id, GPT GUID and detection of UDF filesystem This is needed for libparted based applications (like Gparted) to correctly choose MBR id and GPT GUID for UDF filesystem. MBR id for UDF is 0x07 and GPT GUID is Microsoft Basic Data, see why: https://serverfault.com/a/829172 Without registering a new libparted fs code it is not possible to assign MBR id or GPT GUID. Detection of UDF filesystem is done by checking presence of UDF VSD (NSR02 or NSR03 identifier) and UDF AVDP at expected locations (blocks 256, -257, -1, 512). 2018-10-16 Simon Xu Fix potential command line buffer overflow parted terminates with 'stack smashing detected' when fed with a long command line argument, and segfaults when the argument is long enough: root # /sbin/parted /dev/sda $(perl -e 'print "a"x265') *** stack smashing detected ***: /sbin/parted terminated ... Aborted root # /sbin/parted /dev/sda $(perl -e 'print "a"x328') *** stack smashing detected ***: /sbin/parted terminated ... Command History: Segmentation fault parted should be able to detect it and exit with error and usage messages. This also makes command line buffer overflow exploit more possible. Fix it by adding length check in the condition of the for loop where command line arguments are copied. 2018-08-22 Brian C. Lane t6100-mdraid-partitions: Use v0.90 metadata for the test Newer metadata types use more disk space, causing the test to fail. 2018-08-22 Brian C. Lane parted.c: Make sure dev_name is freed If there was a problem with ped_device_get or ped_device_open it would not be freed. Related: rhbz#1602652 2018-08-22 Brian C. Lane parted.c: Always free peek_word If command_line_get_fs_type failed it would never free it, so put a free in both branches of the if. Related: rhbz#1602652 2018-08-22 Brian C. Lane Fix the length of several strncpy calls These need to be 1 less than the allocated size of the buffer, strncpy will fill shorter strings with zeros, but there needs to be room for at least one 0x00 at the end if the string is the same length as the buffer and has no terminating 0x00. Related: rhbz#1602652 2018-08-22 Brian C. Lane Modify gpt-header-move and msdos-overlap to work with py2 or py3 Distributions are starting to remove python2 and only use python3. Modify these test scripts so that they will work with either python 2.7 or python 3.X 2018-08-22 Ulrich Müller libparted: Fix ending CHS address in PMBR. According to the UEFI specification version 2.7, Section 5.2.3, Table 16, the ending CHS address in the protective MBR should be set to 0xFFFFFF. This also agrees with the behaviour of fdisk from util-linux-2.32. 2018-06-12 Phillip Susi Fix atari label false positives The atari label gets false positives easily, so probe it after all other labels have said no. 2018-06-05 Phillip Susi Lift 512 byte restriction on fat resize As Colin Watson pointed out way back in 2014, when I removed the 512 byte sector size restriction from the fs recognition code, I missed the same from the fat resize code. 2018-06-05 Colin Watson build: Remove unused traces of dynamic loading Now that file system operations have been removed from libparted, libreiserfs is no longer used. Remove references to it, along with the dynamic loading build infrastructure which was only used for libreiserfs. 2018-06-05 Phillip Susi Fix resizepart iec unit end sector Fix resizepart to adjust the end to be -1 sector when using iec power of 2 units so that the next partition can start immediately following the new end, just like mkpart does. 2018-06-05 Niklas Hambüchen mkpart: Allow negative start value when FS-TYPE is not given The manual had long documented that negative values are allowed for both start and end values, but until now negative start values were rejected if FS-TYPE was not given. Example: # parted --script -a optimal /dev/loop0 -- mklabel gpt mkpart primary ext4 -5MiB 100% (succeeds) # parted --script -a optimal /dev/loop0 -- mklabel gpt mkpart primary -5MiB 100% parted: invalid token: -5MiB Error: Expecting a file system type. This commit fixes the latter error. The issue was an insufficient lookahead in command line parsing, looking only for digits when skipping over FS-TYPE. The fix is including the minus '-' in the lookahead. Originally reported as Debian bug #880035: "parted: fails to use negative start value for 'mkpart' command without specyfying FS-TYPE" https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=880035 2018-06-05 Phillip Susi Fix set and disk_set to not crash when no flags are supported Loop labels and file images support no flags. set and disk_set would prompt for a flag and accept any string since the list of flags was empty, then fail to look up an actual flag value, then throw an exception with a null string for the name of the flag, which would bug. 2018-05-07 Phillip Susi tests: fix t6100-mdraid-partitions The test was failing because it didn't wait for the md device to appear after creating it. Fix make check Make check failed due to some warnings treated as errors. One was caused by a warning that a function could have the noreturn attribute. It seems that this had previously been disabled but gcc has changed the flag from -Wmissing-noreturn to -Wsuggest-attribute=noreturn. The recently added volser.c test also caused a few warnings when not compiled on s390x because most of the functions were no used, so #if those out as well. 2018-04-04 Richard W.M. Jones linux: Include for major() macro. Since glibc 2.27 this header is required. 2017-12-19 Sebastian Parschauer Add support for NVDIMM devices Recognize NVDIMM devices, so that "parted -s /dev/pmem7 p" now prints "Model: NVDIMM Device (pmem)" instead of "Model: Unknown (unknown)". In order for a device to be recognized as NVDIMM, it has to have a 'blkext' major number. But since this major can be used also by other device types, we also check that the device path contains 'pmem' as a substring. * NEWS: Mention the change * include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_PMEM * libparted/arch/linux.c(_device_probe_type): Recognize NVDIMM devices. * libparted/arch/linux.c(linux_new): Handle NVDIMM devices. * parted/parted.c(do_print): Add "pmem" to list of transports. 2017-12-19 Arnout Vandecappelle (Essensium/Mind) libparted/labels: link with libiconv if needed gpt.c uses iconv so it should link with it. Otherwise, on platforms where libiconv is a separate library, we get a link failure of parted: CCLD parted ../libparted/.libs/libparted.so: undefined reference to `libiconv' ../libparted/.libs/libparted.so: undefined reference to `libiconv_open' ../libparted/.libs/libparted.so: undefined reference to `libiconv_close' Since iconv functionality is needed unconditionally (not only when gettext is enabled), AM_ICONV needs to be added to configure.ac. 2017-07-31 Brian C. Lane atari.c: Drop xlocale.h (#1476934) glibc no longer includes this header. locale.h should work just fine. 2017-06-06 Brian C. Lane libparted: Fix udev cookie leak in _dm_resize_partition Add a NEWS entry. 2017-05-25 Brian C. Lane libparted: Fix udev cookie leak in _dm_resize_partition The function is setting udev cookies, but not using them when waiting for the task. This results in leaked cookies, which can eventually exhaust the available number of semaphores. 'dmsetup udevcookies' will show a cookie remaining afterwards, and 'ipcs -s' will show the semaphores in use. Also simplified the exit so that the task is always destroyed and memory is all freed in the same path. Resolves: rhbz#1455564 2017-05-02 Brian C. Lane tests/t1701-rescue-fs wait for the device to appear. After mkpart it needs to wait for the new partition to appear. 2017-05-02 Brian C. Lane Increase timeout for rmmod scsi_debug and make it a framework failure On some hardware scsi_debug can take longer to remove. If this fails it inevitably results in the next test failing since it cannot load scsi_debug. Increse the timeout to 40 loops (8 seconds), and if it hits the limit without succeeding call framework_failure_ 2017-05-01 Wang Dong libparted/dasd: add test cases for the new fdasd functions The test case uses a temporary file in libparted/tests under Check framwork.It can be issued by "make check" in the test dir. libparted/dasd: add an exception for changing DASD-LDL partition table The partition table of DASD-LDL device with the dasd disk label should not be changed according to its character in Linux. When the user tries to modify the partition table, an exception will be raised to inform user of this character. libpartd/dasd: improve flag processing for DASD-LDL DASD-LDL does not support flag now, so all the flags are unavailable to it. 2017-05-01 Wang Dong parted/ui: remove unneccesary information of command line When some command fails, the information still exists in command_line buffer. When in command mode or interactive mode, if an interactive exception prompts, the remained information will be processed as option from user. This will raise some other information or even unexpected results. So before getting option input from user, clean the command line buffer. Example: When the disk label is invalid and user tries to make new partition on the device with command like, mkpart 0 50%. Then parted will raise an exception telling an invalid disk label found and whether to correct it. But at this time 0 as the input of mkpart will be considered as the option input for the exception(yes/no). So one more exception will raised with error information. 2017-05-01 Wang Dong parted: check the name of partition first when to name a partition The previous function works well for the labels supporting naming partition, but not for these which don't. If the disk label does not support partition naming, two exceptions will be raised. Even after the first error indicates it does not support name, parted yet asks user for name in iteractive mode. First check if the disk label supports partition naming and if it does, it will continue; otherwise, it will stop and raise an exception. 2017-05-01 Sebastian Parschauer Add support for RAM drives Recognize RAM drives, so "parted -s /dev/ram0 p" now prints "RAM Drive (brd)" instead of "Model: Unknown (unknown)". In order for a device to be recognized as RAM drive, it has to have major number 1. Also the BLKFLSBUF ioctl shouldn't be used on RAM drives as it is used to zero the device. * NEWS: Mention the change * include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_RAM. * libparted/arch/linux.c(RAM_MAJOR): New define. * libparted/arch/linux.c(_device_probe_type): Recognize RAM drives. * libparted/arch/linux.c(linux_new): Handle RAM drives. * libparted/arch/linux.c(_flush_cache): Skip RAM drives. * parted/parted.c(do_print): Add "brd" to list of transports. 2017-05-01 Wang Dong clean the disk information when commands fail in interactive mode. parted always reads disk information to memory before any operations. The disk that user operates is actually a copy of real one in memory. When the information in memory is changed, it will commit the memory to device to update the disk information. Once the disk information is read, parted will never re-read it again unless another device is loaded or the device is re-read. Above work has been done in commit 7eac058 (parted: don't reload partition table on every command) Each command of parted always commits the memory when it succeeds. Then the disk information on device and in memory are the same. But when it fails, they might be different. User will be confused by this, and sometimes get undesired result with the contaminated memory. This memory should be cleaned if some command fails. Then the command followed will re-read the disk. 2017-05-01 Wang Dong parted: fix wrong error label jump in mkpart When the user makes a new partition, if parted fails to add the partition to disk, it jumps to wrong error label. In this situation, this new partition actually is not a node in disk data structure. But in the wrong error label, it pretends this is a node and removes it as a list node, leading to other partition in this disk deleted. This might lead to a memory leak. Because if there are other partitions, it just removes them from list without releasing the resource. And this also leads to different disk information between memory and device. This is confusing. But when the new partition is added to disk successfully and if any operations followed fail, this partition should be removed from disk and destroyed. 2017-05-01 Wang Dong parted: fix crash due to improper partition number input When the user makes a new partition, if parted fails to add the partition to disk, it jumps to wrong error label. In this situation, this new partition actually is not a node in disk data structure. But in the wrong error label, it pretends this is a node and removes it as a list node, leading to other partition in this disk deleted. This might lead to a memory leak. Because if there are other partitions, it just removes them from list without releasing the resource. And this also leads to different disk information between memory and device. This is confusing. But when the new partition is added to disk successfully and if any operations followed fail, this partition should be removed from disk and destroyed. 2017-04-17 Phillip Susi Fix crash when localized The _() macro is only for translating string literals. It was incorrectly applied to a runtime string representing the name of a partition and this sometimes caused a gettext crash. 2017-01-19 Sebastian Rasmussen libparted: Fix typo in hfs error message 2016-12-22 Laurent Vivier libparted: Fix MacOS boot support boot_region_length (or BootSize in the MacOS dialect) is the length of the driver code in the driver partition. This length is used to compute the checksum of the driver. libparted updates this value by setting the whole size of the partition without computing the checksum of the driver using this size. As the checksum is wrong, the driver is broken and cannot be loaded by the MacOS ROM, and thus the disk is not bootable anymore. Moreover, parted try to update the driver list and makes it disappear. As parted is not able to insert a driver in a partition, the driver is generally inserted by the Apple HD Tool, this patch removes the line updating the driver size. We also simplify the driver list scan and fix endianess use. This has been tested... and it works, now. I have updated a bootable disk with parted on x86_64 and then been able to boot it (again) on a Mac LC III. 2016-12-22 John Paul Adrian Glaubitz libparted: Add support for atari partition tables libparted:tests: Move get_sector_size() to common.c Moving get_sector_size() from disk.c to common.c allows us to use it in _implemented_disk_label() to test for 512-byte sectors. This change is required to be able to enable this test for atari partition tables for which support is added in a follow-up patch. 2016-12-22 Brian C. Lane tests: Update t0220 and t0280 for the swap flag. 2016-12-22 Arvin Schnell libparted: set swap flag on GPT partitions The filesystem type is still detected as befor, but now setting the 'swap' flag will set the partition GUID to PARTITION_SWAP_GUID. 2016-12-22 Wang Dong libparted/dasd: add test cases for the new fdasd functions The test case uses a temporary file in libparted/tests under Check framwork. It can be issued by "make check" in the test dir. 2016-12-22 Wang Dong libparted/dasd: add new fdasd functions Introduce a set of new functions from the fdasd utility of the s390-tools to keep the code base in parted and s390-tools in sync. These new functions are: fdasd_check_volser(): validate the volser input fdasd_get_volser(): get volume serial (volser) fdasd_change_volser(): change volser with string fdasd_reuse_vtoc(): re-create vtoc labels based on the existing vtoc 2016-12-22 Wang Dong libparted/dasd: update and improve fdasd functions Update the fdasd_anchor_t data structure and the fdasd_cleanup() function. Also correct vtoc_changed and vlabel_changed accounting because they are important to rewrite vtoc to save the changes. Wang Dong Hendrik Brueckner 2016-12-22 Wang Dong libparted/dasd: unify vtoc handling for cdl/ldl Merge volume label cdl and ldl. It is convenient to manipulate the same structure. Also remove unused arguments in the functions. 2016-12-22 Sebastian Parschauer libparted: Don't warn if no HDIO_GET_IDENTITY ioctl Fully virtualized Xen VMs (HVM) use Linux IDE devices which don't support the HDIO_GET_IDENTITY ioctl. EINVAL is returned, a warning is printed and the device model is set to "Generic IDE" in that case. The problem is seeing the warning all the time. So drop it for this case. 2016-12-22 Petr Uzel libparted: Fix starting CHS in protective MBR The CHS address for protective partition start in protective MBR should be 0/0/2, according to UEFI spec (v2.6, section 5.2.1). * libparted/labels/gpt.c (_write_pmbr): Fix starting CHS address Reported by Steffen Winterfeldt in https://bugzilla.suse.com/969165 2016-12-22 Brian C. Lane tests: Stop timing t9040 (#1172675) parted doesn't have any control over how long this takes, there is no reason to consider this a parted bug if it takes longer than expected. Resolves: rhbz#1172675 2016-12-22 Brian C. Lane partprobe: Open the device once for probing Previously there were 3 open/close pairs for the device, which may result in triggering extra udev actions. Instead, open it once at the start of process_dev and close it at the end. tests: Set optimal blocks to 64 for scsi_debug devices The Linux kernel 4.5 changed the optimal blocks count from 64 to 1024 This causes tests using scsi_debug devices to fail because of alignment issues. Set the opt_blks to 64 so that we have consistent behavior across kernels. 2016-12-22 Brian C. Lane doc: Add information about quoting Some shells (bash) will strip off the " so it needs to be wrapped in '' to prevent it. eg. parted -s ./disk.img mkpart '"EFI System Partition"' 1M 500M 2016-12-22 Brian C. Lane doc: Cleanup mkpart manpage entry (#1183077) 2016-12-22 Brian C. Lane tests: Fix t1700 failing on a host with a 4k xfs filesystem (#1260664) The problem is that mkfs.xfs won't work if the file it is trying to create is on a filesystem with a sector size larger than the passed -ssize value. So a host with 4k disks (eg. s390) and the xfs filesystem will fail with the error message: illegal sector size 512; hw sector is 4096 Failures setting up the environment for the test aren't parted bugs. This stops treating mkfs and dd errors as test failures, skipping the fs and logging a warning. Related: rhbz#1260664 2016-12-22 Brian C. Lane tests: Add wait to t9042 (#1257415) Also make the new disklabel and first partition all in one step to prevent udev problems. Resolves: rhbz#1257415 2016-12-22 Brian C. Lane tests: Add udevadm settle to wait_for_ loop (#1260664) Sometimes the device will vanish after the wait_for_dev_to_appear exits. Add udevadm settle in an attempt to make sure the udev system is done flapping around and the device will stay in place. Related: rhbz#1260664 2016-10-04 Brian C. Lane tests: t3310-flags.sh skip pc98 when sector size != 512 2016-10-04 Mike Fleetwood tests: t3310-flags.sh: Add tests for remaining table types Add test of flags for remaining table types: aix, amiga, pc98, sun and loop. Note that support of writing AIX tables is not yet implemented in parted and LOOP tables don't support partitions nor flags. 2016-10-04 Mike Fleetwood tests: t3310-flags.sh: Add test for dvh table flags DVH table reserves the first 4 MiB for the volume header information so move the created test partition to immediately after that. Exclude testing the boot flag as that can only be set on logical partitions and this test script only uses primary partitions so far. 2016-10-04 Mike Fleetwood tests: t3310-flags.sh: Add test for mac table flags MAC partition table reserves partition 1 for the partition map partition, so the created test partition will be number 2. Adapt accordingly. Setting flags 'root' and 'swap' also sets the partition name to 'root' and 'swap' respectively, so no longer match the partition name in extract_flags(). Don't test lvm and raid flags as they fail to be cleared with a single set off command. See FIXME comment in the test for more details. 2016-10-04 Mike Fleetwood libparted: Remove commented local variable from bsd_partition_set_flag() 2016-10-04 Mike Fleetwood libparted: Fix to report success when setting lvm flag on bsd table bsd_partition_set_flag() was falling through in the lvm flag case and returning failure. Fix this by adding missing return 1 (success) like for the other flags. Found as a result of this bug reported by Timo Riikonen: https://bugzilla.gnome.org/show_bug.cgi?id=769831 2016-10-04 Mike Fleetwood tests: t3310-flags.sh: Add test for bsd table flags tests: t3310-flags.sh: Stop excluding certain flags from being tested Also grep for whole words, grep -w, to avoid flag 'boot' being matched as a substring of flag 'legacy_boot'. 2016-10-04 Mike Fleetwood tests: t3310-flags.sh: Query libparted for all flags to be tested Replace scanning the documentation for an incomplete list of flags with querying libparted for the complete list of supported flags via the added helper print-flags. Correct $ME -> $ME_ in the warning messages. Improve the warning messages by including the table type and flag name not correctly set or cleared. Plus minor changes: (1) use slightly longer variable name primary_or_name; (2) use longer test partition name PTNNAME; and (3) stop shortening parted unit command to u. 2016-09-30 Petr Uzel libparted: only IEC units are treated as exact If the user specifies start/end of the partition as a unit, whose size happens to be power of two, we treat that as exact address with exact placement. Recently, commit 01900e056ec25083 added an exception for percent units. This logic however can fail also for cylinders, e.g. on DASD FBA disks, which report CHS=(*, 128, 16) geometry, hence once cylinder is 1 MiB. With cylinders as units, exact placement is not what the user wants. Instead of adding cylinders to the blacklist, let's instead whitelist units which should trigger exact placement. * libparted/unit.c (is_power_of_2): Remove now unused function. (ped_unit_parse_custom): Specify which units trigger exact placement. * NEWS (Bug Fixes): Mention this. 2016-09-30 Gareth Randall docs: Improve partition description in parted.texi 2016-06-23 Petr Uzel Add support for NVMe devices Recognize NVMe Devices, so "parted -s /dev/nvme0n1" now prints "NVMe Device (nvme)" instead of "Model: Unknown (unknown)". In order for a device to be recognized as NVMe, it has to have a 'blkext' major number. But since this major can be used also by other device types, we also check the device path contains 'nvme' as a substring. * NEWS: Mention the change * include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_NVME * libparted/arch/linux.c(BLKEXT_MAJOR): New define. * libparted/arch/linux.c(_is_blkext_major): New function. * libparted/arch/linux.c(_device_probe_type): Recognize NVMe devices. * libparted/arch/linux.c(linux_new): Handle NVMe devices. * parted/parted.c(do_print): Add "nvme" to list of transports. 2016-06-23 Wang Dong libparted/dasd: correct the offset where the first partition begins The start point of first partition must start at least from the third track of DASD, due to the existence of metadata in the first two track. The previous constraint just sets all the device to be partitioned. So when the start point of the first partition start before the third track, (For example if it starts from.0) parted will exit abruptly. And this kind of job must be done with constraint explicitly. Then the constraint is modified to exclude the first two tracks and to make the first partition start from the third track by default. Reviewed-by: Viktor Mihajlovski 2016-05-06 Brian C. Lane libparted: Fix probing AIX disks on other arches Not a likely scenario, but make sure the magic check works everywhere. 2016-04-15 Brian C. Lane libparted: Remove fdasd geometry code from alloc_metadata (#1244833) commit db20944f changed how the trailing_metadata_end is calculated in dasd_alloc_metadata, removing the need for setting up the anchor struct. But dasd_alloc_metadata can be called in various contexts, and the arch_specific->fd may or may not be valid during these calls. This can result in unpredictable crashes when it uses a stale fd and tries to run the file image code in fdasd_get_geometry instead of the device code. The solution is to just drop the unneeded code, and to remember that arch_specific->fd should only be used when ped_device_open has first been called. Resolves: rhbz#1244833 2016-04-14 Phillip Susi Add NEWS entry for fat resize fix 2016-04-14 Gustavo Zacarias bug#17883: [PATCH] configure.ac: uclinux is also linux uclinux is used in the tuple for some noMMU linux builds like Blackfin FLAT output, so accept it as linux too. 2016-04-14 Curtis Gedak lib-fs-resize: Fix recognition of FAT file system after resizing When resizing a FAT partition, an extra boot_sector memory allocation was causing the original boot_sector information to be lost. The resulting FAT file system was still recognized by GNU/Linux, but not recognized by the proprietary Windows operating system. The problem with Windows FAT32 recognition was introduced with: Fix filesystem detection on non 512 byte sectors 80678bdd957cf49a9ccfc8b88ba3fb8b4c63fc12 Fix by removing the extra boot_sector memory allocation. Note that since parted-3.0 another code path to the extra memory allocation of fat_create(...) via ped_file_system_create(...) is inaccessible. In an effort to maintain the ability to re-instate the code, add a new boot_sector memory allocation where it is needed in the alternate code path. GNU bug report logs - #22266 [libparted] jump instruction and boot code is corrupted with random bytes after fat is resized http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22266 2016-04-12 Brian C. Lane parted: Display details of partition alignment failure (#726856) When alignment for a new partition fails it isn't always obvious why it failed. This adds printing the reason for the failure, in the form of: start % grain != offset This modifies align-check in interactive mode to print the alignment the error details if it isn't aligned. Script mode behavior is unchanged. Also cleanup pointer usage and handle asprintf failure by using a constant string in the error report - "unknown (malloc failure)". 2016-04-12 Brian C. Lane docs: Add list of filesystems for fs-type (#1311596) Add the most common filesystem types to the parted manpage. Resolves: rhbz#1311596 2016-04-12 Brian C. Lane Add libparted-fs-resize.pc Add a pkgconfig file for the filesystem resize library. 2016-04-10 Steven Lang Use disk geometry as basis for ext2 sector sizes. When creating the geom for probed ext2 based filesystems, the size was being reported in 512 byte sectors, regardless of what the actual sector size of the device is. 2016-04-10 Phillip Susi parted: fix the rescue command The rescue command often failed to locate a filesystem due to it leaving cylinder alignment on, which snapped the allowed bounds of the filesystem down to the next lower cylinder boundary, causing the detected filesystem to be rejected due to not fitting. 2016-03-18 David Cantrell Use BLKSSZGET to get device sector size in _device_probe_geometry() Seen on certain newer devices (such as >32G SDHC memory cards), the HDIO_GETGEO ioctl does not return useful information. The libparted code records hardware and bios reported geometry information, but all of that is largely unusable these days. The information is used in the PedConstraint code for aligning partitions. The sector count is most useful. Rather than only trying HDIO_GETGIO, first initialize the bios_geom fields to 0 and then use BLKSSZGET to capture the sector size. If that fails, try HDIO_GETGEO. And if that fails, raise a warning and fall back on the library's default sector size macro. This problem showed up on Raspberry Pi devices where users were attempting to grow a partition to fill the SDHC card. Using the optimal_aligned_constraint returned invalid geometry information (98703359 instead of 124735488 sectors). The issue was reported here: https://github.com/fedberry/fedberry/issues/8 And to the pyparted project: https://github.com/rhinstaller/pyparted/issues/25 I've applied this patch locally to parted, rebuilt, and reinstalled it and it is working correctly for the problem SDHC cards. 2016-03-07 Mike Fleetwood tests: t3000-resize-fs.sh: Add very deep directory Create 500 deep directory tree, with longest name of 4000 characters, to the file system being resized to test the fix to prevent crash when resizing a FAT file system with such a long path. 2016-03-07 Mike Fleetwood lib-fs-resize: Prevent crash resizing FAT with very deep directories Resizing a FAT file system crashes in libparted/fs/r/fat/count.c flag_traverse_dir() if the length of any path name in the file system overflows the 512 byte file_name local buffer. Increase buffer to 4096, PATH_MAX on Linux. Reported in https://bugzilla.gnome.org/show_bug.cgi?id=762448 2016-02-09 Viktor Mihajlovski fdasd.c: Safeguard against geometry misprobing Fixes an issue with parted print being run against a logical volume realised by extents on a physical volume residing on a DASD. We must make sure that geometry, device blocksize and DASD attributes are present before we start format verifications If any of it is missing this is not a DASD. 2015-10-29 Colin Watson parted: fix build error on s390 The preceding dasd probing patches have introduced a compile error when building with blkid support. Fixed by reordering function definitions. 2015-10-27 Viktor Mihajlovski dasd: enhance device probing Probe for all device/transport types as every block device could be a DASD on s390. Since the calculation of the minimum and optimum alignment is different between DASDs and common fixed block disks we need a means other than dev->type == PED_DEVICE_DASD. For that purpose a static function _ped_device_like_dasd() offering a DASD detection heuristic has been added to arch/linux.c. By always providing arch-specific alignment functions the need for DASD-specific code could be removed from device.c. Observe fdasd_get_geometry return code for proper error handling. Remove the obsolete API check as we no longer require the DASD-specific IOCTLs. Acked-by: Stefan Haberland 2015-10-27 Viktor Mihajlovski fdasd: geometry handling updated from upstream s390-tools Remove the necessity for DASD-specific ioctls for partition handling. This allows to correctly handle DASD-backed virtio block devices. Note that this is necessary because virtio is just the transport. A DASD, even if provided via virtio, still has it's unique characteristics, which means that only traditional DASD partition table formats can be used (no MBR, GPT, or similar). Use bzero for initialization to make sure all struct members are properly cleared. Also changed partition list handling code to be more similar to upstream s390-tools fdasd. Further, enhanced error handling capabilities by providing a return code by fdasd_get_geometry. Code is largely backported from s390-tools project. Acked-by: Stefan Haberland 2015-10-09 Brian C. Lane tests: Use wait_for_dev_to_ functions Recent changes to udev have made some long-standing problems appear more frequently. udev executes various actions when changes are made to devices. Sometimes this can result in device nodes not appearing immediately. Other times it can result in EBUSY being returned. This patch only addresses devices that are slow to appear/disappear. It is best to use the wait_for_dev_to_appear_ and wait_for_dev_to_disappear_ functions than to test for existance. These will loop and wait for up to 2 seconds for it to appear. This also changes t9041 to fail if mkfs doesn't work since using skip here may hide cases when the device node doesn't appear. 2015-10-09 Brian C. Lane libparted: Use read only when probing devices on linux (#1245144) When a device is opened for RW closing it can trigger other actions, like udev scanning it for partition changes. Use read only for the init_* methods and RW for actual changes to the device. This adds _device_open which takes mode flags as an argument and turns linux_open into a wrapper for it with RW_MODE. _device_open_ro is added to open the device with RD_MODE and increment the open_counter. This is used in the init_* functions. _device_close is a wrapper around linux_close that decrements the open_counter and is used in the init_* functions. All of these changes are self-contained with no external API changes. The only visible change in behavior is that when a new PedDevice is created the device is opened in RO_MODE instead of RW_MODE. Resolves: rhbz#1245144 2015-08-07 Brian C. Lane libparted: Fix misspelling in hfs exception string 2015-08-07 Brian C. Lane libparted: Stop converting . in sys path to / In _probe_sys_block it claimed that ! and . are replaced by / in sys paths, but according to the kernel code only ! is replaced (for cciss devices). This is now causing problems with libnvdimm devices, the details are here: https://git.kernel.org/cgit/linux/kernel/git/djbw/nvdimm.git/tree/Documentation/nvdimm/nvdimm.txt?h=libnvdimm-for-next 2015-08-05 Amarnath Valluri libparted: Fix possible memory leaks * libparted/fs/r/fat/resize.c(fat_convert_directory): Possible leak of sub_old_dir_trav or sub_new_dir_trav in error case. * libparted/fs/r/fat/resize.c(fat_construct_converted_tree ): Possible leak of new_trav_info or old_trav_info in error case. 2015-08-03 Amarnath Valluri libparted: Fix memory leaks * libparted/fs/r/hfs/hfs.c(hfsplus_resize): Don't leak embedded_geom when volume resizing failed. * libparted/fs/fat/fat.c(fat_create): Don't leake fs in-case of fat_write_clustor failuer. * libparted/arch/linux.c(_kernel_get_partition_start_and_length): Don't leak dev_fd file descriptor. UI: Avoid memory leaks. * parted/ui.c(command_line_get_sector): Don't leak input string. * parted/ui.c(command_line_prompt_words): Don't leak _def string in opt script mode. 2015-07-13 Brian C. Lane parted: Fix crash with name command and no disklabel (#1226067) A typo (the last I think) from commit 7eac058 wasn't properly checking the result of ped_disk_new so it could crash if there was no disklabel on the device. 2015-07-13 Alexander Todorov Fwd: [PATCH 2/2] add verbose test documentation merge HACKING and README-hacking 2015-07-02 Sergei Antonov mac: copy partition type and name correctly Use strncpy() instead of strcpy() to copy partition name and type. This prevents possible buffer overflow, because the source string occupies up to 33 bytes with a terminating null. Static analysis tools complain about the code as it is now: Function: _generate_raw_part Destination buffer too small string_overflow: You might overrun the 32 byte destination string part_map_entry->type by writing 33 bytes from mac_part_data->system_name (Destination buffer too small, line 933) Cc: Sabas Rosales, Blanca E 2015-06-26 Brian C. Lane libparted: BLKPG_RESIZE_PARTITION uses bytes, not sectors (#1135493) This results in the extended partition vanishing after adding another partition. Resolves: rhbz#1135493 2015-06-26 Brian C. Lane tests: Make sure the extended partition length is correct (#1135493) parted tells the kernel the wrong length when reporting a resize of an extended partition. Make sure the length is 2 for 512b sectors and 1 sector for larger. 2015-06-24 Brian C. Lane doc: Fix url for LWN article Removed an extra http:// from it. 2015-06-24 Alexander Todorov tests: Fall back to C.UTF-8 if no en_US.utf8 available Not all distributions (Fedora) have C.UTF-8 so first try en_US.utf8 and fall back to it. This may still fail if neither exist. * tests/t0251-gpt-unicode.sh: Test for en_US and fall back to C.UTF-8 2015-06-22 Felix Janda libparted/fs/xfs/platform_defs.h: Include for loff_t This is needed for compilation with musl libc Suggested-by: Travis Tilley 2015-06-22 Felix Janda libparted/arch/linux.c: Compile without ENABLE_DEVICE_MAPPER 2015-03-23 Brian C. Lane Update manpage NAME so whatis will work 2015-02-06 Brian C. Lane libparted: device mapper uses 512b sectors device mapper doesn't use the device's sector size when creating a table. It always uses 512b units. This causes partitions to be created 8x smaller than expected on devices with 4906b sectors. 2015-02-05 Brian C. Lane tests: Add a test for device-mapper partition sizes device-mapper uses 512b sector units, not device specific sector sizes. This test ensures that the correct partition size is created, no matter what the device's sector size is. 2015-01-13 Phillip Susi parted: don't crash in disk_set when disk label not found Due to a typeo in commit 7eac058 "parted: don't reload partition table on every command", the disk_set command would crash if a disk label was not found. 2014-11-10 Brian C. Lane tests: Change minimum size to 256MiB btrfs on ppc64 wants 136MiB so expand the minimum temp filesystem size for the t1700-probe-fs test. 2014-10-27 Mike Fleetwood tests: t3000-resize-fs.sh: Add requirement on mkfs.vfat Add test skipping requirement on mkfs.vfat for the FAT32 and FAT16 file system resizing tests. This matches existing test skipping requirement on mkfs.hfs for the hfs+ file system. * tests/t3000-resize-fs.sh: Also correct skip_test_ to skip_. * tests/t-lib-helpers.sh: Also update message for requirement of hfs. 2014-10-27 Mike Fleetwood tests: t3000-resize-fs.sh: Add FAT16 resizing test Add FAT16 resizing test so that we don't regress again. 2014-10-27 Mike Fleetwood lib-fs-resize: Prevent crash resizing FAT16 file systems Resizing FAT16 file system crashes in libparted/fs/r/fat/resize.c create_resize_context() because it was dereferencing NULL pointer fs_info->info_sector to copy the info_sector. Only FAT32 file systems have info_sector populated by fat_open() -> fat_info_sector_read(). FAT12 and FAT16 file systems don't have an info_sector so pointer fs_info->info_sector remains assigned NULL from fat_alloc(). When resizing a FAT file system create_resize_context() was always dereferencing fs_info->info_sector to memory copy the info_sector, hence it crashed for FAT12 and FAT16. Make create_resize_context() only copy the info_sector for FAT32 file systems. Reported by Christian Hesse in https://bugzilla.gnome.org/show_bug.cgi?id=735669 2014-09-20 Heiko Becker libparted: also link to UUID_LIBS * libparted/Makefile.am (libparted_la_LIBADD): Add UUID_LIBS. This fixes building parted with the gold linker. 2014-07-28 Phillip Susi maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.2 * NEWS: Record release date. 2014-07-27 Phillip Susi Bump library REVISION number for release tests: don't require en_US locale in t0251-gpt-unicode.sh Switch from en_US.UTF-8 to C.UTF-8 so the test does not fail on systems that do not have the en_US locale installed. 2014-06-23 Jim Meyering maint: correct a POT-file updating rule * doc/C/Makefile.am (updatepo): If there is no po/$name.pot, create an empty one. Reported by Philip Susi. 2014-06-15 Phillip Susi tests: fix t9020-alignment.sh This test was refering to print-alignment by absolute path, which broke building with a different object directory, causing make distcheck to fail. Document resizepart command parted: Add stub resize command for backward compatibility To make sure that older scripts trying to use the resize command do not accidentally run the new resizepart command by mistake, this undocumented stub command will throw an error if called. parted: Allow undocumented commands Have command_print_summary print nothing if the command summary is NULL. This allows for a command to be registered, but not documented in the output of help. parted: make _partition_warn_busy actually a warning instead of an error This function was throwing a PED_EXCEPTION_ERROR with only the PED_EXCEPTION_CANCEL option. Converted to a PED_EXCEPTION_WARNING with the option to continue anyhow. libparted: Add support for partition resize When resizing a partition ( same partition number, same start sector, different end sector ), try to use the new BLKPG_RES_PARTITION request to update the kernel partition table with the new size. Also handle resizing devmapper targets. 2014-06-15 Petr Uzel tests: excersise resize command a lot of TODOs parted: add resizepart command Add resizepart command to resize ( change the end position ) an existing partition. Note that it does nothing to a filesystem in the partition. 2014-06-15 Brian C. Lane Fix python test scripts for distribution make distcheck was failing because these scripts were not being included. Make them both executable and and add the path to the tests that use them. They also need to be included in the distribution so update Makefile.am * tests/Makefile.am: Add python test scripts * tests/gpt-header-move.py: rename to gpt-header-move and make it executable * tests/msdos-overlap.py: rename to overlap.py * tests/t0282-gpt-move-backup.sh: add path to scripts and use new name * tests/t0283-overlap-partitions.sh: same 2014-06-15 Brian C. Lane tests: check name when duplicating Create a second partition with a name when supported by the disk label. Check to make sure that the duplicate has copied over the name. The goal with this was to try to catch the bug fixed by the previous commit but I was unable to make it fail. But this should improve our test coverage anyway. * tests/duplicate.c: Add a partition name test. 2014-06-15 Brian C. Lane libparted: Fix part dupe with empty name It was setting the original translated_name to 0, not the new copy. * libparted/labels/gpt.c (gpt_partition_duplicate): fix empty name 2014-05-28 Jim Meyering tests: use test's "=" operator, not "==" * tests/t1700-probe-fs.sh: Avoid "make syntax-check" error: s/==/=/ tests: avoid false-positive failure due to symlink * tests/t6000-dm.sh (sanitize): Helper function. Before this change, this test would fail due to difference between absolute name and symlink-including names in "parted print" output maint: fix "make syntax-check" nits * doc/parted.texi: Update copyright year to 2014. * tests/gpt-header-move.py: Remove empty line at EOF. * tests/t0281-gpt-grow.sh: Correct reversed args to compare. * tests/t0282-gpt-move-backup.sh: Likewise. * libparted/labels/gpt.c (gpt_partition_set_name): Change "Can not" to "failed to" in diagnostic. (gpt_partition_get_name): Likewise. * tests/t1102-loop-label.sh (dev): Remove trailing space in here document that creates expected output, and strip that same trailing space from actual output. * libparted/fs/jfs/jfs.c: Do not cast alloca return value. * libparted/fs/reiserfs/reiserfs.c: Likewise. * libparted/fs/xfs/xfs.c: Likewise. 2014-05-27 Brian C. Lane tests: Use mkfs.xfs to create files (#1101112) On s390 there is a bug with mkfs.xfs and pre-existing files. Work around it by creating the file directly with mkfs.xfs. This also works on other arches. * tests/t1700-probe-fs.sh: Check for xfs and use direct file creation * tests/t4100-dvh-partition-limits.sh: Use mkfs.xfs -dfile * tests/t4100-msdos-partition-limits.sh: Use mkfs.xfs -dfile 2014-05-27 Brian C. Lane tests: Add ntfs vfat hfsplus to t1700 probe test Add some new filesystems to test. Adjust how mkfs.* tests, since some of them don't support -V, and add fsname so that the printed filesystem name doesn't have to match the type. * tests/t1700-probe-fs.sh: Add new filesystems to test 2014-05-25 Jim Meyering maint: run "make update-copyright" maint: remove doubled word: s/on on/on/ * NEWS: Remove doubled-word detected by "make syntax-check". gnulib: update submodule to latest * gnulib: Update module to latest. * bootstrap: Update from gnulib. 2014-05-25 Sergei Antonov libparted: mac: support sector size > 512 correctly This patch fixes several problems found when trying to do Apple Partition Map on a 4K-sector iPod. The problems happened because of unneeded conversion between physical sectors and 512-byte units. For devices with sector 512 the conversion did no harm, for others it did. List of problems (all are gone with the patch): * Partition in OS X, connect to Linux, run "parted print". "Error: Can't have a partition outside the disk!" is shown. Every partition is displayed 8 times (4k/512) bigger its real size. * Exec "mktable mac", connect to OS X. The drive's partitioning scheme is not recognized. * mkpart creates partitions 8 times (4k/512) smaller than requested. 2014-05-22 Phillip Susi tests: test loop labels Verify previous fixes to loop labels. libparted: don't trash filesystem when writing loop label If you deleted the fake partition on a loop label, loop_write() would write the loop signature to the device, zeroing out all other bytes in the first sector. When the disk contained an ext[234] filesystem and was using 2k sectors, this would trash the super block residing in the 1-2kb part of the sector causing the disk to become unrecognized. Instead, read the existing sector and only modify the first few bytes that contain the loop label. libparted: give correct partition device name on loop labels ped_partition_get_path() was returning "/dev/foo1" instead of "/dev/foo" on loop labels. This caused gparted to run tools like mkfs on a device node that did not actually exist. partprobe: do not skip loop labels Partprobe was not syncing loop labels. This resulted it failing to remove existing partitions when switching to a loop label. libparted: don't create partition on loop label The loop label represents an unpartitioned disk, but creates a dummy partition to represent the whole disk. This dummy partition was actually being loaded into the kernel. Don't do that. 2014-05-22 Phillip Susi libparted: fix loop labels to not vanish The loop label type was using the existence of a partition as a proxy for a filesystem being detected, and loop_write() would try to write a loop signature if there was no filesystem, and erase it if there was. Because of this, creating a partition without writing a filesystem to it caused loop_write to erase the loop label. There seems to be no reason to bother erasing the loop label if it is still present along with a filesystem signature, so don't bother with this, and actually check to see if a filesystem is detected in the partition rather than using the existence of a partition to decide if writing the loop signature is needed. Finally, since there is no way to preserve the existence of a partition with no filesystem in it, have loop_read() always create a partition, even if no filesystem is detected. 2014-05-22 Phillip Susi libparted: remove all old partitions, even if new label allows less We were limiting partition sync operations to the lesser number allowed by the device, or the label. This meant that when creating a new label over an old label that had more partitions than the new one allows, the higher partitions would not be removed. Use the greater of the two values for the remove pass, and the lesser for the add. libparted: remove old partitions *first* before adding new ones "libparted: avoid disturbing partitions" put the remove of the old partition in second pass. If you simultaneously removed partitions 1 and 2, and created a new partition #1 that overlapped the previous second partition, the sync would fail because it would try to create the new, larger partition #1 before removing the old partition #2. libparted: don't detect fat and ntfs boot sectors as dos MBR fat and ntfs boot sectors are very similar to an MBR so if you had one of these filesystems on an unpartitioned disk, parted detected them as a dos partition table. Have the dos label code call the fat and ntfs filesystem probes and if they recognize the sector ( their tests are more stringent ) then don't claim it as a dos label. 2014-05-22 Phillip Susi parted: don't reload partition table on every command gpt was using a static local variable to suppress repeatedly reporting an error if you chose to ignore it. This is incorrect as the variable is global to all disks, and ignoring the error on one should not suppress its reporting on another. Moving the flag to the PedDisk object made it effectively useless because parted was destroying the PedDisk and reloading the partition table on every command. Parted has been reworked to cache the PedDisk once loaded, and only discard it when changing disks, or creating a new disklabel. 2014-05-22 Phillip Susi libparted: fix fat resize The changes to fix filesystem detection on non 512 byte sector sizes broke fat filesystem resizing. 2014-05-19 Brian C. Lane GPT strings are UCS-2LE not UTF-16 There was a problem using UTF-16, it was writing the Byte Order Mark before the string which caused problems with older versions of parted reading the partition name. The test was skipping these 2 bytes when checking the written string. * libparted/labels/gpt.c: Switch to UCS-2LE for GPT Partition names * tests/t0251-gpt-unicode.sh: Update the test 2014-04-29 Brian C. Lane Update NEWS with new DASD features. * NEWS: New DASD support 2014-04-29 Petr Uzel dasd: avoid usage of uninitialized data In ped_partition_new(), disk_specific data of PedPartition structure is allocated (via dasd_partition_new()). This data is later used uninitialized in dasd_partition_set_system(). * libparted/labels/dasd.c (dasd_partition_new): Zero out allocated disk_specific data. 2014-04-29 Nageswara R Sastry libparted: mklabel to support EDEV DASD Fixed Block Access (FBA) DASDs are mainframe-specific disk devices which are layed out as a sequence of 512-byte sectors. This patch adds support for mklabel to properly handle FBA devices. libparted: Avoid dasd as default disk type while probe This patch avoids setting 'dasd' as a default disk type for 'disk image file' at the time of probe. libparted: mklabel to support EAV DASD Extended Address Volume (EAV) DASDs are ECKD DASDs with more than 65520 cylinders. This patch adds support for mklabel to properly handle unformatted EAV DASDs. 2014-04-29 Nageswara R Sastry libparted: add support for EAV DASD partitions Extended Address Volume (EAV) DASDs are ECKD DASDs with more than 65520 cylinders. This patch adds support for recognizing and modifying partitions on EAV DASDs to Parted. The changes are based on the EAV support added to version 1.8.1 [1] of the s390-tools package. [1] http://www.ibm.com/developerworks/linux/linux390/s390-tools-1.8.1.html 2014-04-29 Nageswara R Sastry libparted: add support for implicit FBA DASD partitions Fixed Block Access (FBA) DASDs are mainframe-specific disk devices which are layed out as a sequence of 512-byte sectors. In contrast to ECKD DASDs, these disks do not require formatting and resemble the LBA layout of non-mainframe disks. Despite this resemblance, the Linux kernel applies special handling during partition detection for FBA DASDs, resulting in a single, immutable partition being reported. While actual FBA DASD hardware is no longer available, the z/VM hypervisor can simulate FBA DASD disks, backed by either ECKD or SCSI devices. This patch adds support for recognizing FBA DASD partitions to parted. 2014-04-18 Phillip Susi Fix filesystem detection on non 512 byte sectors Enable probing for filesystems with non 512 byte sectors, and fix up each filesystem to correctly handle that. Remove unused field from the fs type structure listing acceptable sector sizes. tests: fix t2310-dos-extended-2-sector-min-offset.sh This test was ignoring the requested sector size and always using 512 bytes per sector. Fix it to use the requested sector size. tests: fix t1700 bb181a7e: "tests: Use force for xfs in t1700 and a larger file" caused the previous filesystem signatures to be left in the image file causing mkfs.nilfs2 to complain that there is already an xfs filesystem there, and hang the test suite waiting for an answer to proceed or not. Remove the file between filesystems so it is recreated cleanly again. libparted: remove last_usable_if_grown Commit 3398e82a: "libparted: Use common function to calculate PTE sectors" removed usage of the last_usable_if_grown variable, resulting in an error because it is now unused but still defined. 2014-04-17 Brian C. Lane tests: t1700 change count to seek Fix a typo when changing to sparse images. * tests/t1700-probe-fs.sh: count should be seek. 2014-04-16 Brian C. Lane tests: Use force for xfs in t1700 and a larger file Also use sparse files that are (with 512B blocks) 128M so that they are large enough for all the filesystems. * tests/t1700-probe-fs.sh: Make changes. 2014-04-10 Ming Liu libparted: fix several integer overflows with dvh labels Integer overflows was found in libparted/labels/dvh.c, while attemptting assign unsigned int values to int types in some places. Defined by unsigned int instead. * libparted/labels/dvh.h: Change int to unsigned int 2014-04-10 Brian C. Lane testing: Use little-endian packing in gpt tests Fix gpt-header-move.py and gpt-header-munge to use little endian when packing and unpacking. This allows us to turn the t0210 and t0211 tests back on for big-endian systems. * tests/gpt-header-move.py: Use little endian for pack/unpack * tests/gpt-header-munge: Same * tests/t-lib-helpers.sh: Add requires_64bit_ that checks for x86_64 and ppc64 * tests/t0210-gpt-resized-partition-entry-array.sh: Remove x86_64 test * tests/t0211-gpt-rewrite-header.sh: Same 2014-04-08 Brian C. Lane tests: Use msdos-overlap to setup t0283 xxd isn't present in minimal build systems, as it is part of vim. Change to using a simple python script to mangle the msdos disklabel for the test. * tests/msdos-overlap.py: New file * tests/t0283-overlap-partitions.sh: Use msdos-overlap.py 2014-04-08 Brian C. Lane tests: Add emit_superuser_warning for gpt tests When parted runs without script mode it will print a warning about not being superuser. Add the library call to add this to expected output from the tests. * tests/t0281-gpt-grow.sh: Add emit_superuser_warning * tests/t0282-gpt-move-backup.sh: Add emit_superuser_warning * tests/t0283-overlap-partitions.sh: Add emit_superuser_warning 2014-04-08 Brian C. Lane libparted: Use common function to calculate PTE sectors Use _ptes_sectors in _parse_header's calculation to determine if the disk has been grown. * libparted/labels/gpt.c (_parse_header): use _ptes_sectors 2014-04-08 Brian C. Lane libparted: Fix check for backup header location Add a couple of helper functions for calculating the partition table entry size (in sectors) and for guessing the end of the disk based on the LastUsableLBA and the Partition Table Entry size. The backup header should be either at the end of the disk, or at what the primary header thinks is the end of the disk. Prompt to fix the backup header if it is located any other place. * libparted/labels/gpt.c (_ptes_sectors): New function (_hdr_disk_end): New function (gpt_read): Use new function to test for pri's idea of end of disk 2014-03-05 Gustavo Zacarias ui: switch to new-style readline typedef The CPPFunction typedef (among others) have been deprecated in favour of specific prototyped typedefs since readline 4.2 (circa 2001). It's been working since because compatibility typedefs have been in place until they where removed in the recent readline 6.3 release. Switch to the new style to avoid build breakage. 2014-03-05 Phillip Susi libparted: sync partitions > 16 The linux partition sync code was hard coded to only flush the first 16 partitions. 2014-03-02 Phillip Susi libparted: don't require a system id string Historically the system ID field of a fat boot sector contains a string identifying the OS that formatted it. It appears that some recent versions of Windows have stopped bothering with this. Stop requiring this string to recognize fat as valid. 2014-03-02 Brian C. Lane tests: Restrict gpt-header-munge to little-endian systems gpt-header-munge uses perl to manipulate the gpt header for the test. It only works on 64 bit little-endian systems so restrict it to x86_64 only. * tests/t0210-gpt-resized-partition-entry-array.sh: Skip if not x86_64 * tests/t0211-gpt-rewrite-header.sh: Skip if not x86_64 2014-03-02 Brian C. Lane tests: Add btrfs and xfs to the fs probe test * tests/tests/t1700-probe-fs.sh: Add btrfs and xfs 2014-03-02 Brian C. Lane libparted: Recognize btrfs filesystem Add support for showing 'btrfs' in the 'file system' column. Also allows the used to enter btrfs as the fs type. It doesn't really do anything -- just sets the partition type to linux. * NEWS (Changes in behavior): Mention it. * doc/parted.texti: Document btrfs fs. * (libparted/fs/Makefile.am): Add btrfs.c * (libparted/fs/btrfs/btrfs.c): Probe for btrfs * (libparted/libparted.c): Register btrfs 2014-03-02 Brian C. Lane libparted: Add UEFI System Partition flag. This adds support for the ESP partition type on MS-DOS. It also aliases it to the boot flag on GPT which sets the ESP GUID type. * NEWS (New Features): Mention it. * doc/C/parted.8: Document esp flag. * doc/parted.texti: Document esp flag. * include/parted/disk.in.h (_PedPartitionFlag): Add PED_PARTITION_ESP flag * libparted/disk.c (ped_partition_flag_get_name): Add esp flag * libparted/labels/dos.c (DosPartitionData): Likewise (raw_part_parse): Likewise (msdos_partition_new): Likewise (msdos_partition_duplicate): Likewise (msdos_partition_set_system): Likewise (clear_flags): Likewise (msdos_partition_set_flag): Likewise (msdos_partition_get_flag): Likewise (msdos_partition_is_flag_available): Likewise * libparted/labels/gpt.c (gpt_partition_set_flag): Add PED_PARTITION_ESP (gpt_partition_get_flag): Likewise (gpt_partition_is_flag_available): Likewise 2014-03-02 Brian C. Lane libparted: Add Intel Rapid Start Technology partition flag. This adds support for the irst partition type flag. Sets the type to 0x84 on MS-DOS and D3BFE2DE-3DAF-11DF-BA-40-E3A556D89593 on GPT. * NEWS (New Features): Mention it. * doc/C/parted.8: Document irst flag. * doc/parted.texti: Document irst flag. * include/parted/disk.in.h (_PedPartitionFlag): Add PED_PARTITION_IRST flag * libparted/disk.c (ped_partition_flag_get_name): Add irst flag * libparted/labels/dos.c (DosPartitionData): Likewise (raw_part_parse): Likewise (msdos_partition_new): Likewise (msdos_partition_duplicate): Likewise (msdos_partition_set_system): Likewise (clear_flags): Likewise (msdos_partition_set_flag): Likewise (msdos_partition_get_flag): Likewise (msdos_partition_is_flag_available): Likewise * libparted/labels/gpt.c: Add PARTITION_IRST_GUID (GPTPartitionData): Add irst flag (_parse_part_entry): Likewise (gpt_partition_new): Likewise (gpt_partition_set_system): Likewise (gpt_partition_set_flag): Likewise (gpt_partition_get_flag): Likewise (gpt_partition_is_flag_available): Likewise 2014-03-02 Brian C. Lane tests: rewrite t6001 to use /dev/mapper This test began failing because using a private copy of /dev/mapper confuses the system. This fixes that and generally cleans up the test. tests/t6001.sh: update to use /dev/mapper directly 2014-03-02 Brian C. Lane libparted: don't canonicalize /dev/md/ paths (#872361) This is the same issue we have with /dev/mapper/ paths that was fixed in commit c1eb485b9fd8919e18f192d678bc52b0488e6ee0. When libparted is used to setup the device the symlink should be used to reference it, not the backing device name which could change. * libparted/device.c (ped_device_get): Don't canonicalize names that start with "/dev/md/". 2014-03-02 Brian C. Lane tests: Make sure dm UUIDs are not erased * tests/t6005-dm-uuid.sh: Make sure dm UUIDs are not erased libparted: preserve the uuid on dm partitions (#832145) * libparted/arch/linux.c (_dm_add_partition): Set the uuid if there was one. 2014-03-02 Brian C. Lane libparted: use dm_udev_wait (#698121) This is based on Peter Rajnoha's patch to use dm_udev_wait to synchronize with udev. This requires libdevmapper v1.02.39 and higher. mailing list thread: https://lists.gnu.org/archive/html/bug-parted/2010-09/msg00007.html * libparted/arch/linux.c (_dm_task_run_wait): New function (_is_dm_major): Add cookie and change call to _dm_task_run_wait (_is_dmraid_device): Same (_dm_is_part): Same (dm_canonical_path): Same (_dm_remove_partition): Same (_dm_get_partition_start_and_length): Same (_dm_add_partition): Same (linux_new): Enable udev sync support 2014-02-25 Brian C. Lane tests: test creating 20 device-mapper partitions (#803108) * tests/t6004-dm-many-partitions.sh: Make sure > 17 partitions appear in device mapper. libparted: copy pmbr_boot when duplicating GPT disk * libparted/labels/gpt.c (gpt_duplicate): copy pmbr_boot flag 2014-02-24 Phillip Susi Fix help text for disk_{set,toggle} Fix the help text to show *disk* flags instead of partition flags. 2013-12-23 Phillip Susi bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly gpt.c was simply truncating the UTF-16 characters stored in the partition name field to 8 bits. This corrupted non ascii characters which later resulted in parted crashing in strlist.c trying to convert the now invalid multi byte characters to wchar. gpt.c will now properly convert the UTF-16 to the current locale encoding. 2013-11-23 Phillip Susi libparted: make sure not to treat percentages as exact If 1% of the drive size worked out ot be an even power of two, it would trigger the exact placement. Add an exception for the percent units. 2013-11-23 Daniel Battaiola Kreling GPT: add support for PReP GUID PReP (PowerPC Reference Platform) boot partition is the first partition used in PowerPC platform for containing the bootable kernel or bootloader. The firmware searches for this partition and jumps to it for booting. So far no GUID was specified for this partition type and hence booting from GPT disk was not supported on this platform. A new GUID 9e1a2d38-c612-4316-aa26-8b49521e5a8b for PReP partition is proposed to be included in GPT. 2013-11-23 Phillip Susi Fix test compilation The tests were not being linked against libpthread but were using it, and recent versions of gcc refuse to implicitly pull it in. libparted: avoid disturbing partitions The partition sync logic was first removing all partitions, then trying to re-add them. This resulted in many udev events triggering annoying behavior like auto mounting. Refactor the code to avoid removing and re-adding unmodified partitions. Revert "linux-commit: do not unnecessarily open partition device nodes" This reverts commit 2a6936fab4d4499a4b812dd330d3db50549029e0. The commit disabled flushing the block buffer caches on the partition nodes to ensure cache consistency on 2.6 kernels, supposedly because this was no longer required. It appears this was incorrect, and the caches DO still need flushed, otherwise a new fs written to the partition device does not show up in the disk device cache, causing parted to still identify the old fs. libparted: allow some common errors to be ignored Partitions that overlap or extend beyond the end of the disk are common errors that usually result in people having to use other tools to correct because parted refuses to operate when it sees them. Change these errors to allow you to ignore them and use parted to correct the problem. 2013-11-23 Phillip Susi libparted: fix gpt end of disk handling There are two checks for problems with the end of disk. The first checks to make sure that the backup gpt is actually at the end of the disk as it should be. The second checks to see that the gpt's idea of where the disk ends is correct. The handling of the backup gpt location was wrong because if you chose not to fix the error, then as soon as you made any changes the backup would be written to the end of the disk anyhow, only the previous backup would not be zeroed. This patch fixes the write path to put the backup gpt where the gpt says it goes, not where we think the disk ends. This allows you to choose not to fix the problems, and the backup gpt will be written to the same place it was before, not the new end of disk. 2013-11-23 Phillip Susi libparted: handle logical partitions starting immediately after the EBR _blkpg_add_partition() set the length of the extended partition to 2 sectors to allow LILO to be installed there, beacuse the linux kernel does this. If a logical partition used that second sector, adding it would fail beacuse of the overlap. Now _blkpg_add_partition() will limit the length to only the first sector if the second is used by a logical partition. Previously parted did create the partition table, and after a reboot, the kernel would recognize the table, and happily create the extended partition as 2 sectors long, thus overlapping the logical partition, but when parted tried to recreate the same table with BLKPG, the kernel rightly rejected it. 2013-11-23 Phillip Susi gpt: Revert small device commits The following commit broke the position of the LastUsableLBA: 48f236f9: gpt: permit "mklabel gpt" on a 67-sector device It introduced an off by one error, leaving LastUsableLBA pointing to the first sector of the backup partition table instead. This effectively reverts that commit, as well as adjusting the subsequent commits to instead use 68 sectors as the minimum length. I believe this is the minimum legal size as at 67 sectors, there is no valid value for FirstUsableLBA and LastUsableLBA. 2013-11-23 Phillip Susi tests: t6003-dm-hide: don't hang on exception If the parted -l found any exceptions, it would print the prompt, which was redirected to the log, then hang waiting for input, which never came. Use script mode to disable the prompts. parted: fix EOF and ctrl-c handling feof() seems to not detect EOF after readline() hits it, so parted went into an infinite loop prompting for input on EOF. Change test to use the got_ctrl_c variable instead, which is set when readline hits EOF and returns NULL. This also makes parted properly exit on ctrl-c. 2013-10-09 Jim Meyering bootstrap: update to latest from gnulib 2013-10-09 Jonathan Liu dos: improve MBR signature generation Using tv_usec in struct timeval from gettimeofday() doesn't provide enough precision to fill an unsigned 32-bit integer and isn't really random. It it always less than one million when using the GNU C library while an unsigned 32-bit integer ranges between 0 and 4294967295. In FAT filesystem creation, parted already uses a better random generator, so move that code into a common function and use it for MS-DOS MBR signature generation. * libparted/fs/r/fat/fat.c (_gen_new_serial_number): Remove. (fat_create): Use generate_random_uint32 instead of _gen_new_serial_number. * libparted/labels/dos.c (generate_random_id): Remove. (msdos_write): Use generate_random_uint32 instead of generate_random_id. * libparted/labels/misc.h (generate_random_uint32): New function. Created from _gen_new_serial_number in libparted/fs/r/fat/fat.c with additional check to avoid returning zero, which may be interpreted as no FAT serial number or no MBR signature. 2013-01-06 Jim Meyering maint: avoid new warning/error with gcc-4.8.0 20130105 * configure.ac (WERROR_CFLAGS): Disable -Wsuggest-attribute=format. It was suggesting to apply the gnu_printf attribute to vsnprintf. maint: update all copyright year number ranges Run "make update-copyright". build: update gnulib submodule to latest 2013-01-02 Jim Meyering doc: 1MiB-alignment is not enough for cheap flash drives * doc/parted.texi: Add an example that aligns to 4GiB, and reference Arnd Bergman's LWN article. 2012-10-29 Jim Meyering tests: make t6003-dm-hide work reliably on F17 * tests/t6003-dm-hide.sh: Adjust to work reliably on Fedora 17. 2012-10-29 Phillip Susi libparted: don't probe every dm device in probe_all We were probing every dm device. Only probe dmraid whole disk (non-partition) devices instead. This removes the clutter of LVM logical volumes, and dmraid partitions from the list, which usually do not make sense to partition. * NEWS (Changes in behavior): Mention it. * libparted/arch/linux.c (_is_dmraid_device): New function. (_dm_is_part): Likewise. (_probe_dm_devices): Use the latter. * tests/t6003-dm-hide.sh: New test. * tests/Makefile.am (TESTS): Add it. 2012-10-29 Phillip Susi libparted: remove extraneous blkpg add partition ped exception _blkpg_add_partition was throwing an exception if it failed to add the new partition, in addition to _disk_sync_part_table throwing one, and then bailing out. Instead of bailing out, just log the error for reporting later and continue. libparted: refactor device-mapper partition sync code The device-mapper partition sync code was still using the remove all partitions, then add new partitions method. Refactor to use the same algorithm as regular disks: try to remove all, and ignore any that could not be removed but have not changed. 2012-10-23 Eric Blake build: default to --enable-gcc-warnings in a git tree Anyone building from cloned sources can be assumed to have a new enough environment, such that enabling gcc warnings by default will be useful. Tarballs still default to no warnings, and the default can still be overridden with --disable-gcc-warnings. * configure.ac (gl_gcc_warnings): Set default based on environment. 2012-10-17 Brian C. Lane tests: cleanup losetup usage The unsafe_losetup_ function was failing because losetup didn't recognize that the 'private' /dev/loopX devices were the same as /dev/loopX, it would fail even if one was in use. Switch to using losetup --show which is a cleaner solution. Also use sparse file for loop_setup to save space. * tests/t-lvm.sh (unsafe_losetup_): Remove function. (loop_setup_): Use losetup's --show option instead. Use dd with /dev/null, not /dev/zero. * tests/t6001-psep.sh: Use loop_setup_ rather than losetup --show. 2012-10-17 Jim Meyering maint: regenerate .po, .pot files maint: use $(AM_V_GEN) to cut down on build noise * doc/Makefile.am: Prefix each rule with $(AM_V_GEN). * doc/po4a.mk (dist_man_MANS): Likewise. 2012-10-16 Petr Uzel partprobe: remove partitions when there is no partition table When partprobe detects no partition table on a device, it should tell the kernel to drop partitions on that device, but it did not. * parted/partprobe.c (process_dev): When ped_disk_probe fails, create a dummy (empty) partition table and use that. * NEWS (Bug fixes): Mention it. Addresses: https://bugzilla.novell.com/783419 2012-10-15 Petr Uzel doc: update partprobe manpage * doc/C/partprobe.8: Add long options, REPORTING BUGS section and adjust DESCRIPTION section because it wasn't quite correct. partprobe: remove --no-update long option It was deprecated and scheduled for removal in 2009. * partprobe/partprobe.c (long_options): Remove "no-update" entry. build: .gitignore: ignore tests/fs-resize 2012-10-09 Jim Meyering build: do not rely on automake's AM_TESTS_ENVIRONMENT * tests/Makefile.am (TESTS_ENVIRONMENT): Rename from AM_TESTS_ENVIRONMENT, since it is not honored in automake-1.11.3 after all. This reverts commit v3.1-14-g2bd66d7. For now, I'll leave the following commit that made bootstrap.conf require 1.11.2. Prompted by a report of test failure from Phillip Susi. 2012-10-09 Gilles Espinasse tests: t8001: do not rely on "modprobe loop" Remove 'rmmod loop' and 'modprobe loop max_part=7' commands. The latter command may fail after the first command has run, leaving the machine with no loop support. This happens on my chroot, because: - rmmod does not depend on the availability of the loop module, - modprobe fails, since the kernel compiled inside the chroot is different from the running kernel. Instead, rely on t-lvm loop_setup_ to load the loop module, if required. 2012-10-09 Jim Meyering tests: improve test for partitionable loop devices * tests/init.cfg (require_partitionable_loop_device_): Skip when cat fails. 2012-10-06 Jim Meyering maint: fix an error in the preceding commit log Stefano Lattarini noticed an error in the log for commit v3.1-32-g478e472. Arrange for that error to be fixed in the generated ChangeLog file. * build-aux/git-log-fix: New file. * Makefile.am (gen-ChangeLog): Adjust rule to use it. tests: stop using private "dev" directory for losetup Something about Fedora 17's losetup changed so that using a private dev directory no longer worked. Now, simply use /dev/ directly. * tests/t-lvm.sh: Don't use $G_dev_. Not needed, and actually caused the t6000-dm root-only test to fail on Fedora 17. Also, redirect less to /dev/null: that helps diagnose failure. 2012-10-03 Bob Beers (tiny change) doc: libparted/disk.c: correct doxygen comment typo * libparted/disk.c: s/PedPartition/PedDisk/ 2012-09-29 Jim Meyering tests: clean up tests Use warn_ and $ME_ in place of warn and $ME; remove definitions of the latter two. Remove unused code. * tests/lvm-utils.sh: Remove file. All functions were either unused or duplicated/better in t-lvm.sh. * tests/Makefile.am (EXTRA_DIST): Remove it. * tests/t-local.sh (scsi_debug_setup_): Use echo 1>&2, not warn_, to emit to log file only, not console. The diagnostic it emitted (in verbose mode) was more "informational" than a warning. * tests/t9030-align-check.sh: Use warn_, not warn. * tests/t-lvm.sh: Likewise, and use fail_, not error (undefined!). * tests/t-lib-helpers.sh (device_mapper_required_): Use t-lvm.sh and an explicit lvm_init_root_dir_ in place of lvm-utils.sh. 2012-09-29 Roderick W. Smith add support for a new Linux-specific GPT partition type code * NEWS: Describe the new Linux-specific partition type code and the new msftres flag that can be used to override this type code, should it be necessary. * doc/parted.texi: Describe of the new msftres flag. * include/parted/disk.in.h [_PedPartitionFlag]: Add PED_PARTITION_MSFT_DATA. * libparted/disk.c: Add check for PED_PARTITION_MSFT_DATA, with return of "msftdata", to ped_partition_flag_get_name() * libparted/labels/gpt.c (PARTITION_LINUX_DATA_GUID): Define. [_GPTPartitionData]: New member, "int msftdata". (_parse_part_entry): Set the msftdata flag if and only if the PARTITION_BASIC_DATA_GUID type code is in use; (gpt_partition_new): Use the PARTITION_LINUX_DATA_GUID type as the default type code (gpt_partition_set_system): Set the PARTITION_BASIC_DATA_GUID type code on partitions on which the msftdata flag is set and set PARTITION_LINUX_DATA_GUID as the type by default. Clear the msftdata flag in most tests in gpt_partition_set_flag() (gpt_partition_set_flag): Add test for PED_PARTITION_MSFT_DATA, which sets msftdata and other flags appropriately (gpt_partition_get_flag): Add test for the PED_PARTITION_MSFT_DATA item that returns the status of the msftdata flag (gpt_partition_is_flag_available): Add test for PED_PARTITION_MSFT_DATA item to * tests/t0220-gpt-msftres.sh: Accommodate the fact that now, partition table listings include "msftdata" for file systems of type NTFS and FAT*. For more discussion and justification, see http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10456 2012-09-20 Jim Meyering tests: mac: exercise the just-fixed bug * tests/t0350-mac-PT-increases-sector-size.sh: New test. * tests/Makefile.am (TESTS): Add it. 2012-09-20 Brian C. Lane mac: don't let larger partition-table-specified block size evoke UB For example, in reading a MAC partition table on a 512-byte sector-size disk, _disk_analyse_block_size could find reason to ask if it's ok to increase that to e.g., 2048. Upon a positive reply, we would read 2048 bytes into a 512-byte buffer. * libparted/labels/mac.c (mac_read): If needed, reallocate "buf" to accommodate a new, larger sector size. * NEWS (Bug fixes): Mention it. 2012-09-20 Jim Meyering tests: avoid syntax-check failure for reversed compare args * tests/t0203-gpt-create-on-min-sized-device.sh: Reverse args, so that any diff output (upon failed test) looks sensible. 2012-09-12 Jim Meyering tests: show that small dev now evokes "mklabel gpt" diagnostic * tests/t0203-gpt-create-on-min-sized-device.sh: New test. * tests/Makefile.am (TESTS): Add it. gpt: when "mklabel gpt" fails, always provide a diagnostic * libparted/labels/gpt.c (gpt_alloc): When rejecting a device because it is too small, give a diagnostic, as is done in every other failure path through this function. gpt: permit "mklabel gpt" on a 67-sector device * libparted/labels/gpt.c (gpt_alloc): Correct checks in order to allow creation of a GPT partition table on a 67-sector device. The computation of the "data_end" sector number was one too low. Whereas there are two sectors at the beginning of the disk (pMBR and the GPT header sector), there is only one at the end: the backup GPT header. That (67) is the size of the smallest GPT partition table, allowing for *no* partition table sectors. tests: update t7000-scripting.sh to avoid new FP * tests/t7000-scripting.sh: Use -34s as the endpoint, not -1s, to avoid a spurious difference. Also, remove quoting artifacts. 2012-09-12 Davidlohr Bueso gpt: require first_usable_LBA <= last_usable_LBA When verifying GPT header integrity, ensure that the first usable LBA is no larger than the last usable LBA. * libparted/labels/gpt.c (_header_is_valid): Reject a header with last_usable < first_usable. 2012-09-12 Jim Meyering tests: clarify a comment: _reading_ gpt tables on tiny devices * tests/t0203-gpt-tiny-device-abort.sh: Clarify. maint: remove unnecessary wcslen use * parted/strlist.c (gettext_to_wchar): Tighten up test for mbsrtowcs failure and remove unnecessary wcslen use. 2012-08-30 Stefano Lattarini (tiny change) maint: tighten per version requirement * bootstrap.conf ($buildreq): Require Perl >= 5.6 (not merely >= 5.5), because that's the minimal version required by modern Automake and Autoconf. maint: make Autoconf version requirement consistent * bootstrap.conf ($buildreq): Require Autoconf >= 2.63, not >= 2.61, for consistency with what is done in AC_INIT in configure.ac 2012-08-30 Stefano Lattarini (tiny change) build: require Automake >= 1.11.6 Now that we use AM_TESTS_ENVIRONMENT, we should require at least Automake >= 1.11.2; but since all the Automake version until 1.11.5 are vulnerable to CVE-2012-3386: it's even better to require 1.11.6. * configure.ac (AM_INIT_AUTOMAKE): Bump version requirement to 1.11.6. * bootstrap.conf ($buildreq): Likewise. 2012-08-30 Stefano Lattarini (tiny change) tests: remove unused AM_TESTS_ENVIRONMENT entries Probably a copy&paste errors, likely from the TESTS_ENVIRONMENT definition in the 'tests/Makefile.am' in GNU coreutils. * tests/Makefile.am (AM_TESTS_ENVIRONMENT): Don't define nor export any of the variables PREFERABLY_POSIX_SHELL, REPLACE_GETCWD, CC, MAKE, PERL. 2012-08-30 Stefano Lattarini (tiny change) tests: prefer AM_TESTS_ENVIRONMENT over TESTS_ENVIRONMENT The latter should be reserved for user overrides. * tests/Makefile.am (TESTS_ENVIRONMENT): Rename ... (AM_TESTS_ENVIRONMENT): ... like this. 2012-08-30 Stefano Lattarini (tiny change) build: enable subdir-objects Automake option globally That option is enabled unconditionally in Automake-NG, and enabling it also for mainline Automake will help to ensure no unexpected incompatibilities is introduced in a potential port to Automake-NG. Moreover, if we have a source file 'sub/foo.c', having it compiled in 'sub/foo.o' rather than in 'foo.o' is undeniably cleaner and more natural. * configure.ac (AM_INIT_AUTOMAKE): Add 'subdir-objects'. * libparted/fs/Makefile.am (AUTOMAKE_OPTIONS): No need to declare 'subdir-objects' explicitly now. 2012-08-30 Stefano Lattarini (tiny change) build: prefer pattern rules over suffix rules That is acceptable, because the GNU parted build system already requires GNU make anyway: the $(subst ...) built-in is used in the common recipe for the 'ss-1024', 'ss-2048' and 'ss-4096' targets in Makefile.am. * include/parted/Makefile.am (.in.h.h): Rename ... (%.h: %.in.h): ... as this pattern rule. (SUFFIXES): Delete, no more needed. 2012-08-30 Stefano Lattarini (tiny change) build: don't list files with unknown suffix in _SOURCES While this works with mainline Automake (which blindly treats source files with an unknown extension as if they were header files), it is undocumented (albeit admittedly unlikely to change). Moreover, it no longer works with Automake-NG (and that's by design), so the use of such feature would make a port to Automake-NG more difficult. * libparted/labels/Makefile.am (liblabels_la_SOURCES): ... don't list 'pt-limit.gperf' here; rather ... (EXTRA_DIST): ... list 'pt-limit.c' and 'pt-limit.gperf' here. (EXTRA_DIST, BUILT_SOURCES): Enhance few comments. 2012-08-30 Stefano Lattarini (tiny change) build: prefer $(AM_CPPFLAGS) over $(INCLUDES) The latter is obsolete, and might be removed in future Automake versions. Moreover, it's already been removed in Automake-NG, so its use would make a port to Automake-NG more difficult. * parted/Makefile.am (INCLUDES): Rename ... (AM_CPPFLAGS): ... like this. * partprobe/Makefile.am: Likewise. * libparted/fs/Makefile.am: Likewise. * libparted/Makefile.am: Likewise. * libparted/labels/Makefile.am: Likewise. 2012-08-28 Jim Meyering build: update gnulib, bootstrap and init.sh maint: don't prohibit strncpy just yet * cfg.mk (local-checks-to-skip): Add sc_prohibit_strncpy, so that we do not yet enable the strncpy prohibition. There are many uses, and it will be a lot of work to remove all of them. maint: avoid new syntax-check failure re @xref * doc/parted.texi: Adjust @xref usage: it must be used only at start of sentence. * doc/parted-pt_BR.texi: Likewise. 2012-06-09 Jim Meyering tests: add a test to exercise just-fixed code * tests/print-max.c: Extend to provide coverage of ped_disk_get_max_supported_partition_count, too. * tests/t9021-maxima.sh (max_n_partitions): New function, with naively hard-coded max-number-of-partitions-per-partition-table-type values. Use it to ensure that each expected value matches the actual one. * cfg.mk: Exempt this test's use of error from the syntax-check for unmarked diagnostics. 2012-06-09 Richard W.M. Jones gpt: fix endianness bug in gpt_get_max_supported_partition_count * libparted/labels/gpt.c (gpt_get_max_supported_partition_count): Take endianness of pth->FirstUsableLBA into account (64-bit, little endian) when calculating the maximum number of partitions. * NEWS (Bug fixes): Mention it. 2012-03-26 Jim Meyering tests: remove bogus envvar setting from t0300-dos-on-gpt.sh * tests/t0300-dos-on-gpt.sh: Remove envvar setting that effectively disabled testing(only in this test) of simulated sector sizes smaller than 4KiB. Also, use a much smaller backing file. 2012-03-24 Brian C. Lane tests: add t0301-overwrite-gpt-pmbr.sh Make sure parted checks the PMBR before the GPT partition table. * NEWS: Update with new GPT behavior. * tests/overwrite-gpt-pmbr.sh: New test. * tests/Makefile.am (TESTS): Add it. 2012-03-24 Brian C. Lane libparted: check PMBR before GPT partition table The UEFI spec requires that a valid GPT disk label have a PMBR partition. This moves the PMBR check to before the GPT check, exiting gpt_probe with a 0 if the PMBR is not valid. The previous behavior would cause problems in the following situation: 1. format a disk as GPT 2. re-format it as MSDOS using tools that don't understand GPT Subsequent operations with parted would then complain about the invalid PMBR, but would not allow the disk to be used as an msdos disk. This change causes parted to recognize the msdos partition table. * libparted/labels/gpt.c (gpt_probe): Move _pmbr_is_valid test. Reported by Chris Murphy in http://bugzilla.redhat.com/805272 2012-03-02 Jim Meyering maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 3.1 * NEWS: Record release date. maint: bump library version to 2.0.0 * libparted/Makefile.am (CURRENT): Increment, since I removed ped_realloc. 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/t9050-partition-table-types.sh 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, 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/t9050-partition-table-types.sh: 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/t3000-resize-fs.sh: Skip part of this root-only test when fsck.hfs is the always-segfaulting version. build,test: update gnulib, bootstrap and init.sh * bootstrap: Update. * tests/init.sh: Update. * gnulib: Update. * doc/po4a.mk: 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/Makefile.am: 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/t3000-resize-fs.sh: New test. * tests/Makefile.am (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/Makefile.am (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 _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/Makefile.am (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 ped_file_system_get_resize_constraint. * libparted/fs/r/hfs/hfs.c: Give a few functions global scope, so we can use them from the above. * libparted/fs/Makefile.am: 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/POTFILES.in: 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/Makefile.am (PARTED_TEST_NAME): Define. * tests/t0211-gpt-rewrite-header.sh: 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 * cfg.mk (url_dir_list): Use this http://ftp.gnu.org/gnu/$(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/t0209-gpt-pmbr_boot.sh: Reverse compare arguments. libparted: remove ped_realloc, now unused * include/parted/parted.in.h (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/t0209-gpt-pmbr_boot.sh: New test * tests/Makefile.am: Add new test * NEWS: Add information about the GPT PMBR pmbr_boot flag tests: update tests for new disk flags output * tests/t0010-script-no-ctrl-chars.sh: Updated * tests/t0100-print.sh: Updated * tests/t0101-print-empty.sh: Updated * tests/t0220-gpt-msftres.sh: Updated * tests/t0250-gpt.sh: Updated * tests/t0280-gpt-corrupt.sh: Updated * tests/t2310-dos-extended-2-sector-min-offset.sh: Updated * tests/t4000-sun-raid-type.sh: Updated * tests/t4100-dvh-partition-limits.sh: Updated * tests/t4100-msdos-partition-limits.sh: Updated * tests/t4100-msdos-starting-sector.sh: Updated * tests/t4200-partprobe.sh: Updated * tests/t5000-tags.sh: Updated * tests/t6000-dm.sh: Updated * tests/t9040-many-partitions.sh: Updated * tests/t9041-undetected-in-use-16th-partition.sh: 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/disk.in.h (_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/t9040-many-partitions.sh: 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/t0212-gpt-many-partitions.sh: New test. * tests/Makefile.am (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/Makefile.am (TESTS): Add it. * tests/t0211-gpt-rewrite-header.sh: 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 http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10691/focus=10695 * 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/t9042-dos-partition-limit.sh: 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 limit. * 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/t9042-dos-partition-limit.sh: New file. * tests/Makefile.am (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/Makefile.am (libfs_la_LDFLAGS): Remove. build: use LT_INIT, to make bootstrap run libtoolize * configure.ac: Use LT_INIT, so that bootstrap runs libtoolize, which creates build-aux/ltmain.sh. 2012-01-12 Jim Meyering maint: remove useless BUILD_LINUX conditional * configure.ac (BUILD_LINUX): Don't set it. * libparted/Makefile.am (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/Makefile.am (EXTRA_DIST): Rename from EXTRA_libparted_la_SOURCES. 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 = Makefile.in" from Makefile.am's * debug/Makefile.am: As above. * debug/test/Makefile.am: Likewise. * doc/C/Makefile.am: Likewise. * doc/pt_BR/Makefile.am: Likewise. * include/Makefile.am: Likewise. * include/parted/Makefile.am: Likewise. * libparted/Makefile.am: Likewise. * libparted/fs/Makefile.am: Likewise. * libparted/tests/Makefile.am: Likewise. * partprobe/Makefile.am: Likewise. * doc/Makefile.am: 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/Makefile.am: Insert it. * libparted/fs/Makefile.am: Likewise. * libparted/labels/Makefile.am: Likewise. * libparted/tests/Makefile.am: Likewise. * parted/Makefile.am: Likewise. * partprobe/Makefile.am: Likewise. * tests/Makefile.am: Likewise. 2012-01-10 Jim Meyering build: .gitignore: ignore more maint: hoist libparted/fs/*/Makefile.am into parent Makefile.am There was no need to have a separate Makefile.am for each file system type, and a good reason *not* to do that (reduce duplication). * configure.ac (AC_OUTPUT): Remove Makefiles. * libparted/fs/Makefile.am (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/Makefile.am: ...here. * libparted/fs/ext2/Makefile.am: Likewise. * libparted/fs/fat/Makefile.am: Likewise. * libparted/fs/hfs/Makefile.am: Likewise. * libparted/fs/jfs/Makefile.am: Likewise. * libparted/fs/linux_swap/Makefile.am: Likewise. * libparted/fs/nilfs2/Makefile.am: Likewise. * libparted/fs/ntfs/Makefile.am: Likewise. * libparted/fs/reiserfs/Makefile.am: Likewise. * libparted/fs/ufs/Makefile.am: Likewise. * libparted/fs/xfs/Makefile.am: Likewise. * libparted/fs/*/Makefile.am: 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 * configure.ac (AC_CONFIG_SRCDIR): Correct preceding commit. Keshav's patch was correct, but when I attempted to do the same thing manually I wrote .h.in rather than .in.h. 2012-01-10 Keshav P R build: update AC_CONFIG_SRCDIR for non-srcdir-from-clone builds * configure.ac (AC_CONFIG_SRCDIR): List parted.h.in, 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 clone. 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/Makefile.am: New rules. * .gitignore: Ignore the generated files. * Makefile.am (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/t8001-loop-blkpg.sh: 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. * Makefile.am (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/init.sh: 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 --makefile-name=gnulib.mk. Remove stray use of $bt. * lib/Makefile.am: Initialize all of the following so that generated code in gnulib.mk may use += to append to those variables: AM_CFLAGS, AM_CPPFLAGS, BUILT_SOURCES, CLEANFILES, EXTRA_DIST, MAINTAINERCLEANFILES, MOSTLYCLEANDIRS, MOSTLYCLEANFILES, SUFFIXES, noinst_LTLIBRARIES. 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/t0203-gpt-shortened-device-primary-valid.sh: New file. * tests/Makefile.am (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 in http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10653 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/t0220-gpt-msftres.sh: Use "p-name" as partition name, rather than misleading "primary". * tests/t7000-scripting.sh: 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/t8001-loop-blkpg.sh: Use it. * tests/t8000-loop.sh: 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/t-lib-helpers.sh (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/t-local.sh: Try harder to release resources here, rather than... * tests/t9040-many-partitions.sh: ...in this one test. * tests/t-local.sh (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-14 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: configure.ac: 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/t7000-scripting.sh: Reverse compare arguments. * tests/t2310-dos-extended-2-sector-min-offset.sh: 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 in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154 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/t6100-mdraid-partitions.sh: New file. * tests/Makefile.am: 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. Addresses: http://bugzilla.novell.com/567652 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/t0210-gpt-resized-partition-entry-array.sh: Use it. Reported by Keshav P R in http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10530/focus=10589 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 * Makefile.am (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 * cfg.mk (url_dir_list): Use this http://ftp.gnu.org/gnu/$(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 * configure.ac (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/t2500-probe-corrupt-hfs.sh: New script. * tests/Makefile.am (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 http://bugzilla.redhat.com/714758 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/t9030-align-check.sh: Wait for partition removal and use a smaller disk. 2011-11-04 Jim Meyering tests: add a helper function * tests/t-lib-helpers.sh (wait_for_dev_to_disappear_): New function. tests: exercise the "GPT vs other-sized partition entry arrays" fixes * tests/t0210-gpt-resized-partition-entry-array.sh: New file. * tests/Makefile.am (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 in http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10173. 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: http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10173 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/t0101-print-empty.sh: 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/t0203-gpt-tiny-device-abort.sh: 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/t0501-duplicate.sh: New test program. * tests/Makefile.am (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 partition. * NEWS: Mention this fix. Reported by Chris Murphy in https://bugzilla.redhat.com/747497. 2011-11-02 Petr Uzel tests: exercise the new feature * tests/t0208-mkpart-end-in-IEC.sh: New file. * tests/Makefile.am: 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 https://lists.gnu.org/archive/html/bug-parted/2011-10/msg00009.html * 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/t0207-IEC-binary-notation.sh: 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/t2201-pc98-label-recog.sh: New file * tests/Makefile.am: 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: IPL1 Linux 98 GRUB/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 http://bugzilla.redhat.com/646053 2011-10-15 Stefano Lattarini tests: use more portable fd redirection in TESTS_ENVIRONMENT * tests/Makefile.am (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/help-version.sh: ... to this. * tests/Makefile.am (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 tests/t0000-basic.sh: - More than one bogus ^M[[:space:]]*^M had to be removed, hence use s,,,g sed expression. tests/t0203-gpt-tiny-device-abort.sh: - Test was not expecting any output to stderr. No longer true. tests/t1100-busy-label.sh: - Another case of s,,,g as above. tests/t7000-scripting.sh: - 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/t-lib-helpers.sh (normalize_part_diag_): Adapt to handle the new form of the diagnostic. * tests/t7000-scripting.sh: 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 applies. tests: verify that 'udevadm settle' is available * tests/init.cfg (require_udevadm_settle_): New function. * tests/t8001-loop-blkpg.sh: 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/t8001-loop-blkpg.sh: New file. * tests/Makefile.am: 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 * cfg.mk: 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/t4300-nilfs2-tiny.sh: New test. * tests/Makefile.am (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 http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10466/focus=10472 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/t0203-gpt-tiny-device-abort.sh: Test for this. * tests/Makefile.am (TESTS): Add it. * NEWS: (Bug fixes): Mention it. Reported by Daniel Fandrich in http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10466 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/t9023-value-lt-one.sh: New file. * tests/Makefile.am (TESTS): Add it. tests: add test for radius divide by 2 fix * tests/t9022-one-unit-snap.sh: New file. * tests/Makefile.am (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 http://bugzilla.redhat.com/665496 2011-06-10 Jim Meyering maint: prefer AC_PROG_LIBTOOL over slightly deprecated AM_PROG_LIBTOOL * configure.ac: Use AC_PROG_LIBTOOL rather than slightly deprecated AM_PROG_LIBTOOL. 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-06 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. * cfg.mk (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 . (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/Makefile.am (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 * configure.ac: Remove support for --enable-fs and --disable-fs. Remove support for --enable-Werror and --disable-Werror. * README: Remove paragraph about --disable-fs and --enable-discovery-only. * 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/POTFILES.in * po/POTFILES.in: 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/Makefile.am (AM_CFLAGS): Add $(WARN_CFLAGS) and $(WERROR_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/t1100-busy-label.sh: 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 string. 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/t1100-busy-label.sh: Remove one last use of mkpartfs. Use scsi_debug rather than requiring an explicitly-provided device. 2011-05-26 Jim Meyering 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. * cfg.mk (old_NEWS_hash): Auto-update. version 2.4 * NEWS: Record release date. shared library version: increment REVISION * libparted/Makefile.am (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/t9040-many-partitions.sh: 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/t-local.sh (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/t2100-mkswap.sh: Likewise. * tests/t3000-resize-fs.sh: Remove file, now that all FS-ops are gone. * tests/Makefile.am (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/t-local.sh (scsi_debug_cleanup_): Add missing double quotes. 2011-05-12 Jim Meyering tests: avoid new, spurious test failure * tests/t9050-partition-table-types.sh: 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/t1101-busy-partition.sh: Use mkfs.vfat instead. 2011-05-10 Jim Meyering tests: write all pairs of partition table types * tests/t9050-partition-table-types.sh: New file. * tests/Makefile.am (TESTS): Add it. tests: add a NEWS entry and a test to exercise today's bug fix * tests/t9041-undetected-in-use-16th-partition: New file. * tests/Makefile.am (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/t-local.sh (new_sdX_): Do that. (gpt_corrupt_primary_table_): Likewise. tests: minor fix; add/adjust comments * tests/t1101-busy-partition.sh: 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 http://bugzilla.redhat.com/693852 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/Makefile.am (old-init.sh): Remove obsolete rule. tests: improve t1101-busy-partition.sh * tests/t1101-busy-partition.sh: Fail hard upon timeout while waiting for device to appear. tests: make the tests in libparted/tests work properly once again Since switching to init.sh, the root-only tests did not clean up. * libparted/tests/Makefile.am (prereq): Always create a symlink to tests/init.sh. * 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/t-local.sh: Likewise. tests: avoid a race condition in the scsi_debug-using tests * tests/t-local.sh (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/t0207-IEC-binary-notation.sh: New test. * tests/Makefile.am (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 cfg.mk to an ERE matching the exempted file names. * gnulib: Update to latest, to get maint.mk that implements this. * .x-sc_GPL_version: Remove file. * .x-sc_prohibit_always-defined_macros: Likewise. * Makefile.am (EXTRA_DIST): Remove them from here, too. * cfg.mk: 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/Makefile.am (AM_CFLAGS): Define. nilfs2: remove unused nilfs2_clobber function * libparted/fs/nilfs2/nilfs2.c (nilfs2_clobber): Remove unused function. (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/Makefile.am (parted_CFLAGS): Remove unused (and interfering) definition. 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/t1700-probe-fs.sh: Skip the test if mkfs.ext3 or tune2fs is missing or is not in $PATH. tests: test 'parted print' with empty disk * tests/t0101-print-empty.sh: New test. * tests/Makefile.am: 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/t1700-probe-fs.sh: Adapt to also test nilfs2. 2011-03-03 Jim Meyering tests: rename a test script, before extending it to handle nilfs * tests/t1700-probe-fs.sh: Rename from ... * tests/t1700-ext-probe.sh: ...this. * tests/Makefile.am (TESTS): Rename it here, too. 2011-02-26 Jiro SEKIBA libparted: add nilfs2 module * libparted/fs/nilfs2/Makefile.am: 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/Makefile.am (SUBDIRS): Add nilfs2. * configure.ac (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-25 Jim Meyering maint: two files lacked a newline at EOF: add one to each * include/Makefile.am: Add newline at end of file. * libparted/fs/jfs/Makefile.am: Likewise. tests: t3310-flags: check all gpt boolean flags, too * tests/t3310-flags.sh: 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/t3310-flags.sh: Put a loop around the body of the test, and factor out the partition table name. tests: remove useless commands * tests/t3310-flags.sh: Remove useless exp-manipulating commands. 2011-02-25 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-25 Brian C. Lane gpt: add partition attribute bits: NoBlockIOProtocol, LegacyBIOSBootable Add NoBlockIOProtocol and LegacyBIOSBootable flags to the GPT partition Attributes entry. 2011-02-25 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 test-lib.sh-based tests required a test_description= definition. When testing switched to init.sh, which by convention uses a brief comment on line 2 instead, some instances were not converted. * libparted/tests/t1000-label.sh: Put test description on line 2. Remove now-unused test_description= definition. * libparted/tests/t2000-disk.sh: Likewise. * tests/t0220-gpt-msftres.sh: 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/init.sh: 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 git.debian.org, 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/t9020-alignment.sh: Adjust expectations to match new behavior. See http://bugzilla.redhat.com/618255 for details. 2010-11-22 Jim Meyering tests: don't rely on "lockfile" program * tests/t-local.sh (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 test-lib.sh * tests/t-lib-helpers.sh (require_mdadm_): Remove vestiges of test-lib.sh (aka uses of the "say" and "test_done" functions). (require_xfs_): Likewise. tests: avoid spurious failure * tests/t6000-dm.sh: 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 . (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 http://bugzilla.redhat.com/651478 and http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10191 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 init.sh * tests/init.cfg (cleanup_, cleanup_fn_, cleanup_final_): Define. * tests/t-local.sh (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/t2100-zerolen.sh: Use cleanup_fn_, not cleanup_. * tests/t1100-busy-label.sh: Likewise. * tests/t1101-busy-partition.sh: Likewise. * tests/t4100-dvh-partition-limits.sh: Likewise. * tests/t4100-msdos-partition-limits.sh: Likewise. * tests/t6000-dm.sh: Likewise. * tests/t8000-loop.sh: Likewise. tests: t3000-resize-fs.sh: don't expect fs-op warning * tests/t3000-resize-fs.sh: Don't expect fs-op warning. The testing framework now suppresses it. tests: t-lvm.sh (lvm_init_root_dir_): Fix it to use $test_dir_ tests: remove t-lib.sh * tests/t-lib.sh: Remove file. No longer used. * tests/Makefile.am (EXTRA_DIST): Remove t-lib.sh. * tests/t-lib-helpers.sh: Don't mention this file name. * tests/t-local.sh: Likewise. 2010-11-20 Jim Meyering tests: switch from t-lib.sh to init.sh * tests/init.cfg: Source t-local.sh. * tests/t-local.sh: 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 -fi - -: ${srcdir=.} -. $srcdir/t-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../parted Use this command (LHS elided, because it was too long): git grep -l 'srcdir/t-lib.sh'|xargs perl -p0i -e \ 's!...!. "\${srcdir=.}/init.sh"; path_prepend_ ../parted\n!' * tests/t3310-flags.sh: Adjust manually, since the snippet didn't quite match. 2010-11-20 Jim Meyering tests: remove test-lib.sh * tests/test-lib.sh: Remove file. No longer used. * tests/Makefile.am (EXTRA_DIST): Remove test-lib.sh. (old-init.sh): Remove rule and associated uses. * tests/lvm-utils.sh (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 init.sh. tests: libparted/tests: use init.sh, not test-lib.sh tests: make lvm-utils.sh usable also from init.sh-using tests * tests/lvm-utils.sh: Use fail_, not error for diagnostics. The former also works in init.sh-using scripts. (init_root_dir_): Use test_dir_ if $test_dir_rand_ is not set. tests: new function required for t2100-zerolen.sh * tests/t-lib-helpers.sh (device_mapper_required_): New function. tests: convert t5000-tags.sh tests: t-lib-helpers.sh: don't discard require_dvhtool_ stderr/stdout tests: dvhtool: use skip_, not skip tests: t4200-partprobe.sh: convert tests: t-lib-helpers.sh (require_dvhtool_): New function. tests: convert t4000-sun-raid-type.sh tests: move more functions to t-lib-helpers.sh tests: convert t7000 to init.sh tests: t-lib-helpers: copy emit_superuser_warning from test-lib.sh tests: t0000: convert to use init.sh tests: convert t1101-busy-partition.sh * tests/t1101-busy-partition.sh: Convert from t-lib.sh to init.sh. tests: convert t4100-msdos-partition-limits.sh * tests/t4100-msdos-partition-limits.sh: Likewise. tests: convert t4100-dvh-partition-limits.sh to use init.sh * tests/t4100-dvh-partition-limits.sh: Convert. tests: convert t4100-msdos-starting-sector.sh * tests/t4100-msdos-starting-sector.sh: Use init.sh. tests: convert t0220 to use init.sh * tests/t0220-gpt-msftres.sh: Convert to use init.sh. tests: extract t-lib.sh functions for use via init.sh Currently there are three test frameworks in use: - test-lib.sh: old, don't use this framework any more; I found it too hard to use and debug. - t-lib.sh: newer, I had converted most tests to use this - init.sh: newest: successor of t-lib.sh, the master copy of which now resides in gnulib. All new tests should use this framework. * tests/t-lib-helpers.sh: New file, extracted from t-lib.sh, so that init.cfg can source these functions, too. * tests/t-lib.sh: Source it. * tests/init.cfg: Source it from here, too. * tests/Makefile.am (EXTRA_DIST): Add t-lib-helpers.sh. 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/t-lib.sh (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/t3000-resize-fs.sh (device_sectors_required): Sleep one more second after ${dev}1 appears, so that subsequent commands are more predictable. Split a long line. tests: t2100-mkswap.sh: convert to init.sh * tests/t2100-mkswap: Likewise. tests: convert t1100 to use init.sh * tests/t1100-busy-label.sh: Convert to use init.sh * tests/init.cfg (require_erasable_): New function, mostly copied from test-lib.sh. tests: init.cfg: copy envvar setings from testlib.sh: Unset TERM and CDPATH; sanitize LC_ALL, TZ, LANG, and set PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING=1. * tests/t1101-busy-partition.sh: Expect no output, now that we set PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING=1. maint: update init.sh and bootstrap from gnulib * tests/init.sh: 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-17 Colin Watson libparted: ignore zero-length devices * bootstrap.conf (gnulib_modules): Add xstrtoll. * configure.ac: Create DYNAMIC_LOADING output variable. * libparted/arch/linux.c (_device_get_length): Return the value of PARTED_TEST_DEVICE_LENGTH if set in the environment, strictly for use by the test suite. (init_generic): If geometry probing fails because the device was zero-length, return quietly rather than throwing an exception. This has been observed in the wild with cciss devices, and it's difficult for partitioners to tell the difference between that and more serious errors. * libparted/tests/Makefile.am (TESTS): Add t2100-zerolen.sh. (check_PROGRAMS): Add zerolen. (zerolen_SOURCES): Add. (TESTS_ENVIRONMENT): Add DYNAMIC_LOADING and ENABLE_DEVICE_MAPPER. * libparted/tests/t2100-zerolen.sh: New file. * libparted/tests/zerolen.c: New file. * tests/test-lib.sh (wait_for_dev_to_appear_): New function, copied from tests/t-local.sh. * NEWS (Bug fixes): Mention it. 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 http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10178 * 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 * configure.ac: libuuid was moved from e2fsprogs to util-linux-ng-2.16. Because distributions now often build e2fsprogs without libuuid support, suggest installing libuuid from util-linux-ng if it is missing, not from e2fsprogs. 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/t9021-maxima.sh: Update for the new loop limit. * NEWS (Bug fixes): Mention it. 2010-08-18 Jim Meyering avoid non-srcdir "make check" failure * tests/Makefile.am (EXTRA_DIST): Add init.cfg. The failure was introduced by commit 6f7c0f12. build and tests: update bootstrap and init.sh from gnulib * tests/init.sh: Update from gnulib. * bootstrap: Likewise. 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 http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10115 * NEWS (Bug fixes): Mention it. * tests/t3400-whole-disk-FAT-partition.sh: New file. Test for the bug. * tests/Makefile.am (TESTS): Add it. 2010-07-17 Jim Meyering tests: use init.cfg; required for init.sh-using tests * tests/init.cfg: New file. (require_512_byte_sector_size_): Slightly different function than the one in test-lib.sh. * tests/init.cfg: New file. 2010-07-17 Jim Meyering build: update gnulib submodule to latest maint: remove trailing blank * tests/t1101-busy-partition.sh: Remove trailing blank. 2010-06-30 Otavio Salvador tests: update resize-fs to use wait_for_dev_to_appear_ * t3000-resize-fs.sh: rely on wait_for_dev_to_appear_ to wait for the device to be crated. tests: rely on require_scsi_debug_module_ to modprobe scsi_debug module * t2310-dos-extended-2-sector-min-offset.sh: remove explicit modprobe since it is done by require_scsi_debug_module_. * t3200-type-change.sh: likewise. * t9020-alignment.sh: likewise. * t9030-align-check.sh: likewise. * t9040-many-partitions.sh: likewise. 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]. 1. http://bugs.debian.org/582818 Basically it does: * create two primary partitions * mount the second one * remove the first (must work) * try to remove the second (must fail) * tests/t1101-busy-partition.sh: new file. * tests/Makefile.am (TESTS): add the new test in check target. 2010-06-26 Otavio Salvador tests: skip loop-clobber-infloop if mkswap cannot be found * tests/t0400-loop-clobber-infloop.sh: Skip the test is case of mkswap cannot be found. 2010-06-26 Jim Meyering build: update gnulib submodule to latest * bootstrap: Update from gnulib. * tests/init.sh: 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 (http://bugs.debian.org/579948). * libparted/labels/sun.c: Revert. 2010-06-26 Jim Meyering tests: adjust sun-partition-creating test to conform * tests/t4000-sun-raid-type.sh: Adjust partition size so the end falls on a cylinder boundary. 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 * cfg.mk (bootstrap-tools): Add gettext to the list. post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (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/Makefile.in.in, it's easiest simply to require 0.18 of those who run build tools. Otherwise, requiring 0.17, build-from-git would fail due to the mismatch: 0.17 in Makefile.in.in and 0.18 in m4/gettext.m4. * configure.ac (AM_GNU_GETTEXT_VERSION): Require gettext 0.18. 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 * configure.ac: Correct previous change to use 0.17, not 0.18, since gettext-0.18 is new enough that it makes building from git a little too inconvenient. Spotted by Petr Uzel. 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 documentation. 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/t9040-many-partitions.sh: When creating a scsi_debug device, honor the block size suggested by the PARTED_SECTOR_SIZE environment variable, and thus required in expected output. 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. * Makefile.am (EXTRA_DIST): Add it here. maint: update helper scripts * tests/help-version: Update from coreutils. * bootstrap: Update from gnulib. * tests/init.sh: Likewise. build: use gettext-0.17 * configure.ac: Use gettext-0.17. * bootstrap.conf (gnulib_modules): Use gettext-h, not gettext. since the latter drags in a depedency on gettext 0.18. 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/t9040-many-partitions.sh: 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: http://technet.microsoft.com/en-us/library/dd744301%28WS.10%29.aspx This patch makes parted recognize this guid (using the DIAG flag). * libparted/labels/gpt.c (PARTITION_MSFT_RECOVERY, GPTPartitionData, _parse_part_entry, gpt_partition_new, gpt_partition_set_system, gpt_partition_set_flag, gpt_partition_get_flag, gpt_partition_is_flag_available): Support microsoft recovery GUID. * NEWS (New features): Add it. 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: http://technet.microsoft.com/en-us/library/dd744364%28WS.10%29.aspx http://bugzilla.redhat.com/show_bug.cgi?id=534066 * libparted/labels/dos.c (PARTITION_MSFT_RECOVERY): Define. (raw_part_parse): Recognize id 27 (msdos_partition_set_system): Recognize id 27 2010-05-06 Jim Meyering tests: add one: create 60 partitions on a scsi device * tests/t9040-many-partitions.sh: New test. * tests/Makefile.am (TESTS): Add it. (TESTS_ENVIRONMENT): Export AWK to test scripts. Inspired by the report of a many-partition test taking far longer on RHEL5 than on RHEL4 in http://bugzilla.redhat.com/589117 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 http://bugzilla.redhat.com/584057#c16 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/t4100-msdos-partition-limits.sh: Due to an inherent XFS limitation on 32-bit systems, this test would fail a set-up file creation step for simulated sector sizes of 4K and up. Skip this test in those cases. Upon dd failure, propagate its diagnostic to output, to make this sort of problem easier to diagnose. * tests/t4100-dvh-partition-limits.sh: Likewise. 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 \ TESTS=t3000-resize-fs.sh >& log.$i && printf . || echo $i $?; done I would typically see about 50% of them fail on a Fedora 13 system. It was obvious that this was due to a race condition when I found that modifying that tests' parted...resize invocation to go via strace changed the timing enough to make the test pass every time. The fix is to retry the partition-removal step upon any EBUSY failure, currently for up to 1 second (retrying up to 100 times, sleeping 10ms after each failure). * libparted/arch/linux.c (_disk_sync_part_table): Allocate "ok" using calloc, now that its initial values matter. Retry each removal upon EBUSY-failure. * bootstrap.conf (gnulib_modules): Use gnulib's usleep module. 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 table. More importantly, this function would fail when any partition is in use, in spite of our having carefully vetted them via BLKPG ioctls. * libparted/arch/linux.c (_kernel_reread_part_table): Remove function. (linux_disk_commit): Don't call it. 2010-04-29 Jim Meyering tests: correct a root-only test * tests/t2310-dos-extended-2-sector-min-offset.sh: 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): ...here. 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, init.sh * tests/Makefile.am (EXTRA_DIST): Add init.sh. tests: add help-version test (from coreutils) * tests/help-version: New file * tests/Makefile.am (TESTS_ENVIRONMENT): Pass built_programs and VERSION to test scripts -- both are required by help-version. (TESTS): Add help-version. ui: make --help tell where to report bugs * parted/ui.c (help_msg): Tell where to report bugs. tests: use gnulib's init.sh * tests/init.sh: New file, from gnulib. tests: rename generated init.sh to old-init.sh * tests/Makefile.am (old-init.sh): Rename from init.sh. * libparted/tests/Makefile.am: Likewise. * tests/test-lib.sh: Rename sole use. * .gitignore: Rename here, too. build: update gnulib submodule to latest tests: improved portability * tests/test-lib.sh: 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 * cfg.mk (local-checks-to-skip): Add these, to pass "make syntax-check" sc_error_message_uppercase, sc_error_message_period. * libparted/fs/ext2/ext2.h: Remove "#if HAVE_INTTYPES_H" guard. tests: test all boolean flags * tests/t3310-flags.sh: New test, suggested by Hans De Goede. * tests/Makefile.am (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/Makefile.am (version.c, version.h): Generate. (parted_LDADD): Add libver.a. (noinst_LIBRARIES, nodist_libver_a_SOURCES): Define. (BUILT_SOURCES): Initialize and append. (MAINTAINERCLEANFILES): Update. * parted/parted.c: Include "version.h". (_version): Use the new global variable, Version, not VERSION. 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/t3000-resize-fs.sh: Before, mklabel was sufficient to clear the partition table in preparation for the next iteration in this test. However, with recent BLKRRPART/BLKPG changes that "mklabel" would evoke a warning. Remove the sole partition to avoid that. 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/t2310-dos-extended-2-sector-min-offset.sh: New file. * tests/Makefile.am (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: s/parts/bad_part_list/ Allocate space for it only if needed. Use malloc rather than ped_malloc. Move decl of FD down to first use. 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/t3300-palo-prep.sh: New file. * tests/Makefile.am (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/t9021-maxima.sh: 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"); else PED_DEBUG (0, "not foo"); did not compile reliably, depending on the configuration. Make this work. * include/parted/debug.h [DEBUG && __GNUC__ && !__JSFTRACE__] (PED_DEBUG): Remove trailing semicolon. [!DEBUG] (PED_ASSERT): Use do-while rather than while. [!DEBUG] (PED_DEBUG): Likewise. 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 transports. * NEWS (New features): Mention it. 2010-04-13 Jim Meyering tests: propagate recent improvements to copied-from code * tests/t1700-ext-probe.sh: Fix typo s/2>1/2>&1/ and use a tighter regexp also in the preceding loop. Noted by Colin Watson. 2010-04-13 Colin Watson maint: constify ped_device_get_constraint interface * include/parted/device.h (ped_device_get_constraint): Constify "dev" parameter. * libparted/device.c (ped_device_get_constraint): Likewise. 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 https://bugs.launchpad.net/ubuntu/+source/parted/+bug/561599. * libparted/fs/ext2/ext2_fs.h: Define EXT4_FEATURE_RO_COMPAT_GDT_CSUM and EXT4_FEATURE_INCOMPAT_FLEX_BG. * libparted/fs/ext2/interface.c (_ext2_generic_probe): Test for EXT4_FEATURE_RO_COMPAT_GDT_CSUM and EXT4_FEATURE_INCOMPAT_FLEX_BG when probing for ext4. * tests/t1700-ext-probe.sh: Test for this. * NEWS (Bug fixes): Mention this. 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 limit. 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/t3000-symlink.sh: New file. * libparted/tests/Makefile.am: 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 * cfg.mk (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/lvm-utils.sh: Don't use test ... -o. * configure.ac: 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/Makefile.am (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/Makefile.am (noinst_SCRIPTS): Add test_fs_hfs and test_fs_hfsplus. * libparted/fs/hfs/Makefile.am (EXTRA_DIST): Add DOC and HISTORY. * tests/Makefile.am (TESTS): Add t3200-type-change.sh. 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 http://bugzilla.redhat.com/567118 Patch forwarded by Hans De Goede. 2010-03-02 Petr Uzel tests: skip tests that require mkfs.hfs, when it is unavailable t3000-resize-fs.sh would fails if mkfs.hfs is not installed. * tests/t-lib.sh (require_hfs_): New function. * tests/t3000-resize-fs.sh: Use require_hfs_. 2010-02-28 Jim Meyering tests: convert more tests to the newer infrastructure * tests/t1700-ext-probe.sh: Convert from test-lib.sh to t-lib.sh. * tests/t2200-dos-label-recog.sh: Likewise. * tests/t2300-dos-label-extended-bootcode.sh: 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 transports. * 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. * cfg.mk (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/t2400-dos-hfs-partition-type.sh: New script. * tests/Makefile.am: Add it. * NEWS (Bug fixes): Mention it. tests: gpt-pmbr: don't ignore stdout comparison result * tests/t0202-gpt-pmbr.sh: 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/t4001-sun-vtoc.sh: Convert. * tests/Makefile.am (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 3961bae0ac030a70ae2e0578270203889021f1a1). 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/t4001-sun-vtoc.sh: 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/Makefile.am (TESTS): Remove dup-clobber, and instead... Add t0500-dup-clobber.sh. * tests/t0500-dup-clobber.sh: 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/Makefile.am (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: https://bugzilla.gnome.org/show_bug.cgi?id=604298#c9 * 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 _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/Makefile.am (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/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh: New test. * tests/Makefile.am (TESTS): Add t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh. tests: factor utility functions into "library" ...since we're about to use them from a second test. * tests/t-local.sh (peek_, poke_, gpt1_pte_name_offset_): New functions. (gpt_corrupt_primary_table_, gpt_restore_primary_table_): New functions. * tests/t0280-gpt-corrupt.sh: 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/t2100-mkswap.sh: Adjust for alignment changes where necessary. * tests/t0220-gpt-msftres.sh: Likewise. * tests/t0280-gpt-corrupt.sh: Likewise. * tests/t2200-dos-label-recog.sh: Likewise. * tests/t2300-dos-label-extended-bootcode.sh: Likewise. * tests/t3000-resize-fs.sh: Likewise. * tests/t4100-msdos-partition-limits.sh: Likewise. * tests/t4100-msdos-starting-sector.sh: Likewise. * tests/t5000-tags.sh: Likewise. * tests/t8000-loop.sh: Likewise. * tests/t9021-maxima.sh: 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 alignment). 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/Makefile.am (TESTS): Add t0205-gpt-list-clobbers-pmbr.sh. * tests/t0205-gpt-list-clobbers-pmbr.sh: New test. * NEWS (Bug fixes): Mention this. Reported by aix27249 in http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/250 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: s/informations/information/g s/prefered/preferred/g 2010-02-04 Jim Meyering tests: avoid another spurious test failure with newer xfsprogs * tests/t4100-msdos-partition-limits.sh: Likewise. tests: avoid spurious test failure with newer xfsprogs * tests/t4100-dvh-partition-limits.sh: 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. * Makefile.am (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/t9021-maxima.sh: 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 PED_DEVICE_FILE. * libparted/arch/linux.c (_device_set_sector_size): Remove PED_DEVICE_FILE check. linux: remove unused blkpg.h header file * libparted/arch/linux.c: Don't include blkpg.h. * libparted/arch/blkpg.h: Deleted. * libparted/Makefile.am (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 blkid_topology_get_physical_sector_size. 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 * cfg.mk (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/USER.jp: 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 * cfg.mk: Next time, just run "make update-copyright". 2009-12-31 Jim Meyering maint: newer gnulib; don't hard-code my GPG key ID * cfg.mk (gpg_key_ID): Remove definition, now that maint.mk automates it. * gnulib: Update to latest. 2009-12-20 Jim Meyering maint: make build-aux/gnu-web-doc-update work * cfg.mk (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. * cfg.mk (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 re-allocated. * 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: http://bugzilla.redhat.com/show_bug.cgi?id=543029 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 dist-check.mk rules * dist-check.mk (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: dist-check.mk adapt to parted-specific details * dist-check.mk (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 dist-check.mk from coreutils * dist-check.mk: Sync from coreutils. * gnulib: Update to latest. maint: sync dist-check.mk from coreutils * dist-check.mk: Sync from coreutils. * gnulib: Update to latest. 2009-12-12 Jim Meyering build: distribute gperf-generated file, pt-limit.c * libparted/labels/Makefile.am (EXTRA_DIST): Distribute the gperf-generated file, pt-limit.c, so that people don't need to run gperf at build-from-tarball time. 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. 2009-12-11 Jim Meyering build: update spec: gperf is a new build-requirement * parted.spec.in (BuildRequires): Add gperf. Reported by Jeff Darcy. build: update gnulib submodule to latest tests: ensure that parted can partition a loop device * tests/t8000-loop.sh: 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 http://bugzilla.redhat.com/546622 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 PED_PARTITION_APPLE_TV_RECOVERY. * libparted/disk.c(ped_partition_flag_get_name): Handle PED_PARTITION_APPLE_TV_RECOVERY. * 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): Handle atvrecv / PARTITION_APPLE_TV_RECOVERY_GUID. build: don't install s390 dasd internal headers into /usr/include * include/parted/Makefile.am (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 * Makefile.am (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/t9021-maxima.sh: New file. * tests/Makefile.am (TESTS): Add t9021-maxima.sh. (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/Makefile.am (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/Makefile.am (GPERF, GPERF_OPTIONS): Define. (BUILT_SOURCES): Define. (liblabels_la_SOURCES): Append pt-limit.gperf. (pt-limit.c): New rule. (MAINTAINERCLEANFILES): Remove useless definition. (DISTCLEANFILES): Set to $(BUILT_SOURCES). * libparted/labels/pt-limit.gperf: New file. * cfg.mk (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 ptt_partition_max_start_len. 2009-11-30 Jim Meyering tests: exercise new align-check command * tests/t9030-align-check.sh: New file. * tests/Makefile.am (TESTS): Add it. 2009-11-30 Jim Meyering ui: new command: align-check TYPE N e.g., 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/t9020-alignment.sh: 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. (ped_disk_clobber_exclude): 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 . (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/Makefile.am (TESTS): Move t3200-type-change.sh to ... (XFAIL_TESTS): ...here. 2009-11-24 Jim Meyering tests: correct t3200-type-change.sh * tests/t3200-type-change.sh: The initial version was incomplete. tests: provide a new function: fail_ * tests/t-lib.sh (fail_): New function. tests: t0001-tiny.sh: avoid spurious failure when run as root. * tests/t0001-tiny.sh: 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 _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 * cfg.mk (gnu_ftp_host-stable): Rename from gnu_ftp_host-major. 2009-11-17 Jim Meyering test for partition-type-changing bug * tests/t3200-type-change.sh: New file. * tests/Makefile.am (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: t0000-basic.sh: minor correction * tests/t0000-basic.sh: 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/t0001-tiny.sh: 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/Makefile.am (TESTS): Add t0001-tiny.sh. 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/t0202-gpt-pmbr.sh: 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/t0202-gpt-pmbr.sh: 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: http://bugzilla.redhat.com/533808 * libparted/arch/linux.c: include fdasd.h. (init_dasd): Do BIODASDINFO ioctl, and store the dasd devno in arch_specific. (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 prototypes. 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 . (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 '\ 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 numbers. 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/Makefile.am (TESTS): Add t3000-resize-fs.sh. 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/t0400-loop-clobber-infloop.sh: Convert. * tests/t0010-script-no-ctrl-chars.sh: Likewise. * tests/t3000-resize-fs.sh: Likewise, and convert it to use scsi_debug. * tests/t-local.sh (require_512_byte_sector_size_): Copy this function from test-lib.sh. 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, t-local.sh and t-lvm.sh * tests/Makefile.am (EXTRA_DIST): Add t-local.sh and t-lvm.sh. tests: appease "make syntax-check" * tests/print-align.c: Include "progname.h". Call set_program_name. tests: t6000-dm.sh: update and adapt to changed LVM2 * tests/t6000-dm.sh: 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/t9010-big-sector.sh: Do not invoke scsi_debug_setup_ in a subshell, since it sets a variable that cleanup machinery expects to see. * tests/t9020-alignment.sh: Likewise. tests: tweak temporary dirname prefix * tests/t-lib.sh (t_): Use "pe-" as prefix, not "gz-". tests: update lvm-utils.sh from lvm2 * tests/lvm-utils.sh: Merge in changes from lvm2. tests: adapt/update lvm-related infrasture, too * tests/t-local.sh: Source t-lvm.sh. * tests/t-lvm.sh: Clone and update of lvm-utils.sh, for when we retire that file in favor of this one. tests: adapt t8000-loop.sh * tests/t8000-loop.sh: 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/t9020-alignment.sh: Check partition alignment too. tests: serialize tests that use the scsi_debug module * tests/t-local.sh (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/t9020-alignment.sh: New test. * tests/Makefile.am (TESTS): Add it to the list. tests: factor out some more * tests/t-local.sh (require_scsi_debug_module_): New function. * tests/t9010-big-sector.sh: Use it. tests: perform scsi_debug cleanup automatically... ...rather than requiring each test to do it. * tests/t-lib.sh ($cleanup_eval): New variable. Initialize. (remove_tmp_): Use it. * tests/t-local.sh: 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/t9010-big-sector.sh (cleanup_): Remove. 2009-11-02 Jim Meyering tests: move scsi_debug framework into shared script * tests/t-local.sh (-scsi_debug_cleanup_, wait_for_dev_to_appear_): (print_sd_names_, scsi_debug_setup_): New functions, factored out of ... * tests/t9010-big-sector.sh: ...this file. tests: document and begin to factor out scsi_debug framework * tests/t9010-big-sector.sh: 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/Makefile.am (check_PROGRAMS): Define. (AM_CPPFLAGS, LDADD): Define. (AM_CFLAGS): Enable warnings here, too, by adding $(WARN_CFLAGS) and $(WERROR_CFLAGS). 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 account. 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 topology. 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/t7000-scripting.sh: Initialize fail=0, so that an environment setting cannot perturb the test. tests: convert to new testing framework * tests/t0200-gpt.sh: Convert to new testing framework. * tests/t0201-gpt.sh: Likewise. * tests/t0300-dos-on-gpt.sh: Likewise. * tests/t0100-print.sh: Likewise. * tests/t0250-gpt.sh: 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/t7000-scripting.sh: Remove the mkpartfs tests. tests: remove tests that are too FS-centric * tests/t1000-mkpartfs.sh: Remove file. * tests/t1500-small-ext2.sh: Likewise. * tests/t2000-mkfs.sh: Likewise. * tests/t3100-resize-ext2-partion.sh: Likewise. * tests/t3000-constraints.sh: Likewise. * tests/Makefile.am (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/t0280-gpt-corrupt.sh: 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 . (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/t0280-gpt-corrupt.sh: Convert to new test style. * tests/t-lib.sh: Source t-local.sh. * tests/t-local.sh: New file. gpt: clean up * libparted/labels/gpt.c (gpt_probe): Remove now-useless test before pth_free. (gpt_read): Use ptt_clear_sectors in place of open-coded equivalent. * cfg.mk (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 t0280-gpt-corrupt.sh: 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/t0280-gpt-corrupt.sh: 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/Makefile.am (TESTS): Add t0280-gpt-corrupt.sh. * libparted/labels/gpt.c (gpt_read): Change diagnostic to say that the PTE CRC mismatch is in the primary table. * tests/t0280-gpt-corrupt.sh: 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 gpt: add a comment * libparted/labels/gpt.c (_header_is_valid): Add a comment to explain the new partition entry size limitation of UINT32_MAX/16. build: update gnulib submodule to latest tests: use scsi_debug to test-for 4k-sector-specific bug * tests/t9010-big-sector.sh: New root-only test. Requires 2.6.31, and the scsi_debug module, /sys/block/... support and an upcoming version of libblkid. * tests/Makefile.am (TESTS): Add t9010-big-sector.sh. Thanks to Mike Snitzer for advice and for pointing me to similar code he wrote to test LVM. tests: begin the transition to coreutils' testing framework The existing testing framework makes it hard to diagnose test failures, so I'm switching to one that works better for me, from coreutils. * tests/t-lib.sh: New file. Mostly from coreutils/tests/test-lib.sh. * tests/Makefile.am (TMPDIR): Update to pass more info to test scripts. (EXTRA_DIST): Add t-lib.sh. linux: use libblkid to determine ->phys_sector_size Before this change, creating a memory-mapped disk on a fedora-based system running 2.6.31.1-56.fc12.x86_64 using this command: modprobe scsi_debug dev_size_mb=1025 sector_size=4096 and then running "parted -s /dev/sdd mklabel gpt print" would mistakenly print "Sector size (logical/physical): 4096B/512B" The "512B" is what's wrong. It should be "4096B". * configure.ac: Test for a new-enough blkid library. * libparted/Makefile.am (libparted_la_LIBADD): Add $(LIB_BLKID). * libparted/arch/linux.c (get_minimum_io_size): New function. (_device_set_sector_size): Use it. libparted: weaken a diagnostic * libparted/arch/linux.c (_kernel_reread_part_table): Give a more accurate diagnostic. Reported by Curtis Gedak. gpt: verify CRC32 of partition table entry array, too The partition table entry array's CRC was not being verified at all. This adds an interim check. The full-blown change required to make this implementation conform to the EFI spec will be more invasive. * libparted/labels/gpt.c (gpt_read): Check CRC of PTE array, too. * tests/t0280-gpt-corrupt.sh: New test for this. Reported by Karel Zak. doc: mention the "bios_grub" flag I don't like the idea of documenting this "flag setting" option, but it's been in the code for long enough now, and in actual use, that I feel obliged. In the longer term, we'll probably deprecate it and instead add an interface to set a partition's type independent of mkpart's "type" argument. * doc/parted.texi (set): Mention bios_grub. tests: gpt: do not munge GPT data manually Otherwise, an upcoming change would cause this test to fail. * tests/t5000-tags.sh: Do not munge GPT data manually, since that does not update embedded CRCs, and thus renders it invalid. Set the attribute via "set 1 bios_grub on" instead. Also, use "name1" as the partition name, rather than the misleading "primary". Adjust diagnostics: the changes we make are no longer "manual." 2009-10-08 Jim Meyering libparted: fix big-endian bug in gpt_get_max_supported_partition_count * libparted/labels/gpt.c (gpt_get_max_supported_partition_count): Convert ->SizeOfPartitionEntry from little-endian to CPU endianness here, too. This is along the same lines as commit d6e9b3bb, but with the difference that this code is not reachable via the command-line interface. 2009-10-06 Jim Meyering post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 2.0 * NEWS: Record release date. gpt: don't malfunction on big-endian systems Numerous GPT tests would fail when run on e.g., big-endian PPC. * libparted/labels/gpt.c (gpt_read): Now that we use the SizeOfPartitionEntry member, be sure to convert from GPT's little-endian on-disk format to to CPU endianness. This bug was introduced via commit 14cce9b2, 2009-06-10, "gpt: fix gpt_read to read all of the partition entries correctly". * libparted/labels/gpt.c (_header_is_valid): Also convert it here. Add a test to ensure that the partition entry size is no larger than the slightly arbitrary UINT32_MAX/16. * NEWS (Bug fixes): Mention it. build: update gnulib submodule to latest maint: add gnulib's gnu-web-doc-update module * bootstrap.conf (gnulib_modules): Add gnu-web-doc-update doc: add pointer to NEWS in README * README: Mention NEWS. doc: update README * README (WARNING): Mention upcoming removal of FS-manipulation capabilities and that we'll retain FAT/HFS resize capabilities. Remove an obsolete URL. Do not encourage email to individuals. Update info-viewing instructions, provide the on-line doc URL. 2009-10-06 Jim Meyering tests: resize FAT and HFS file systems Since it looks like we're stuck with keeping at least FAT and HFS file-system resizing support in libparted, we have an obligation to exercise at least some of that functionality. For now, I've limited this test to shrinking well-aligned partitions by a well-behaved amount. Curtis Gedak helped come up with a usable test. * tests/t3000-resize-fs.sh: New file. Use starting partition offset that is on a cylinder boundary, and increase the partition size to be larger than 256 MiB. When resizing, choose the new size to be exactly one cylinder (8MiB) smaller than the original. 2009-10-06 Hans de Goede ped_partition_busy: do not call the libparted exception handler Modify libparted/arch/linux.c _partition_get_part_dev() to not call _device_stat() but instead use stat directly, as _device_stat() calls the libparted exception handler, and we don't want this here, the only caller of _partition_get_part_dev() is _partition_is_mounted(), which in turn only gets called by linux_partition_is_busy(), and we don't want to "throw" exceptions from ped_partition_busy(). This issue was noticed in combination with pyparted as used by anaconda, see: http://bugzilla.redhat.com/527035#c10 2009-10-01 Jim Meyering doc: mention the GPT/msftres bug fix * NEWS (Bug fixes): Mention it. parted: issue a warning upon any use of a file-system op * parted/parted.c (issue_fs_op_warning): New function. (do_cp, do_mkfs, do_mkpartfs, do_move, do_resize, do_check): Call it. * tests/test-lib.sh: Export the envvar setting, PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING=1 to suppress those warnings while running the few remaining FS-related tests. maint: avoid false-positive NULL-deref warning from clang * parted/ui.c: Include . (command_line_get_disk): Add an assertion that command_line_get_device currently guarantees will always be true. This placates clang regarding its sole NULL-deref warning. (command_line_get_device): Move declarations "down" to first use. build: use more gnulib modules for better POSIX compliance * bootstrap.conf (gnulib_modules): Add modules exposed via make CFLAGS=-DGNULIB_POSIXCHECK 2>&1 \ |perl -lne '/.* use gnulib module (\S+).*/ and print $1' \ |sort |uniq -c|sort -nr Add these: close fsync lseek mkstemp strdup unlink maint: function returning "int", did not return a value. * parted/ui.c (init_readline): Return a value (always 0 for now). * parted/parted.c (_init): Handle init_readline's return value. maint: remove more dead stores and fix a bug in do_mkpartfs * libparted/fs/ext2/ext2_mkfs.c (ext2_mkfs_create_lost_and_found_inode): Punt: suppress clang's (aka scan-build's) warning. * parted/parted.c (snap_to_boundaries): Remove a dead store. (do_mkpartfs): The apparent dead store to part_name exposed a real bug. In fact, it highlighted that while do_mkpart uses its "part_name" variable (and calls ped_partition_set_name), do_mkpartfs did not. (snap_to_boundaries): Remove dead store. * libparted/unit.c (parse_chs): Likewise, and a leak. * libparted/fs/hfs/reloc_plus.c (hfsplus_cache_from_catalog): Likewise. (hfsplus_cache_from_extent): Remove a dead store. (hfsplus_cache_from_attributes): Likewise. * libparted/fs/hfs/advfs_plus.c (hfsplus_btree_search): Likewise. * libparted/fs/ext2/ext2_block_relocator.c (ext2_block_relocate_shrink): Remove dead store and corresponding decl. * parted/ui.h: Mark 2nd parameter as non-null. maint: remove dead store code and declarations * libparted/labels/bsd.c (bsd_partition_set_flag): Remove dead store and corresponding decl. * libparted/arch/linux.c (init_ide): Likewise. (_dm_maptype): Likewise. (_mount_table_search): Likewise. * libparted/fs/amiga/asfs.c (_asfs_probe): Likewise. * libparted/labels/mac.c (mac_alloc_metadata): Likewise. * libparted/labels/rdb.c (amiga_write): Likewise. (amiga_write): Again. * libparted/fs/amiga/apfs.c (_generic_apfs_probe): Likewise. * libparted/fs/hfs/reloc_plus.c (hfsplus_effect_move_extent): Likewise. * libparted/fs/hfs/reloc.c (hfs_effect_move_extent): Likewise. * libparted/labels/dos.c (probe_partition_for_geom): Remove dead store in "can't happen" case. make PED_ASSERT handling sane: abort on false condition Upon a failed PED_ASSERT, Do not ask the interactive user if they want to continue. This change will affect any code that expects to be able to continue after a failed PED_ASSERT condition. However, such code is so fundamentally broken that this change is required. If you require to be able to continue after a false condition, then the code must not use a macro named like PED_ASSERT. This change was motivated by my desire to use the clang static analysis tool. Without this change, there were over 300 mostly-false-positive reports. With it, just 31, almost all legitimate. * libparted/debug.c (ped_assert): Remove first parameter. It is now tested via the macro. Now, this function always aborts, which helps clang understand. Do not ask the interactive user if s/he wants to continue. * include/parted/debug.h (PED_ASSERT): Test condition here, not in ped_assert. * libparted/disk.c (ped_disk_remove_partition): Remove the label that was used only upon failing PED_ASSERT. Now that PED_ASSERT always aborts for a false condition, that would have been dead code. (ped_disk_new_fresh): Likewise. build: avoid a shadowing warning * libparted/fs/hfs/advfs_plus.c (hfsplus_get_empty_end): Rename local, "link" to avoid shadowing the syscall. * libparted/fs/hfs/advfs.c (hfs_get_empty_end): Likewise. 2009-09-29 Jim Meyering fat-FS: do not modify fat file system support Revert "Add fat support for sector_size > 512." This reverts commit 14395c356664a3b88f3929a6a3ad69bca374f70d. Revert "Fix compile failures." This reverts commit 7603e404ee60f2f892be380a23c390f4638f451f. doc: update NEWS * NEWS: Mention >512-byte sector support. build: use newer bootstrap script * bootstrap: Update from coreutils. build: update gnulib submodule to latest maint: update most copyright year lists to include 2009 I used this command: make update-copyright \ UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1 tests: enable more syntax-checks * cfg.mk: Enable a few more tests. * include/parted/debug.h: Remove useless parens to avoid triggering failure of the sc_useless_cpp_parens syntax-check. * libparted/arch/linux.h: Likewise. * libparted/libparted.c: Likewise. tests: enable a few syntax-checks * cfg.mk (local-checks-to-skip): Remove a few useless exclusions and enable a few syntax checks. * libparted/arch/linux.c (linux_destroy): Avoid triggering the sc_cast_of_argument_to_free check. * parted/strlist.c (str_list_destroy_node): Likewise. 2009-09-24 Jim Meyering tests: gpt: exercise creating all partition types; check for msftres bug Ensure that a newly-created partition in a GPT partition table has no 'flag' set, by default. This test also exercises setting the "name" on a partition and creates one partition of each supported type. * tests/t0220-gpt-msftres.sh: New file. * tests/Makefile.am (TESTS): Add that new file. 2009-09-24 Keshav P R gpt: don't use msftres flag for FAT/NTFS partitions This patch corrects the bug in parted due to which any FAT(12,16,32) or NTFS partition(s) is, by default, incorrectly set as "Microsoft Reserved Partition" type in GPT disks. With this change, parted defaults to setting the FAT/NTFS Partitions partition type to Linux/Windows Basic Data Partition which will make them accessible in Mac OS X and Windows. Reported by hramrach@centrum.cz in , with suggested change by Osamu Aoki . Keshav P R wrote the above and prepared this patch. 2009-09-24 Jim Meyering ui: do not initialize readline (which would output!) in --script mode Running parted with its --script (-s) option would, surprisingly, print a few control characters if TERM were set appropriately, and if readline and curses support were compiled in. This fixes it not to do that. * parted/parted.c (_init): Initialize readline support only after parsing command line options, so we can skip it in --script mode. * parted/ui.c (init_readline): New function. Body extracted from ... (init_ui): ...here. * parted/ui.h (init_readline): Declare. * tests/t0010-script-no-ctrl-chars.sh: New file. Test for the above. * tests/Makefile.am (TESTS): Add that new file. 2009-09-18 Jim Meyering loop: don't infloop Correct a bug introduced in commit 52815877, 2007-06-15, "Make loop_probe and loop_clobber work with sector_size > 512, too." * libparted/labels/loop.c (loop_clobber): Initialize "i" before the loop, not inside it. * tests/t0400-loop-clobber-infloop.sh: Test for this. * tests/Makefile.am (TESTS): Add it. 2009-09-17 Jim Meyering tests: correct t1100-busy-label This test had two problems: FS-manipulation (creates a FAT fs) even for non-512-byte sectors, and it had a now-unexpected line in the expected output of its final command. * tests/t1100-busy-label.sh: Use require_512_byte_sector_size_, so that we skip this test when in non-512-sector size mode. Remove the now-bogus line. Note: this test is not normally run. In order to run it, you have to run as root and set two envvars, e.g., sudo make check DEVICE_TO_ERASE=/dev/sde DEVICE_TO_ERASE_SIZE=16.4MB build: update gnulib submodule to latest build: sync bootstrap from coreutils * bootstrap: Update from coreutils. 2009-08-28 Hans de Goede linux-commit: do not unnecessarily open partition device nodes After patching parted with my do-not-use-BLKPG patch, I started to get EBUSY errors on commit_to_os. Note this is not caused by the do-not-use-BLKPG patch, this was already happening, but parted was silently ignoring the errors (and the kernel was not notified of the changes, which is bad). The error now actually gets reported. The problem turns out to be in libparted/arch/linux.c's _flush_cache function, which walks all the partitions of the disk and does BLKFLSBUF calls on them. This causes the following: commit_to_os -> device_open -> fd = open /dev/sda -> _flush_cache -> for each /dev/sda# open, ioctl, close -> ioctl(fd, BLKRRPART) -> EBUSY What is happening here is that the: for each /dev/sda# open, ioctl, close Is causing udev change events for all the /dev/sda# nodes, which causes udev to call blkid on all these nodes (on systems which use DeviceKit), so blkid has /dev/sda# nodes open while BLKRRPART gets called on /dev/sda -> EBUSY. I've checked with two independend storage subsystem kernel developers, and /dev/sda and /dev/sda#, guarantee cache coherency now-a-days. So there is no need to do this for 2.6, which also eliminates the need to call _flush_cache() on device open at all. * libparted/arch/linux.c (_have_kern26): New function. (_flush_cache): For linux kernels 2.6 and newer, don't flush partition devices. (linux_open): Skip _flush_cache on newer kernels here, too. 2009-08-28 Hans de Goede linux-commit: remove the use of the BLKPG ioctl While testing partitionable mdraid I noticed that the kernels view of the partition table never changes even though I was successfully making commit_to_os() calls. This has let to me diving into libparted's commit_to_os() code for Linux and there are multiple issues hiding in there: 1) Parted reads /sys/block/foo/range to determine how many partitions the device type supports and then makes BLKPG ioctl's to update the kernels view of the partition table for partitions which fall into this range. However for example /sys/block/sda/range contains 16, there are 2 issue with libparted using this number: 1) scsi major's only support 15 partitions, 1 of the range of 16 is reserved for the whole device, yet libparted will try to notify the kernel about 16 partitions if present 2) If the major's partition minor's run out, the kernel will switch to the mdp major for the other partitions, iow range no longer limits the number of partitions. 2) libparted assumes the user knows what he is doing, and will ignore -ebusy errors for partitions, assuming that the user is smart enough to only change unused partitions. Parted does this without checking if the partitions which return ebusy actually are unchanged causing REAL errors to get unreported (BAD, really really BAD) 3) because of 1) libparted will only sync 1 partition on /dev/md# devices (would be 0 if not for the of by 1 bug as all md#p# partitions use the mdp major), and it fails to even do that without reporting an error. ### 1) we can fix by simply not checking /sys/block/foo/range, but instead just syncing max partitions. 2) is more troublesome, we could just make -EBUSY n error, but that may annoy / bug some users. OTOH in certain cases libparted already falls back to BLKRRPART which will return EBUSY so users should already be prepared to handle EBUSY 3) Could be fixed by making libparted recognize mdraid as a device type and except mdraid from using BLKPG, like it already is doing with DASD, but it might be better to just get rid of using BLKPG all together. See below. An even bigger problem IMHO is the use of the BLKPG ioctl instead of BLKRRPART at all. What this does is tell the kernel parted's view of the partition table and make it use that, instead of telling the kernel to reread the partition table. According to the parted sources this is done for the case where the kernel does not know the disklabel type. However as soon as the system is rebooted, the system will be using the kernel's view. So IMHO it would be much better to always use the kernels view and just always call BLKRRPART in commit_to_os(), this would solve all of the above issues, *and* make the way the system views the partition table consistent between just after running parted and after a reboot. I've attached a patch which removes the use of the BLKPG ioctl, notice that this also removes a lot of special case code and workarounds, which existence to me clearly indicates that using the BLKPG ioctl is a bad idea. * libparted/arch/linux.c (linux_disk_commit): Remove the use of the BLKPG ioctl. (_blkpg_add_partition, _blkpg_part_command, _blkpg_remove_partition): (_device_get_partition_range, _disk_sync_part_table, _have_blkpg): (_have_devfs): Remove functions thus rendered unused. 2009-08-28 Jim Meyering tests: make two partition-related tests work for other sector sizes These two root-only tests would fail with the PARTED_SECTOR_SIZE envvar set to anything other than 512. Now they also work for multiples. * tests/t4100-dvh-partition-limits.sh: Make sector-size agnostic. * tests/t4100-msdos-partition-limits.sh: Likewise. tests: make it easier to diagnose loop_setup_ failure * tests/lvm-utils.sh: Don't redirect stderr to /dev/null. tests: avoid spurious failure due to extra space in diagnostic * libparted/labels/pt-tools.c (ptt_partition_max_start_len): Remove stray space in diagnostic that was causing the root-only regression test, t4100-dvh-partition-limits.sh, to fail. tests: avoid spurious failure on "nodev" mounted partition * tests/t8000-loop.sh: Skip this test if loop_setup_ fails. * tests/t6000-dm.sh: Likewise. 2009-08-28 Hans de Goede parted: avoid unnecessary open/close on commit, and thus udev activity * libparted/disk.c (ped_disk_commit): Open/close the underlying file descriptor in this function, so that callees, ped_disk_commit_to_dev and ped_disk_commit_to_os do not each perform open/close syscalls. This saves an open/close pair, and thus avoids unneeded udev activity on Linux. Before this change, when calling commit() on a ped_disk, the following would happen: open /dev/sda write partition table close /dev/sda open /dev/sda ioctl (BLKRRPART) close /dev/sda This is rather inefficient, and causes 2 udev change events to be fired for /dev/sda (+ the change events from the BLKRRPART), causing all kind of scanning (blkid & friends) twice. This patch fixes things to only open the device once. 2009-08-26 Petr Uzel dos: adjust variable declarations * libparted/labels/dos.c (write_ext_table): Move declaration of S down to just before its first use. Fix alignment of lba_offset declaration. dos: factor out and define DOS_N_PRI_PARTITIONS * dos.c (DOS_N_PRI_PARTITIONS): Define. dos: use sizeof(variable) instead of sizeof(type) * libparted/labels/dos.c (write_ext_table): Use sizeof(variable) instead of sizeof(type) (write_empty_table, msdos_write): Likewise. tests: t0202-gpt-pmbr.sh: various fixes * tests/t0202-gpt-pmbr.sh: use $bootcode_size variable instead of plain 446. Do not use /dev/urandom since it might not exist. tests: t2300-dos-label-extended-bootcode.sh: various fixes * tests/t2300-dos-label-extended-bootcode.sh: - fix typo where only first 400B of fake bootcode was installed - use bootcode_size variable and increase its value from 440 to 446 - do not use /dev/urandom since it might not exist 2009-08-22 Jim Meyering build: ignore more generated files * .gitignore: Ignore a few more build artifacts. tests: don't use "echo -n" * tests/t7000-scripting.sh: Use printf, not "echo -n", for portability. 2009-08-21 Petr Uzel test for the bootcode-in-extended-partition fix * tests/t2300-dos-label-extended-bootcode.sh: New file. * tests/Makefile.am (TESTS): Add t2300-dos-label-extended-bootcode.sh. do not discard bootcode from extended partition * libparted/labels/dos.c (write_ext_table): Do not discard bootcode from extended partition on msdos label when some of the logical partitions are changed 2009-08-21 Joel Granados Moreno Remove unneeded test. This test made sure that "md" was ignored when doing partition specific actions. We have added code that allows this scan once more, therefore the test is no longer needed. * tests/t6001-dm-ignoremd.sh: Remove file. * tests/Makefile.am: Remove the test file from the list of tests. 2009-08-21 Joel Granados Moreno Compensate for different behavior in t7000 test. When the t7000 test was first engineered the "n" did not appear in the output when testing mkpart & mkpartfs. ATM, for an unknown reason, the "n" is being echoed in the resulting string causing test failure when compared with the errI string. This patch attempts to make both behaviors (with and without the echoed "n") pass the test. * tests/t7000-scripting.sh: Make sure we don't have an " n" at the end of the output string. 2009-08-21 Gilles Espinasse Fix 2 typos. * libparted/labels/fdasd.c (fdasd_enqueue_new_partition): Fix typo in comment. * parted/parted.c (_init_commands): Fix typo in message. 2009-08-18 Jim Meyering build: update dist-check rules * dist-check.mk: Merge from coreutils. build: ignore new -Wjump-misses-init warnings * configure.ac: Ignore warnings from gcc's new -Wjump-misses-init. build: update from gnulib * gnulib: Update submodule to latest. * bootstrap.conf (gnulib_modules): Add update-copyright * cfg.mk (update-copyright-env): Define. 2009-08-12 Otavio Salvador label/dasd: add missing prototype for dasd_get_max_supported_partition_count 2009-08-06 Colin Watson Use fsync rather than O_DIRECT O_DIRECT doesn't work on all filesystems (e.g. tmpfs), and fsync does just as good a job to ensure that buffers are flushed. Based on http://lists.alioth.debian.org/pipermail/parted-devel/2008-August/002392.html by Olaf Hering, but with added fsync/close error checking. 2009-07-31 Joel Granados Moreno Update the NEWS has. * cfg.mk (old_NEWS_hash): Update the NEWS hash. 2009-07-30 Joel Granados Moreno Rescue the news file from the stable-1.8.x branch * NEWS: Add all the contents from the NEWS file from the stable-1.8.x branch. Did some indentation and addeded some "**" where needed. 2009-07-27 Joel Granados Moreno Explicitly handle the signing key. If we are sure that we have the key, we are able to use it in any subroutine (like make major). * build-aux/parted-release (_find_signingkey): New function. (_do_release): Use the key_id to sign the tag and to execute `make major`. 2009-07-27 Joel Granados Moreno Minor corrections to the release README. * README-release: Change "$v" to "$VERSION", its more explicit. Include a reminder to add the definition of parted to the release mail. 2009-07-24 Colin Watson linux: recognize md devices again, but know they can't be partitioned * libparted/arch/linux.c (_skip_entry): Don't skip "md" devices. (_has_partitions): New function; "loop" labels can't be partitioned. (_blkpg_add_partition, _blkpg_remove_partition, _dm_add_partition, _have_blkpg): Don't attempt to apply partition table changes to unpartitionable devices. 2009-07-24 Jim Meyering dos: plug just-introduced leaks on error path * libparted/labels/dos.c (write_ext_table): Also free new buffer on error paths. dos: don't write sector-size (>512) bytes from a 512-byte buffer * libparted/labels/dos.c (write_ext_table): Fix this error reported by valgrind, by allocating/using a sector-sized buffer, rather than using a 512-byte buffer on the stack. Syscall param write(buf) points to uninitialised byte(s) at 0x33E12D13A0: __write_nocancel (in /lib64/libc-2.10.1.so) by 0x432B48: linux_write (linux.c:1782) by 0x42648C: write_ext_table (dos.c:1063) by 0x426471: write_ext_table (dos.c:1059) by 0x4268C5: msdos_write (dos.c:1094) by 0x40E9C4: ped_disk_commit_to_dev (disk.c:479) by 0x40EA08: ped_disk_commit (disk.c:502) by 0x408AE0: test_duplicate (disk.c:79) by 0x4C249ED: srunner_run_all (in /usr/lib64/libcheck.so.0.0.0) by 0x4089AD: main (disk.c:121) Address 0x4e48e00 is 512 bytes inside a block of size 1,024 alloc'd at 0x4A05260: memalign (vg_replace_malloc.c:460) by 0x4A05317: posix_memalign (vg_replace_malloc.c:569) by 0x432B06: linux_write (linux.c:1777) by 0x42648C: write_ext_table (dos.c:1063) by 0x426471: write_ext_table (dos.c:1059) by 0x4268C5: msdos_write (dos.c:1094) by 0x40E9C4: ped_disk_commit_to_dev (disk.c:479) by 0x40EA08: ped_disk_commit (disk.c:502) by 0x408AE0: test_duplicate (disk.c:79) by 0x4C249ED: srunner_run_all (in /usr/lib64/libcheck.so.0.0.0) by 0x4089AD: main (disk.c:121) sun: don't read freed memory * libparted/labels/sun.c (_use_old_info): Rename from _probe_and_use_old_info. Don't read sector 0 here. (sun_write): Read it here instead. Write not a constant-sized 512-byte buffer, but the sector-sized buffer just read above. gpt: adjust _write_pmbr[*] to work with >512-byte sectors * libparted/labels/gpt.c (_write_pmbr): Adjust, to work with larger-than 512-byte sectors. [*] commit 14a15891 "gpt: preserve first 446 bytes of the PMBR" tests: skip t2100-mkswap.sh for >512-byte SS, now that it fails * tests/t2100-mkswap.sh: Use require_512_byte_sector_size_ build: arrange for "make check" to run the tests four times, each using a different simulated partition size. First with an explicit size of 1024, then 2048, then 4096, and finally with the default of 512. * Makefile.am (check-other-sector_sizes): New rule. (check): Depend on it. * README-big-sector: Update accordingly. Suggestion from Otavio Salvador. build: enable many warnings * configure.ac: New configure-time option: --enable-gcc-warnings. * bootstrap.conf: Use gnulib modules: warnings manywarnings. * debug/Makefile.am: Define AM_CFLAGS. * libparted/Makefile.am: Likewise. * libparted/tests/Makefile.am: Likewise. * parted/Makefile.am: Likewise. * partprobe/Makefile.am: Likewise. * debug/clearfat/Makefile.am: Likewise. * libparted/labels/Makefile.am: Likewise. build: avoid new warnings * debug/clearfat/clearfat.c (usage): Declare static. * partprobe/partprobe.c (usage): Likewise. * libparted/cs/natmath.c (abs_mod, extended_euclid): Declare static. * libparted/timer.c (PED_TIMER_START_DELAY): Remove unused definition. * libparted/unit.c (ped_unit_format_custom_byte): Remove an unnecessary cast-to-double. sun: remove obsolete FIXME comments * libparted/labels/sun.c: ui: avoid infloop in testing These commands would provoke an infinite loop: ss=4096 N=100; dd if=/dev/zero of=testfile bs=${ss}c count=$N ./parted ---pretend-input-tty testfile -- mklabel gpt mkpart \ primary ext3 1s -1s < /dev/null * parted/ui.c (command_line_prompt_words): Treat EOF like ^C. tests: skip FS-related part when sector size is larger than 512 * tests/t7000-scripting.sh: Adapt to work with large sector sizes. tests: handle SS>512, clean up, add consistency check * tests/t5000-tags.sh: Don't fail for sector size of 4096 and greater. tests: t4000-sun-raid-type: accommodate arbitrary sector sizes * tests/t4000-sun-raid-type.sh: Make the expected output depend on the sector size. tests: reenable sun label tests * libparted/tests/common.c (_implemented_disk_label): Remove "sun". disk.c: add assertions sun: don't segfault for sector sizes larger than 512 * libparted/labels/sun.c Include "pt-tools.h" and "verify.h". (sun_verify_checksum): Make parameter "const". (sun_probe): Don't always return 0, now that this code works. (sun_probe): Rewrite to work with sector sizes larger than 512. (_probe_and_use_old_info): Likewise. (sun_clobber): Likewise. (sun_read): Likewise. (_check_geometry_sanity) Don't accept all-zeros c,h,s. Add assertions and uses of verify. (sun_alloc): Remove bogus cast. Don't modify through const pointer. msdos: clean-up (no semantic change) * libparted/labels/dos.c (msdos_write): Remove useless initialization. (msdos_clobber): Remove unnecessary cast. msdos: do not scale counts by sector_size/512 * libparted/labels/dos.c (chs_to_sector, linear_start): (linear_end, fill_raw_part, fill_ext_raw_part_geom): (sector_to_chs): Scaling (e.g., a starting sector number) by sector_size/512 loses information when sector_size > 512. Don't do it. parted-ui: when failing, include more information in an unusual case * libparted/cs/geom.c (ped_geometry_set): Include starting sector number and length in diagnostic. To trigger this, run the following: dev=f; rm -f $dev; dd if=/dev/null of=$dev bs=1 seek=100k PARTED_SECTOR_SIZE=2048 ./parted -s $dev mklabel msdos PARTED_SECTOR_SIZE=2048 ./parted -s $dev mkpart primary 1s 40s PARTED_SECTOR_SIZE=2048 ./parted -s $dev p Error: Can't have the end before the start! (start sector=128 \ length=-78) tests: t2200-dos-label-recog.sh: adapt to work with larger sector size Using a 100K image is inadequate for larger sector sizes, since it triggers a bug whereby the device length (in sectors) smaller than the cylinder_size: from dos.c: if (!ped_geometry_init (&start_geom, dev, cylinder_size, dev->length - cylinder_size)) That would pass a negative value for the 3rd argument. * tests/t2200-dos-label-recog.sh: Use an image of size 10MB, not 100K. tests: add infrastructure: when skipping a test, say why * tests/Makefile.am (TESTS_ENVIRONMENT): Arrange for the first line of 'skip_test_'s argument to be printed on stderr. * tests/test-lib.sh (skip_test_): New function. tests: skip FS-related tests when sector size != 512 * tests/test-lib.sh (require_512_byte_sector_size_): New function. * tests/t1000-mkpartfs.sh: Skip when sector size != 512. * tests/t3100-resize-ext2-partion.sh: Likewise. * tests/t3000-constraints.sh: Likewise. * tests/t2000-mkfs.sh: Likewise. * tests/t1700-ext-probe.sh: Likewise. * tests/t1500-small-ext2.sh: Likewise. tests: t0100-print.sh: adjust to work with arbitrary sector size * tests/t0100-print.sh: Parameterize on $sector_size_. Remove sed xform that hard-coded for 2048. tests: revamp t4100-starting-sector.sh to work with other sector sizes * tests/t4100-msdos-starting-sector.sh: Adjust to work with arbitrary PARTED_SECTOR_SIZE. tests: correct t2200-dos-label-recog.sh * tests/t2200-dos-label-recog.sh: Concatenate output from successive partition-creation commands, rather than letting output from the second one clobber that of the first. 2009-07-24 Joel Granados Moreno put the maximum sector checks in pt-tools.c * libparted/labels/dos.c (msdos_partition_check): Use new ptt_partition_max_start_len function to test for len and start maxs. * libparted/labels/dvh.c (msdos_partition_check): Likewise. * libparted/labels/pt-tools.c (ptt_partition_max_start_len): New function. * libparted/labels/pt-tools.h: Likewise. * po/POTFILES.in: Add pt-tools.c to the translation list. 2009-07-24 Joel Granados Moreno put partition-table-specific logic in the corresponding files * include/parted/disk.h (struct _PedDiskOps) [partition_check]: New member function. * libparted/disk.c (_check_partition): Replace open-coded tests with use of the new ->partition_check(). (_partition_max_start, _partition_max_len): Remove functions. * libparted/labels/dvh.c (dvh_partition_check): New function. * libparted/labels/dos.c (dos_partition_check): Likewise. * libparted/labels/aix.c (aix_partition_check): New stub. * libparted/labels/bsd.c (bsd_partition_check): Likewise. * libparted/labels/gpt.c (gpt_partition_check): Likewise. * libparted/labels/loop.c (loop_partition_check): Likewise. * libparted/labels/mac.c (mac_partition_check): Likewise. * libparted/labels/pc98.c (pc98_partition_check): Likewise. * libparted/labels/rdb.c (rdb_partition_check): Likewise. * libparted/labels/sun.c (sun_partition_check): Likewise. 2009-07-24 Jim Meyering * .gitignore: Ignore more. tests: clean up partition-table-testing code * libparted/tests/common.c (_implemented_disk_label): Record here that sun and pc98 are not yet implemented... * libparted/tests/label.c: ...rather than in 4 places in this file. tests: improve coverage in label tests * libparted/tests/label.c (create_disk): Increase image size from 20MB to 80MB, so that tests with PARTED_SECTOR_SIZE=8192 don't fail right away. (START_TEST): Don't skip the "loop" type. It works now. tests: make t8000-loop.sh stop immediately upon failiure * tests/t8000-loop.sh (immediate): ... to avoid cascading. tests: fix the final test failure on RHEL 5.3 * tests/t1700-ext-probe.sh (dev): Use mkfs.$type, not mkfs -t $type. The latter doesn't work on RHEL5: a file system created with "mkfs -F -t ext3" appears to be created as ext2. tests: skip xfs-requiring tests when mkfs.xfs is not installed * tests/test-lib.sh (require_xfs_): New function. * tests/t4100-dvh-partition-limits.sh: Use it. * tests/t4100-msdos-partition-limits.sh: Likewise. tests: skip t7000-scripting.sh if configure without readline Otherwise, that test would fail due to slight differences in output. * tests/Makefile.am (TESTS_ENVIRONMENT): Define CONFIG_HEADER. * tests/t7000-scripting.sh: Skip if configured without readline. tests: don't infloop for manual test invocation with unrecognized option * tests/test-lib.sh: Diagnose an invalid option. tests: add one to exercise the dos/gpt seg-faulting bug * tests/t0300-dos-on-gpt.sh: Test for this bug. * tests/Makefile.am (TESTS): Add it to the list. gpt_clobber: avoid segfault when 512 < sector_size * libparted/labels/gpt.c (gpt_clobber): Rewrite not to use a fixed-size buffer assuming a 512-byte sector. Eliminate entirely a buffer that is allocated (not long enough) and zeroed-out solely so to help zero out a few sectors. Instead, use the new ptt_clear_sectors function. ptt_clear_sectors: new function * libparted/labels/pt-tools.c (ptt_clear_sectors): New function. * libparted/labels/pt-tools.h: Declare. linux_write: use sector_size, not hard-coded 512 * libparted/arch/linux.c (linux_write): Use sector_size, not a hard-coded 512, to find start of last sector. parted/ui.c: Include before everything else * README-big-sector: New file. reenabling probe-related code exposed problems with amiga and bsd * libparted/tests/common.c (_implemented_disk_label): Pretend they're not implemented, so we skip them, temporarily. tests: re-enable "mac" tests * libparted/tests/label.c: Remove "mac" exclusion. 2009-07-24 Jim Meyering mac clone: avoid failed assertion for sector size > 512 * libparted/labels/mac.c (mac_duplicate): Do not assume that the first sector of the partition-map partition is "1". Running this: cd libparted/tests && PARTED_SECTOR_SIZE=1024 CK_FORK=no valgrind ./label would result in a failed assertion: ped_disk_remove_partition (...) at disk.c:1897 1897 PED_ASSERT (part->part_list == NULL, goto error); At first glance, it looked like the free(part) in mac_partition_destroy was the culprit. And removing that free does indeed avoid the failed assertion. However, not only does the name "mac_partition_destroy" imply/require the "free", but all other *_partition_destroy functions free their PART parameter, so removing this free statement cannot be the solution. Another possibility is that mac_duplicate's use of ped_disk_remove_partition is in error. Removing it appears to solve the problem, but I don't know why that code is removing the partition-map partition manually, so can't safely remove such a thing. The real problem is that with >512-byte sectors, the "1" in this code from mac_duplicate is wrong: partition_map = ped_disk_get_partition_by_sector (new_disk, 1); PED_ASSERT (partition_map != NULL, return 0); ped_disk_remove_partition (new_disk, partition_map); E.g., with 1024-byte sectors, the desired partition-map partition starts at sector 2, so the above gets the tiny metadata partition in the gap. Calling ped_disk_remove_partition to remove a metadata partition provokes some nasty corruption. The desired first-sector number is old_mac_data->ghost_size, not "1". 2009-07-24 Jim Meyering * libparted/labels/mac.c (mac_duplicate): Remove dead code. mac partitions pass all label+disk tests @1024 & @2048 sector size * libparted/labels/mac.c (mac_read): Allow for variable sector size. (_pad_raw_part): Likewise. (get_pme): New convenience function, adapted to work for variable sector size and factored out of 4 functions: (_generate_raw_part): ...here, (_generate_raw_freespace_part): ...here, (_generate_empty_part): ...here, (_get_first_empty_part_entry): ...and here. mac.c (_disk_analyse_ghost_size): allow >512-byte sector size * libparted/labels/mac.c (_disk_analyse_ghost_size): mac.c: remove dead code * libparted/labels/mac.c (mac_partition_new): Remove dead code. Return "NULL", not "0". make "mac" partition table support pass the 512-byte ./label tests * libparted/labels/mac.c (mac_probe, mac_clobber): FIX! factor out the read_sector function * libparted/labels/pt-tools.c (ptt_read_sector): New function. Factored out of... * libparted/labels/aix.c (aix_probe, aix_clobber, read_sector): * libparted/labels/bsd.c (bsd_probe, bsd_clobber, bsd_read) (_probe_and_add_boot_code, read_sector): * libparted/labels/dos.c (_, msdos_probe, msdos_clobber) (read_table, msdos_write, msdos_disk_type, read_sector): * libparted/labels/gpt.c (gpt_probe, gpt_disk_type, read_sector): * libparted/labels/loop.c (loop_probe, loop_read, loop_disk_type) (read_sector): * libparted/labels/mac.c (_, mac_probe, mac_read) (write_block_zero, mac_disk_type, read_sector): * libparted/labels/pt-tools.h: Declare. fix >512-byte sector label/disk-test failure * libparted/tests/disk.c: Include xstrtol.h. (get_sector_size): New function: get sector size from the environment. (create_disk): Use the new function to calculate a usable size, rather than hard-coding the 512-byte-sector-specific size of 20MB. * libparted/tests/common.c (_create_disk): Change meaning (and name) of parameter to be size in bytes, not MiB. Adjust callers. * po/POTFILES.in: Add lib/xstrtol-error.c. linux.c: also set phys_sector_size. Must be the same. tests: Phew! finally make t5000-tags.sh work with >512-byte sectors * tests/t5000-tags.sh: Many adjustments, along lines of t0200-gpt. Also, be explicit: bios_boot_magic goes in 2nd *sector*. Don't hard-code 512 for sector-size. We'd get the wrong value for dev->length. * libparted/arch/linux.c (init_file): In computing dev->length, divide by dev->sector_size (not 512) to compute number of sectors. Define dev->sector_size earlier. test basic GPT functionality earlier * tests/t0250-gpt.sh: New file. * tests/Makefile.am (TESTS): Add it. tests: avoid test output mismatch for >512-byte sectors * tests/test-lib.sh (normalize_part_diag_): New function. (sector_size_): New variable. * tests/t7000-scripting.sh: Use them. tests: make t5000-tags.sh less sensitive to >512-byte sector size * tests/t5000-tags.sh: Use -m option and "unit s". FIXME: But still fails when invoked via PARTED_SECTOR_SIZE=2048 ./t5000-tags.sh --verbose --debug t7000-scripting.sh: adapt to work with >512-byte sectors label.c tests: don't skip dvh, now that it works; clean up dvh: probe, read, clobber, write: adapt for >512-byte sectors bsd.c: use pt-tools * libparted/labels/bsd.c: Include pt-tools.h. (bsd_write): Use ptt_write_sector. the beginnings of library partition-table tools * libparted/labels/pt-tools.h: New file. * libparted/labels/pt-tools.c: New file. * libparted/labels/Makefile.am (liblabels_la_SOURCES): Add them. avoid dvh label-clone test failure * libparted/labels/dvh.c (dvh_duplicate): Initialize with ped_disk_new_fresh, not with _ped_disk_alloc. The former sets disk->update_mode = 1, as required (and enforced via an assertion in ped_disk_destroy). * libparted/labels/gpt.c (gpt_clobber): Plug a leak. amiga: Avoid writing uninitialized 1.5KB after initial 512B. 2009-07-24 Jim Meyering disable some file-system-related probe tests for sector size > 512 These changes keep us from recognizing most file systems when the sector size is larger than 512. However, for now (while concentrating on getting partition table support right) that's not a problem. Besides, the code we're avoiding would inevitably make parted smash its stack. * libparted/fs/linux_swap/linux_swap.c (_generic_swap_probe): Fail the swap-file-system-recognizing test when sector size is not 512. * libparted/filesys.c (ped_file_system_probe_specific): Fail all fs-specific probe-related tests when sector size is not 512. * libparted/fs/jfs/jfs.c (jfs_probe): For now, don't even try to deal with larger sector size. * libparted/label.c: Skip tests of problematic file system types. * tests/t0100-print.sh: Print with units of sectors, and adjust expected output accordingly. * tests/t1000-mkpartfs.sh: Use a smaller test file. 2009-07-24 Jim Meyering Fix compile failures. Add fat support for sector_size > 512. avoid compiler warnings * libparted/fs/ext2/interface.c (_ext2_generic_probe): Likewise. (_ext2_clobber): Likewise. Make loop_probe and loop_clobber work with sector_size > 512, too. Still working on making label support work. * libparted/fs/ext2/interface.c (_ext2_generic_probe): The call to ped_geometry_read_alloc would clobber the stack after SB whenever block_size > 512. Instead, use new function, ped_geometry_read_alloc, and adjust all uses of SB. (_ext2_clobber): Likewise. * libparted/cs/geom.c (ped_geometry_read_alloc): New function. * include/parted/geom.h: Declare it. (msdos_clobber): Plug the leak I just introduced. Make "mklabel loop" work with >512 sector_size, even when... there is an existing "msdos" label. (msdos_clobber): Make it work with >512 sector_size. Make "mklabel loop" work with >512 sector_size. Make "mklabel msdos" work with >512 sector_size. Make "mklabel bsd" work with >512 sector_size. Make "mklabel mac" work with >512-byte sector_size. Add a FIXME comment. start to make things work with 2048-byte sector size. Done so far: amiga, bsd, loop, gpt. Fix leaks along the way. remove unused label Add a cast to avoid a warning. 2009-07-24 Jim Meyering allow to simulate linux-file sector size via PARTED_SECTOR_SIZE envvar 2009-07-23 Joel Granados Moreno post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. version 1.9.0 * NEWS: Record release date. 2009-07-23 Jim Meyering Revert "Point gnulib submodule to an existing object ref." This reverts commit 95486a979a8862df9f6f2129c2d9f35221340583. The reverted change mistakenly backdated gnulib to July 14. 2009-07-23 Joel Granados Moreno Little fixes before the release. * README-release: Correct an error in step 5. In step 6 we mean $VERSION. * build-aux/parted-release (_do_release): Use '-F -' to make the NEWS commit. Point gnulib submodule to an existing object ref. * gnulib: Update submodule to latest. Automate the release process. * build-aux/parted-release: New file. Automates the part of the release process that takes place in the local repository. Document our release proceedure. * README-release: New file. Update the NEWS file for the next release. * NEWS : Describe some of the latest bugfixes and behavioral changes. 2009-07-23 Jim Meyering build: update from gnulib, for fixed maint.mk * gnulib: Update submodule to latest. 2009-07-22 Jim Meyering build: avoid "make dist-hook" failure * Makefile.am (dist-hook): Remove coreutils-specific rm-substitution. build: avoid automake warning * libparted/Makefile.am (SUBDIRS_CHECK): Do not redefine. Instead, append to existing value. 2009-07-19 Jim Meyering build: adjust Makefiles * libparted/Makefile.am (ARCH_SOURCE): Factor out duplication. * libparted/labels/Makefile.am (partedincludedir): Split long line. 2009-07-19 Otavio Salvador Avoid compilation failure on s390 To export LinuxSpecific stuff for labels, in this case fdasd, we now provide arch/linux.h. This aids in avoiding code duplication. * configure.ac: add BUILD_LINUX conditional. * libparted/Makefile.am: conditionally use linux.h. * libparted/arch/linux.c: move LinuxSpecific stuff to linux.h. * libparted/arch/linux.h: New file. * libparted/labels/Makefile.am: include from libparted as well. * libparted/labels/dasd.c: use arch/linux.h and use dev->path for error message. * libparted/labels/fdasd.c: include linux.h and drop an unused variable. 2009-07-16 Jim Meyering build: avoid configure-time syntax error Running ./configure on a system without devmapper devel libraries would provoke this: ./configure: line 264: return: but: numeric argument required ./configure: line 24783: --enable-device-mapper: command not found * configure.ac: Add quotes to most AC_MSG_ERROR uses, both around the argument, and (when needed) around the macro use itself. 2009-07-11 Jim Meyering ui: avoid NULL dereference on realloc failure * parted/strlist.c (gettext_to_wchar) [ENABLE_NLS]: Use xrealloc, so we never return NULL, which could then be dereferenced. 2009-07-10 Colin Watson Rationalise linux-swap fs names, and add a "linux-swap" alias * libparted/filesys.c (ped_file_system_alias_register, ped_file_system_alias_unregister, ped_file_system_alias_get_next): New functions. (ped_file_system_type_get): Walk aliases as well. * include/parted/filesys.h (struct _PedFileSystemAlias): New structure. (ped_file_system_alias_register, ped_file_system_alias_unregister, ped_file_system_alias_get_next): Add prototypes. * parted/parted.c (_init_messages): Walk file system aliases as well as types. * parted/ui.c (init_fs_type_str): Likewise. * libparted/fs/linux_swap/linux_swap.c (_swap_v1_type, _swap_v1_open, _swap_v1_probe, _swap_v1_clobber, _swap_v1_ops): Rename to _swap_v0_type etc. to match version number used in mkswap. Update all users. (_swap_v2_type, _swap_v2_open, _swap_v2_probe, _swap_v2_clobber, _swap_v2_ops): Rename to _swap_v1_type etc. to match version number used in mkswap. Update all users. (_swap_v0_type): Rename type from "linux-swap(old)" to "linux-swap(v0)". (_swap_v1_type): Rename type from "linux-swap(new)" to "linux-swap(v1)". (ped_file_system_linux_swap_init, ped_file_system_linux_swap_done): Register/unregister a "linux-swap" alias for "linux-swap(v1)", and deprecated aliases "linux-swap(old)" and "linux-swap(new)". * libparted/labels/misc.h (is_linux_swap): Update comment. * tests/t2100-mkswap.sh: Refer to "linux-swap(v1)" rather than "linux-swap(new)". Test creation via the new alias. 2009-07-09 Jim Meyering tests: disable the taint-distcheck rule * dist-check.mk (taint-distcheck): Disable rule, since it would trigger a bug in libtool-generated scripts. tests: better quoting to avoid failure with poorly-named src directory * libparted/tests/Makefile.am (init.sh): Quote, in case $(abs_top_srcdir) contains e.g., spaces. * tests/Makefile.am (init.sh): Likewise. * libparted/tests/t2000-disk.sh: Better quoting here, too. * libparted/tests/t1000-label.sh: Likewise. Reported by Joel Granados build: update from gnulib * gnulib: Update submodule to latest. * cfg.mk (local-checks-to-skip): Add sc_require_test_exit_idiom. This skips a new-from-gnulib test that doesn't apply here. 2009-06-17 Joel Granados Moreno tests: ensure that we preserve the first 446 byts of a GPT pmbr * tests/t0202-gpt-pmbr.sh: Ensure that the first 446 bytes are unchanged after creating a GPT partition. gpt: preserve first 446 bytes of the PMBR (protective MBR) * libparted/label/gpt.c (_write_pmbr): Make sure we read and preserve the first 446 bytes of the device when we are creating the PMBR. 2009-06-17 Jim Meyering build: update from gnulib * gnulib: Update submodule to latest. build: require autoconf-2.63 and automake-1.11 * configure.ac (AC_PREREQ): Require 2.63, not 2.61. (AM_INIT_AUTOMAKE): Require 1.11, not 1.10c. 2009-06-16 Colin Watson linux-swap: generate UUIDs for fresh swap spaces * libparted/fs/linux_swap/linux_swap.c: Generate a UUID when creating a fresh swap space. * tests/t2100-mkswap.sh: Test that two fresh swap spaces get different UUIDs, and that 'check' preserves the swap UUID. 2009-06-11 Joel Granados Moreno tests: simplify t6001-dm-ignoremd.sh * tests/t6001-dm-ignoremd.sh (md_dev_create_): Use functions in test-util.sh for mdadm commands. Move mddev_ to the top of the file. Remove unneeded comment. tests: add mdadm specific functions * tests/test-lib.sh (require_mdadm_): New function. (mdadm_create_linear_device_): New function. 2009-06-10 Joel Granados Moreno doc: improve mkpart description * doc/parted.texi: Make sure that part-type is portrayed as an optional argument. Mention the "special behavior" that mkpart has with specific disk label types. 2009-06-10 Joel Granados Moreno parted-ui: ensure cmd-line buffer is empty before ped_exception_throw When ped_exception_throw requires input from the user and there are leftover strings in the command line, there is an "invalid token" error from parted. This happens because the ped_exception expects some input that is, most likely, different from the leftover string(s). To address this, one must make sure that all the argument strings are parsed before invoking any exception that requires input. * parted/parted.c (do_mklabel): Call command_line_get_disk_type call before the disk checks (_disk_warn_loss will call ped_exception_throw). * tests/t0000-basic.sh: Adjust, now that the output need not include the error message. 2009-06-10 Joel Granados Moreno tests: verify that "md" devices are not listed * tests/t6001-dm-ignored.sh: New test file. * tests/Makefile.am (TESTS): Add it. linux: skip "md" devices when probing * libparted/arch/linux.c (_skip_entry) : Add "md" to the entries array so all devices of type "/dev/md#" get ignored. 2009-06-10 Joel Granados Moreno fat: support 64KB clusters for FAT16 * libparted/fs/fat/calc.c (fat_max_cluster_size): A 64KB cluster size (128 sectors) for FAT16 is not common but is possible. Allow the use of 128-sector clusters instead of outputting an error. Fixes this: http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/207 Additional info here: http://lists.alioth.debian.org/\ pipermail/parted-devel/2009-June/002882.html 2009-06-10 Matthew S. Harris gpt: fix gpt_read to read all of the partition entries correctly * libparted/labels/gpt.c (gpt_read): Use the SizeOfPartitionEntry field value when reading the partition entries rather than assuming that the entries are the same size as our struct. (gpt_read): When reading the partition entries, round up, not down, the number of sectors to read. (_header_is_valid): Check that the SizeOfPartitionEntry is sane. With minor adjustments by Joel Granados Moreno. 2009-06-10 Joel Granados Moreno Tweak distcheck. * dist-check.mk (install-transform-check): The binaries will be located in /sbin instead of /bin. 2009-06-03 Jim Meyering build: require automake-1.11 via bootstrap.conf, too * bootstrap.conf (buildreq): s/1.10c/1.11/ doc: sync README-hacking from coreutils * README-hacking: update build: rename internal library: lib/libparted -> lib/libgnulib * bootstrap.conf (gnulib_name): Define gnulib_name=libgnulib. * libparted/Makefile.am (libparted_la_LIBADD): Update sole use. libparted: link with gnulib * libparted/Makefile.am (libparted_la_LIBADD): Add $(top_builddir)/lib/libparted.la to the list. * partprobe/Makefile.am (partprobe_LDADD): Remove now-unneeded $(top_builddir)/lib/libparted.la. * libparted/tests/Makefile.am (LDADD): Remove now-unneeded $(top_builddir)/lib/libparted.la. * debug/clearfat/Makefile.am (clearfat_LDADD): Likewise. * parted/Makefile.am (parted_LDADD): Likewise. Otavio Salvador reported that linking with the resulting shared library produced an unresolved reference to last_component. 2009-05-26 Jim Meyering tests: adjust t4100-msdos-starting-sector.sh * tests/t4100-msdos-starting-sector.sh: Use parted's -m option when printing, and adjust expected output to match. Filter out "Disk...:" part to avoid false-positive failures due to mount-point- related differences. 2009-05-26 Joel Granados Moreno Add test for msdos starting sector. * tests/t4100-msdos-starting-sector.sh : Make sure we are consistent when displaying starting sector for msdos lables. 2009-05-26 Joel Andres Granados Make sure we always create msdos metadata parts. Given a disk with no partition, parted did not create metadata partitions for an msdos label. This led to inconsistencies when reporting free space partition ranges. This patch addresses this issue. * libparted/labels/dos.c (get_last_part): Remove function. * libparted/labels/dos.c (get_start_first_nonfree_part): New function. * libparted/labels/dos.c (get_end_last_nonfree_part): New function. * libparted/lables/dos.c (add_startend_metadata): Add code that handles disks no partitions. Add check that prevents the metadata partitions from being greater than the device length. Add check that prevents metadata partitions from overlapping in small devs. 2009-05-26 Joel Granados Moreno Improve readability in linux.c * libparted/arch/linux.c : Gather all the _is_major functions together. change the name of readFD to _read_fd since its not used anywhere else. Also rename the "_is_major_type" function to "_major_type_in_device" as it better expresses what we do in said function. Correctly name virtio devices. * include/parted/device.h (PedDeviceType): Add a new PED_DEVICE_VIRTBLK type to the list. * libparted/arch/linux.c (_is_dm_major): Modify this function so it calls the new _is_major_type function with type "device-mapper". * libparted/arch/linux.c (_is_major_type): Searches a major number inside /proc/devices based on a "type" string. * libparted/arch/linux.c (_is_virtblk_major): New function. Calls _is_major_type with type "virtblk". * libparted/arch/linux.c (_device_probe_type): Add a new PED_DEVICE_VIRTBLK case to the probe possibilities. * libparted/arch/linux.c (linux_new): Add a new PED_DEVICE_VIRTBLK case to the possible device types. * parted/parted.c (do_print): add the "virtblk" string to the transport array. 2009-05-23 Otavio Salvador Makefile.am: fail if ABI has changed configure.ac: fix PED_MINOR_VERSION sed expression add build-aux to .gitignore 2009-05-15 Joel Granados Moreno build: enable device mapper support by default * configure.ac: Device mapper is ubiquitous enough: enable by default. Adjust --help and diagnostics to reflect the new default. 2009-05-15 Jim Meyering portability: don't perform pointer arithmetic on a "void *" pointer * libparted/arch/linux.c (_dm_remove_parts) [ENABLE_DEVICE_MAPPER]: Don't perform pointer arithmetic on a "void *" pointer. Interpose a (char *) cast. maint: cfg.mk: remove now-unnecessary gnulib_dir definition * cfg.mk (gnulib_dir): Remove definition, now that gnulib's maint.mk provides the default we want. build: require 1.10c (get it by building from automake.git) * bootstrap.conf (buildreq): Require 1.10c (1.11 is coming soon) for our use of AM_SILENT_RULES. * configure.ac (AM_INIT_AUTOMAKE): Require 1.10c, for our use of AM_SILENT_RULES. Reported by Joel Granados. build: update from gnulib, for newer maint.mk and more * gnulib: Update submodule to latest. build: use gnulib's vc-list-files module * bootstrap.conf (gnulib_modules): Add vc-list-files, so we pull this file from gnulib. * build-aux/vc-list-files: Remove now-outdated file. 2009-04-26 Jim Meyering build: accommodate maint.mk, now that it's pulled from gnulib * dist-check.mk: New file, from coreutils. Was part of maint.mk. * cfg.mk (old_NEWS_hash): Include $(srcdir)/dist-check.mk. Remove trailing " -", to align with new check in maint.mk. * Makefile.am (EXTRA_DIST): Add dist-check.mk. build: use gnulib's dirname module * bootstrap.conf (gnulib_modules): Add dirname. build: make automake's silent-rules option the default * configure.ac (AM_INIT_AUTOMAKE): Remove silent-rules. Instead,... (AM_SILENT_RULES): Use this, with it's undocumented [yes] argument. Those who want verbose build output may configure with --disable-silent-rules or use "make V=1". build: stop using obsolete gnulib modules * bootstrap.conf (obsolete_gnulib_modules): Remove. (gnulib_modules): Remove use. build: use maint.mk from gnulib * maint.mk: Remove file. Now it's generated. * .gitignore: Ignore it. * bootstrap.conf (gnulib_modules): Add maintainer-makefile. * gnulib: Update submodule to latest. 2009-04-11 Jim Meyering maint: use a git submodule for gnulib * .gitmodules: New file, to track gnulib. * gnulib: New file, created by running this: git submodule add git://git.sv.gnu.org/gnulib.git gnulib 2009-04-10 Jim Meyering maint: sync from coreutils * maint.mk: Sync from coreutils. * bootstrap: Likewise. 2009-04-08 Jim Meyering build-from-git: depend on automake-1.10b * bootstrap.conf (buildreq): Note the automake-1.10b requirement. * configure.ac (AM_INIT_AUTOMAKE): Enable new automake options: dist-xz, color-tests, parallel-tests, silent-rules. 2009-04-08 Otavio Salvador bootstrap.conf: require automake 1.10 since 1.10a is an alpha version 2009-03-21 Jim Meyering * maint.mk: merge with latest from coreutils maint: indent consistently * doc/po4a.mk (updatepo): Replace TAB+8-spaces with two TABs. 2009-03-05 Jim Meyering * bootstrap: sync from coreutils build: enable "make syntax-check" rule to prohibit trailing spaces * cfg.mk (local-checks-to-skip): Remove sc_trailing_blank. remove all trailing blanks ...by running these commands: t=$'\t' git grep -l "[ $t]\$"|xargs perl -pi -e 's/[ \t]+$//' portability: use last_component, not basename * libparted/arch/linux.c (read_device_sysfs_file): Use last_component from gnulib's basename module, not the less-portable "basename" function. (_device_get_partition_range): Likewise. Reported by Karel Zak. * debug/clearfat/Makefile.am (clearfat_LDADD): Link gnulib *after* libparted, not before. * partprobe/Makefile.am (partprobe_LDADD): Likewise. * parted/Makefile.am (parted_LDADD): Likewise. 2009-03-05 Karel Zak test correctly for snprintf failure * libparted/arch/linux.c (_device_get_partition_range): Correct test for failed snprintf. 2009-03-05 Petr Uzel gpt: plug a memory leak in gpt_read() * libparted/labels/gpt.c (gpt_read): Free local variable, "zeros". 2009-03-05 Jim Meyering update some release-related administrivia * .prev-version: Record that the previous release was 1.8.8.1. * NEWS: Fill in the date for the previous release. * cfg.mk (old_NEWS_hash): Update * maint.mk: Sync from coreutils. adjust "parted -s dev print" not to emit trailing spaces * parted/table.c (table_render_row): Don't append trailing spaces or delimiter after final field, and trim any other trailing spaces. * tests/t5000-tags.sh: Remove trailing spaces from expected output. reword a comment; more formatting changes. * libparted/arch/linux.c (_disk_sync_part_table): Reword comment to use the "active" voice, not "we ...". Adjust formatting in new/moved code. 2009-03-05 Jim Meyering rename all "support" parameters; avoid new compiler warnings Change each occurrence like this (which evokes a warning from gcc): - return *supported = MAX_TOTAL_PART; to this: + *max_n = MAX_TOTAL_PART; + return true; I did it mostly mechanically: cd libparted/labels && grep -l 'return .supported = ' *.c|xargs perl -ni \ -e '$m=/^\treturn \*supported( = .*;)/;' \ -e 'print $m ? "\t*max_n$1\n\treturn true;\n" : $_' git grep -l 'int\* supported'|xargs perl -pi -e 's/int\* supported/int *max_n/' That got all but aix.c, which used different spacing: "int *supported", which I changed manually. Then I updated all copyright dates. 2009-03-05 Jim Meyering gpt: adjust formatting and rename a parameter: s/supported/max_n/. * libparted/labels/gpt.c (gpt_get_max_supported_partition_count): Rename parameter: s/supported/max_n/. The latter sounds more like a number, while "supported" sounds boolean at first. 2009-03-05 Joel Granados Moreno Properly sync partitions with operating system * include/parted/disk.h: Add prototypes for new function. * libparted/disk.c (ped_disk_get_max_supported_partition_count): New function that calls the partition-table-specific function. * libparted/arch/linux.c (_disk_sync_part_table): To sync the table in disk with the kernel, we remove all partitions from the kernel table and then add the ones that are in disk. For this to happen we need to calculate the partition-table-type-specific maximum number of supported partitions. * libparted/labels/gpt.c (gpt_get_max_supported_partition_count): Read the gpt header from disk and calculate the maximum number of partitions it can accommodate. * libparted/labels/aix.c (get_max_supported_partition_count): New function. * libparted/labels/bsd.c: Likewise. * libparted/labels/dasd.c: Likewise. * libparted/labels/dos.c: Likewise. * libparted/labels/dvh.c: Likewise. * libparted/labels/gpt.c: Likewise. * libparted/labels/loop.c: Likewise. * libparted/labels/mac.c: Likewise. * libparted/labels/pc98.c: Likewise. * libparted/labels/rdb.c: Likewise. * libparted/labels/sun.c: Likewise. 2009-02-20 Joel Granados Moreno dasd: emit a diagnostic upon probe failure * libparted/labels/dasd.c (dasd_probe): Inform the user when no dasd volumes are present in a device. 2009-02-20 Petr Uzel gpt: avoid failed assertion on big-endian systems * libparted/labels/gpt.c (_parse_header): Compute last_usable_if_grown not as an LE64 value but as a CPU-format one, since we're about to compare it to another. 2009-02-18 Petr Uzel test for the gpt_read failed-assertion fix * tests/t0201-gpt.sh: New file. * tests/Makefile.am (TESTS): Add it. 2009-02-18 Jim Meyering avoid failed assertion when creating a GPT partition table... on top of an old one for a larger device * libparted/labels/gpt.c (gpt_read): Don't assert that the location of the alternate LBA is within the current device. It will be beyond its end when the device it was created for was larger. Instead, just return, treating this like any other non-match. Here's the reproducer: dev=file dd of=$dev if=/dev/null seek=4001 parted -s $dev mklabel gpt dd of=$dev if=/dev/null seek=4000 parted -s $dev mklabel gpt 2009-02-17 Jim Meyering gpt: add a test: printing a partition table must not modify it * tests/t0200-gpt.sh: New file. * tests/Makefile.am (TESTS): Add the new test. 2009-02-17 Petr Uzel gpt: do not automatically "correct" a suspicious GPT partition table Previously, when parted was invoked on a disk with a GPT partition table and the backup GPT was not in the last sector of the disk, and even if the requested operation was just to print the partition table, parted would "repair" this automatically. This behavior is undesirable in the following situation: dm-raid on top of block device. The dm-raid is partitioned with GPT. If the dm-raid starts on the first block of underlying device (AFAIK this is the case with FastTrack controllers) and the user runs parted on the dm-raid, it will identify the physical device as being partitioned with GPT and see the backup GPT table not to be in the last sector of the physical device and thus move it to this location (which may lead to destruction of dm-raid metadata in case they are located at the end of physical device). This patch modifies parted's behavior to ignore fixing of backup GPT position by default. 2009-02-16 Jim Meyering tests: use "compare", not "$compare" * test-lib.sh (compare): Define "compare" as a function, not a variable. * tests/t*.sh: use "compare", not "$compare" 2009-02-13 Jim Meyering don't segfault on a device-mapper device with no target * libparted/arch/linux.c (_dm_maptype): Don't dereference NULL for a device-mapper device with no target. Use the string "NO-TARGET" instead. Reported by Mike Hwang in http://thread.gmane.org/gmane.comp.gnu.parted.devel/2432 2009-02-08 Jim Meyering compile warning-free also with upcoming gcc-4.4 * libparted/fs/fat/fat.c (_gen_new_serial_number): Use a union rather than a warning-provoking cast. Avoids this gcc warning: "dereferencing type-punned pointer will break strict-aliasing rules" 2009-02-07 Jim Meyering clearfat: diagnose an invalid device number * debug/clearfat/clearfat.c: Include and "xstrtol.h". (main): Diagnose an invalid minor device number argument. * bootstrap.conf (gnulib_modules): Add xstrtol. maint.mk: sync from coreutils Revert "don't try to translate 'lib/xstrtol-error.c'" This reverts commit 39adc77de255b7df33e1efb93853c7ccfd4c45f5. Otherwise, "make syntax-check" fails the sc_po_check test. 2009-02-06 Otavio Salvador don't try to translate 'lib/xstrtol-error.c' remove ped_(register|unregister)_disk_type since they were deprecated ped_(register|unregister)_disk_type were remove since they are deprecated since 1.8 releases. The functions ped_disk_type_(register|unregister) are the ones to be used. move architecture specific code since they're used in a single place All architecture headers (linux.h, gnu.h and beos.h) are now removed. The required code has beem moved to the C file that required it. 2009-01-27 Jim Meyering avoid bootstrap failure * bootstrap.conf: Ensure the gnulib-tests/ exists. Reported by Matt Domsch. 2009-01-26 Jim Meyering better m4 quoting * parted/ui.c: Include before any other file. maint.mk: sync from coreutils * po/POTFILES.in: Add lib/xstrtol-error.c. _disk_sync_part_table: revise yet again This fixes a bug whereby parted could leave the kernel with an erroneous view of a partition table. * libparted/arch/linux.c (_disk_sync_part_table): Per analysis in http://thread.gmane.org/gmane.comp.gnu.parted.devel/2297/focus=2307. Patch suggested by Petr Uzel. * bootstrap.conf: sync from coreutils 2009-01-08 Debarshi Ray Differentiate between Ext4 and Ext3 file systems. Fixes http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/188 * libparted/fs/ext2/ext2_fs.h (EXT4_FEATURE_RO_COMPAT_HUGE_FILE, EXT4_FEATURE_RO_COMPAT_DIR_NLINK, EXT4_FEATURE_INCOMPAT_EXTENTS, EXT4_FEATURE_INCOMPAT_64BIT): New constants. * libparted/fs/ext2/interface.c (_ext2_generic_probe): Ext4 file systems will have EXT4_FEATURE_* bits set, while Ext3 will not. (_ext2_probe, _ext3_probe): Pass 2 and 3 respectively, instead of 0 and 1, to _ext2_generic_probe. (_ext4_probe): New function. (_ext4_ops, _ext4_type): New structures. (ped_file_system_ext2_init): Register Ext4 file system type. (ped_file_system_ext2_done): Likewise. * tests/Makefile.am (TESTS): Add t1700-ext-probe.sh. * tests/t1700-ext-probe.sh: New file. 2009-01-08 Jim Meyering fix a "make syntax-check" failure (update copyright date) * doc/parted.texi: Update copyright dates for 2009. 2008-12-23 Jim Meyering avoid "make install" failure with latest GNU make * doc/C/Makefile.am (dist_man8_MANS): Use per-section variable names, as recommended by automake. (man_MANS): Remove redundant definition. 2008-12-23 Tom "spot" Callaway sun partition tables: add support for RAID partition types This patch enables RAID as a supported partition type on Sun disk layouts, commonly found/used on SPARC hardware. It has been tested on Aurora SPARC Linux (and Fedora SPARC). I have no idea if Solaris supports Software RAID or not... Along with the code change, I wrote a test case that checks if the RAID partition type is supported on sun disk labels. * libparted/labels/sun.c [_SunPartitionData] (is_raid): New member. (sun_read): Initialize the ->is_raid member. (sun_partition_new): Clear is_raid, like all the other members. (sun_partition_duplicate): Propagate the is_raid member. (sun_partition_set_system): Make sun_data->type reflect is_raid. (sun_partition_set_flag): Also initialize ->is_raid. (sun_partition_get_flag): Handle PED_PARTITION_RAID. (sun_partition_is_flag_available): Likewise. * tests/t4000-sun-raid-type.sh: New file. * tests/Makefile.am (TESTS): Add t4000-sun-raid-type.sh. 2008-10-10 Harald Welte Add support for SD/MMC storage cards on Linux This patch adds a new SDMMC device type to represent SD/MMC cards. There is nothing special about handling those devices, they are just standard block devices with different names. They use device major ID 179 and are usually called /dev/mmcblkN (where N is the card number) and the individual partitions /dev/mmcblkNpM (where M is the partition number). This patch was developed as part of an effort to make debian-installer support installation of Debian GNU/Linux on SD/MMC cards, as boot-from-SD is becoming a feature seen in mobile x86 devices. 2008-08-20 Petr Uzel Remove obsolete 'i' from parted optstring (--interactive/-i option is not supported anymore) 2008-08-19 Petr Uzel doc: remove obsolete --interactive (-i) option descriptions 2008-08-07 Jim Meyering update build/test infrastructure from coreutils * bootstrap: Update from coreutils. * maint.mk: Likewise. 2008-08-07 Soren Hansen add a test for recently introduced loop-dev-based bug This also checks for the current behavior when trying to partition a device that may not be partitioned, like loop devices. * tests/Makefile.am (TESTS): Add tests/t8000-loop.sh. * tests/t8000-loop.sh: New file. Test for the above fix. 2008-08-07 Jim Meyering don't exhaust virtual memory for mklabel on a loopback device Report and analysis by Soren Hansen : """When ped_disk_get_last_partition_num(disk) fails (which it does if disk is a loopback device), it returns -1. This in turn would cause _disk_sync_part_table and _dm_reread_part_table to attempt to malloc a sizeof(int)*-1, which instantly causes a 'Fatal: Out of memory'.""" * libparted/arch/linux.c (_disk_sync_part_table): Handle the case in which ped_disk_get_last_partition_num(disk) fails. (_dm_reread_part_table): Likewise. This bug was introduced by f6bd20573e3ecfb63f62d88c52a0870fb8851b59. 2008-07-30 Jim Meyering linux.c: plug a leak * libparted/arch/linux.c (_disk_sync_part_table): Free local, "rets". Reported by Mike Hwang . 2008-07-27 Jim Meyering don't call ped_partition_new with "0" as 2nd arg Instead, use an explicit and equivalent PED_PARTITION_NORMAL. * libparted/labels/bsd.c (bsd_read): * libparted/labels/dasd.c (dasd_read): * libparted/labels/gpt.c (_parse_part_entry): * libparted/labels/loop.c (loop_read): * libparted/labels/mac.c (_disk_add_part_map_entry) (_rawpart_analyse): * libparted/labels/pc98.c (read_table): * libparted/labels/rdb.c (amiga_read): * libparted/labels/sun.c (sun_read): 2008-07-18 Joel Andres Granados Document the lack of support for ext3 filesystems. - doc/C/parted.8: Add a message in the KNOWN ISSUES section that describes the lack of support for ext3. Take out some references that were contained in the man page. - doc/parted.texi: Do the same as above to the info page. 2008-07-08 Jim Meyering test for the s/PED_MAX/PED_MIN/ partition-number fix * tests/t4200-partprobe.sh: New file. Test for today's fix. * tests/Makefile.am (TESTS): Add t4200-partprobe.sh. (init.sh): Now that we test partprobe, add $(abs_top_builddir)/partprobe to PATH. * tests/test-lib.sh: Honor new dvhtool_required_ variable. Based on a reproducer from Petr Uzel. fix computation of largest partition number * libparted/arch/linux.c (_disk_sync_part_table): s/PED_MAX/PED_MIN/ (_dm_reread_part_table): Likewise. Patch by Petr Uzel (tiny change). Details in http://thread.gmane.org/gmane.comp.gnu.parted.devel/2213 2008-07-07 Jim Meyering fix to allow compilation with gcc's -fno-common option * libparted/fs/fat/count.h (fat16): Remove bogus (unused) globally-scoped variable declaration. * maint.mk: update from coreutils * parted/parted.c (options): Remove redundant "const" in declaration. 2008-06-26 Jim Meyering * libparted/fs/fat/table.c: Remove a few trailing blanks. avoid a warning from gcc -Wshadow * libparted/fs/fat/table.c (fat_table_duplicate): Rename local s/dup/dup_ft/ to avoid shadowing the function. 2008-06-24 Jim Meyering adjust for const-correctness * libparted/arch/linux.c (_blkpg_add_partition): Make the "part" parameter "const". (_disk_sync_part_table): Make local "part" const. * libparted/arch/linux.c (_disk_sync_part_table): Plug an obvious leak. * configure.ac: Remove useless 'exit's after AC_MSG_ERROR. 2008-06-20 Jim Meyering tests: avoid test failure due to added newline in diagnostic * tests/t3000-constraints.sh: Adapt to changed output syntax. tests: factor out duplication * tests/t7000-scripting.sh: Use a loop rather than two copies of each of 7 tests. tests: use consistent output normalization code * tests/t7000-scripting.sh: same as in e.g., t3000-constraints.sh. Use the same name for all output files, "out", not "out1". tests: avoid failure when run as non-root * tests/t7000-scripting.sh: and avoid some duplication 2008-06-20 Joel Andres Granados Fix the script mode for mkpart and mkpartfs. To: parted-devel@lists.alioth.debian.org Date: Fri, 20 Jun 2008 11:37:41 +0200 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on rho.meyering.net X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.2 tests=AWL,BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.2.5 In scripting mode, parted used to ask the user for confirmation when the values to be used where not the ones specified by the user. * parted/parted.c (do_mkpart, do_mkpartfs): if opt_script_mode is. set fail, if it's not, warn and ask for intervention. * tests/Makefile.am : include the new test in the TEST list. * tests/t7000-scripting.sh : Distribute new test case. 2008-06-10 Guido Guenther move new dmtype member from PedDevice to LinuxSpecific, since this is a Linux-only feature. * include/parted/device.h (struct _PedDevice) [dmtype]: Remove member. * include/parted/linux.h (struct _LinuxSpecific) [dmtype]: Add member. * libparted/arch/linux.c (_dm_maptype, linux_new, linux_destroy): Update uses. 2008-06-08 Jim Meyering adjust tests here (libparted/tests/), as done for tests/ * libparted/tests/Makefile.am (init.sh): Don't emit code to source test-lib.sh. * libparted/tests/t1000-label.sh: Source test-lib.sh, not init.sh. * libparted/tests/t2000-disk.sh: Likewise. fix compile/link problems in libparted/tests Since I didn't have check-devel installed where I'd been testing, nothing was built in libparted/tests/. * libparted/tests/label.c (main): Add argc and argv declarations. * libparted/tests/disk.c (main): Likewise. Reported by Frodo Baggins . * libparted/tests/Makefile.am (LDADD, AM_CPPFLAGS): Define, to compile and link against gnulib-provided functions. (label_CFLAGS, label_LDADD, disk_LDADD, etc.): Adjust. (TESTS_ENVIRONMENT): Define, to propagate top_srcdir to test scripts. 2008-06-06 Jim Meyering skip device-mapper test if support is not enabled * configure.ac: Revamp test; also set ENABLE_DEVICE_MAPPER shell var. * tests/Makefile.am (ENABLE_DEVICE_MAPPER): Propagate to tests. * tests/t6000-dm.sh: Skip all tests w/o device-mapper support. device mapper clean-up: remove #ifdefs, plug a leak * libparted/arch/linux.c: Remove some #ifdef ENABLE_DEVICE_MAPPER directives. * include/parted/device.h (struct _PedDevice) [dmtype]: Likewise. * libparted/arch/linux.c (linux_new): Plug a leak. * tests/Makefile.am (EXTRA_DIST): Add lvm-utils.sh. reflect renaming: dm-utils.sh -> lvm-utils.sh * tests/test-lib.sh: s/dm-utils.sh/lvm-utils.sh/ * tests/dm-utils.sh: Rename this... * tests/lvm-utils.sh: ...to this. protect against bogus absolute srcdir name * test-lib.sh: add quotes to protect against $abs_top_srcdir containing shell meta-characters * test-lib.sh: Guard against bogus $device_mapper_required value in env. sync from lvm-utils.sh source test-lib.sh (not init.sh) from each test * tests/test-lib.sh: Source init.sh early. Use $test_dir_rand_, as done in LVM test framework. Source lvm-utils.sh _after_ defining test_dir_rand_. * tests/Makefile.am (init.sh): Don't emit code to source test-lib.sh, since each test now sources that file directly. * tests/t0000-basic.sh: Source test-lib.sh, not init.sh. Default srcdir=. in each test, so it may be run independently of "make". * tests/t0100-print.sh: Likewise. * tests/t1000-mkpartfs.sh: Likewise. * tests/t1100-busy-label.sh: Likewise. * tests/t1500-small-ext2.sh: Likewise. * tests/t2000-mkfs.sh: Likewise. * tests/t2100-mkswap.sh: Likewise. * tests/t2200-dos-label-recog.sh: Likewise. * tests/t3000-constraints.sh: Likewise. * tests/t3100-resize-ext2-partion.sh: Likewise. * tests/t4100-dvh-partition-limits.sh: Likewise. * tests/t4100-msdos-partition-limits.sh: Likewise. * tests/t5000-tags.sh: Likewise. * tests/t6000-dm.sh: Likewise. * tests/Makefile.am (TESTS_ENVIRONMENT): Pass srcdir to tests. * dm-utils: Restore uses of $test_dir_rand_. * libparted/arch/linux.c (linux_new): Initialize new member. * libparted/arch/linux.c (_dm_maptype): Add space after "if". 2008-06-06 Guido Günther honor DM_DEV_DIR envvar * libparted/arch/linux.c (_dm_maptype): Make libparted handle $DM_DEV_DIR the same way dmsetup does. add basic device mapper tests * tests/dm-utils.sh: New file. Copied from lvm's tests/lvm-utils.sh. * tests/t6000-dm.sh: New file. * tests/test-lib.sh: FIXME * tests/Makefile.am: FIXME 2008-06-06 Jim Meyering avoid useless initialization 2008-06-05 Guido Guenther linux device-mapper map type detection detect the type of the device map and add it to the displayed type information 2008-06-05 Jim Meyering use gnulib's mktempd module/script * bootstrap.conf (gnulib_modules): Add mktempd. * tests/test-lib.sh: Use build-aux/mktempd, not mkdtemp. * tests/mkdtemp: Remove file. * tests/Makefile.am (EXTRA_DIST): Remove mkdtemp. use gnulib's progname module * bootstrap.conf (gnulib_modules): Add progname. * debug/clearfat/clearfat.c: Include "progname.h". (main): Call set_program_name rather than setting program_name. * parted/parted.c: Likewise. * partprobe/partprobe.c: Likewise. * libparted/tests/disk.c: Include "progname.h" and call set_program_name even though program_name isn't used, yet. * libparted/tests/label.c: Likewise. * maint.mk: Merge from coreutils. 2008-05-31 Jim Meyering gpt_write: fix a write-uninitialized error * libparted/labels/gpt.c (gpt_partition_new): ==32570== Syscall param write(buf) points to uninitialised byte(s) ==32570== at 0x36CF8D6540: __write_nocancel (in /lib64/libc-2.8.so) ==32570== by 0x443D29: linux_write (linux.c:1642) ==32570== by 0x414E4E: ped_device_write (device.c:370) ==32570== by 0x4404CE: gpt_write (gpt.c:1091) ==32570== by 0x418F16: ped_disk_commit_to_dev (disk.c:486) ==32570== by 0x418F5C: ped_disk_commit (disk.c:509) ==32570== by 0x40BAD6: do_mkpartfs (parted.c:981) ==32570== by 0x40A035: command_run (command.c:139) ==32570== by 0x412150: non_interactive_mode (ui.c:1540) ==32570== by 0x40EE83: main (parted.c:2487) ==32570== Address 0x501b63a is 58 bytes inside a block of size 16,384 alloc'd ==32570== at 0x4A04FC0: memalign (vg_replace_malloc.c:460) ==32570== by 0x4A0507A: posix_memalign (vg_replace_malloc.c:569) ==32570== by 0x443CED: linux_write (linux.c:1637) ==32570== by 0x414E4E: ped_device_write (device.c:370) ==32570== by 0x4404CE: gpt_write (gpt.c:1091) ==32570== by 0x418F16: ped_disk_commit_to_dev (disk.c:486) ==32570== by 0x418F5C: ped_disk_commit (disk.c:509) ==32570== by 0x40BAD6: do_mkpartfs (parted.c:981) ==32570== by 0x40A035: command_run (command.c:139) ==32570== by 0x412150: non_interactive_mode (ui.c:1540) ==32570== by 0x40EE83: main (parted.c:2487) reproduce with this: dev=f dd if=/dev/null of=$dev bs=1 seek=30M 2>/dev/null ./parted -s $dev mklabel gpt valgrind ./parted -s $dev mkpartfs primary ext2 0 16795000B 2008-05-31 Jim Meyering plug leaks in do_print * parted/parted.c (do_print): 25 bytes in 8 blocks are definitely lost... at 0x4A0739E: malloc (vg_replace_malloc.c:207) by 0x416E67: ped_malloc (libparted.c:234) by 0x41751F: ped_strdup (unit.c:179) by 0x417778: ped_unit_format_custom_byte (unit.c:220) by 0x417A90: ped_unit_format (unit.c:297) by 0x40CD85: do_print (parted.c:1517) by 0x40A035: command_run (command.c:139) by 0x41210C: non_interactive_mode (ui.c:1540) by 0x40EE41: main (parted.c:2482) 10 bytes in 4 blocks are definitely lost... at 0x4A0739E: malloc (vg_replace_malloc.c:207) by 0x416E9B: ped_malloc (libparted.c:234) by 0x417553: ped_strdup (unit.c:179) by 0x4177AC: ped_unit_format_custom_byte (unit.c:220) by 0x417AC4: ped_unit_format (unit.c:297) by 0x40CE34: do_print (parted.c:1527) by 0x40A035: command_run (command.c:139) by 0x412140: non_interactive_mode (ui.c:1540) by 0x40EE75: main (parted.c:2485) 2008-05-31 Jim Meyering plug two more leaks in gpt_write * libparted/labels/gpt.c (gpt_write): 1,024 bytes in 2 blocks are definitely lost... at 0x4A0739E: malloc (vg_replace_malloc.c:207) by 0x416F1B: ped_malloc (libparted.c:270) by 0x43E967: pth_get_raw (gpt.c:334) by 0x44039D: gpt_write (gpt.c:1067) by 0x418F9A: ped_disk_commit_to_dev (disk.c:486) by 0x418FE0: ped_disk_commit (disk.c:509) by 0x40AF7A: do_mklabel (parted.c:622) by 0x40A055: command_run (command.c:139) by 0x4121A4: non_interactive_mode (ui.c:1540) plug a blatant leak in gpt_write * libparted/labels/gpt.c (gpt_write): 1,536 bytes in 3 blocks are definitely lost in loss record 9 of 11 at 0x4A0739E: malloc (vg_replace_malloc.c:207) by 0x416F1B: ped_malloc (libparted.c:270) by 0x44021F: gpt_write (gpt.c:1036) by 0x418F9A: ped_disk_commit_to_dev (disk.c:486) by 0x418FE0: ped_disk_commit (disk.c:509) by 0x40AF7A: do_mklabel (parted.c:622) by 0x40A055: command_run (command.c:139) by 0x4121A4: non_interactive_mode (ui.c:1540) by 0x40EED8: main (parted.c:2499) plug leaks in gpt_write * libparted/labels/gpt.c (gpt_write): 6,674 bytes in 11 blocks are definitely lost... at 0x4A0739E: malloc (vg_replace_malloc.c:207) by 0x416F1B: ped_malloc (libparted.c:270) by 0x43E76D: pth_new (gpt.c:289) by 0x43E7E2: pth_new_zeroed (gpt.c:298) by 0x43FF61: _generate_header (gpt.c:970) by 0x440434: gpt_write (gpt.c:1074) by 0x418F9A: ped_disk_commit_to_dev (disk.c:486) by 0x418FE0: ped_disk_commit (disk.c:509) by 0x40BB35: do_mkpartfs (parted.c:990) plug a leak in gpt_read * libparted/labels/gpt.c (gpt_read): 7,195 bytes in 13 blocks are definitely lost... at 0x4A0739E: malloc (vg_replace_malloc.c:207) by 0x416F1B: ped_malloc (libparted.c:270) by 0x43E759: pth_new (gpt.c:287) by 0x43E83C: pth_new_from_raw (gpt.c:310) by 0x43F329: _read_header (gpt.c:627) by 0x43FB31: gpt_read (gpt.c:826) by 0x41882B: ped_disk_new (disk.c:210) by 0x40B773: do_mkpartfs (parted.c:884) by 0x40A055: command_run (command.c:139) 2008-05-30 Jim Meyering plug leak in ped_device_get_constraint 496 (208 direct, 288 indirect) bytes in 5 blocks are definitely lost... at 0x4A0739E: malloc (vg_replace_malloc.c:207) by 0x416EDF: ped_malloc (libparted.c:270) by 0x41CB40: ped_geometry_new (geom.c:79) by 0x415167: ped_device_get_constraint (device.c:438) by 0x40B928: do_mkpartfs (parted.c:927) by 0x40A055: command_run (command.c:139) by 0x41217C: non_interactive_mode (ui.c:1540) by 0x40EEB1: main (parted.c:2497) 2008-05-30 Jim Meyering plug leaks in parted.c 432 (144 direct, 288 indirect) bytes in 3 blocks are definitely lost... at 0x4A0739E: malloc (vg_replace_malloc.c:207) by 0x416EF3: ped_malloc (libparted.c:270) by 0x41D9D2: ped_constraint_new (constraint.c:100) by 0x4151A4: ped_device_get_constraint (device.c:439) by 0x40B928: do_mkpartfs (parted.c:927) by 0x40A055: command_run (command.c:139) by 0x41217C: non_interactive_mode (ui.c:1540) by 0x40EEB1: main (parted.c:2497) And another: * parted/parted.c (do_mkpartfs): Here's one of the signatures: 288 (96 direct, 192 indirect) bytes in 2 blocks are definitely lost... at 0x4A0739E: malloc (vg_replace_malloc.c:207) by 0x416EF3: ped_malloc (libparted.c:270) by 0x41D9D2: ped_constraint_new (constraint.c:100) by 0x41DE2C: ped_constraint_intersect (constraint.c:232) by 0x40B971: do_mkpartfs (parted.c:930) by 0x40A055: command_run (command.c:139) by 0x41217C: non_interactive_mode (ui.c:1540) by 0x40EEB1: main (parted.c:2497) * parted/parted.c (do_mkpart): Likewise for this function, since do_mkpart is nearly identical to do_mkpartfs. 2008-05-29 Jim Meyering plug a leak in ped_device_get_constraint * libparted/device.c (ped_device_get_constraint): 512 (224 direct, 288 indirect) bytes in 6 blocks are definitely lost... malloc (vg_replace_malloc.c:207) ped_malloc (libparted.c:270) ped_alignment_new (natmath.c:153) ped_device_get_constraint (device.c:432) do_mkpartfs (parted.c:927) command_run (command.c:139) non_interactive_mode (ui.c:1540) main (parted.c:2497) 2008-05-29 Colin Watson Avoid "comparison between signed and unsigned" warning from gcc. * libparted/fs/fat/traverse.c (fat_dir_entry_get_name): Change type of index from int to size_t. 2008-05-29 Jim Meyering remove more useless "if" tests before free * libparted/arch/gnu.c (gnu_sync): * libparted/cs/natmath.c (ped_alignment_destroy): * libparted/exception.c (ped_exception_catch): * libparted/labels/dos.c (msdos_partition_destroy): * parted/parted.c (do_mkpart, do_mkpartfs): Use free, not ped_free. * libparted/libparted.c (ped_free): Remove function. [DEBUG] (_check_dodgy_pointer): Remove function. Global substitution: perl -pi -e 's/\bped_free\b/free/g' $(lid -knone ped_free) * maint.mk: Update from coreutils. test for improved DOS-partition-table recognition * tests/t2200-dos-label-recog.sh: New file. * tests/Makefile.am (TESTS): Add t2200-dos-label-recog.sh. 2008-05-29 Colin Watson bug fix: improve DOS partition table recognition * libparted/labels/dos.c (msdos_probe): Make Parted's partition-table recognition code use the same technique that is used by the Linux kernel and by util-linux's fdisk. I.e., accept it whenever all four boot indicators are 0 or 0x80, rather than using the FAT file system- recognizing heuristic. More analysis here: http://thread.gmane.org/gmane.comp.gnu.parted.devel/2142/focus=2154 Reported by David Balažic here: https://bugs.launchpad.net/ubuntu/+source/parted/+bug/232175 http://thread.gmane.org/gmane.comp.gnu.parted.devel/2142 2008-05-29 Jim Meyering avoid const-related compiler warnings * libparted/arch/linux.c (init_dasd, init_generic): Likewise. * libparted/exception.c (type_strings, option_strings): Likewise. (ped_exception_get_type_string, ped_exception_get_option_string): * libparted/fs/ext2/ext2_block_relocator.c (ext2_block_relocator_flush): * libparted/fs/ext2/ext2_mkfs.c (_set_dirent): Likewise. * libparted/fs/fat/resize.c (ask_type): Likewise. * libparted/fs/fat/traverse.c (fat_traverse_begin): Likewise. * libparted/fs/fat/traverse.h (buffer_size): Likewise. * libparted/labels/mac.c (_rawpart_cmp_type, _rawpart_cmp_name): (_rawpart_is_partition_map, _rawpart_is_boot, _rawpart_is_driver): (_rawpart_has_driver): Likewise. * parted/parted.c (options, options_help, number_msg): Likewise. (label_type_msg_start, flag_msg_start, unit_msg_start): Likewise. (part_type_msg, fs_type_msg_start, start_end_msg, state_msg): Likewise. (device_msg, name_msg, resize_msg_start, copyright_msg, do_print): * parted/ui.c (prog_name, banner_msg, usage_msg, bug_msg): Likewise. (screen_width): Likewise. * parted/ui.h (prog_name): Likewise. 2008-05-06 Otavio Salvador properly test for __s390__ and __s390x__ macros to disable O_DIRECT on that 2008-04-30 Jim Meyering Remove useless "if" tests before free. * libparted/arch/linux.c (_dm_add_partition): Remove useless test. * libparted/labels/fdasd.c (fdasd_cleanup): Likewise. * m4/o-direct.m4 (parted_FIND_USABLE_TEST_DIR): Likewise. * parted/table.c (table_destroy): Likewise. Pass NEWS-checking part of "make syntax-check". * NEWS: Tweak format so it passes. * cfg.mk (old_NEWS_hash): Update MD5 checksum. Exempt a build-related script from the copyright check. * .x-sc_GPL_version: New file. * Makefile.am (EXTRA_DIST): Add .x-sc_GPL_version. Turn off strcmp/STREQ check. * cfg.mk (local-checks-to-skip): Add sc_prohibit_strcmp. * bootstrap.conf (gnulib_modules): Add useless-if-before-free. * doc/parted.texi: Update copyright dates. more updates from gnulib and coreutils * bootstrap.conf (gnulib_modules): Add gitlog-to-changelog. * .gitignore: Add .tarball-version * Makefile.am (EXTRA_DIST): Add .version and .prev-version. (dist-hook): Update rule. (gen-ChangeLog): New rule. * maint.mk: Rename from Makefile.maint and update from coreutils. * cfg.mk: Rename from Makefile.cfg and update from coreutils. use gnulib's gnumakefile module * GNUmakefile: Remove from version control. * bootstrap.conf (gnulib_modules): Add gnumakefile. * .gitignore: Add GNUmakefile 2008-04-29 Matt Davis Corrected a few memory leaks from unallocated ped_unit_format calls. Deallocated memory in do_print() allocated by ped_unit_format calls. Corrected memory leak when displaying partition flags. Deallocated memory allocated by partition_print_flags() 2008-04-26 Matt Davis Corrected a small memory leak when displaying partition information Deallocated a very small memory allocation that occurs in a for loop. This occurred during output of partition numbers. 2008-04-26 Otavio Salvador do not loop in case message exception has no message The exception handler was looping when the exception had no message. 2008-04-24 Otavio Salvador fix memory leak in exception handler The exception handler wasn't freeing the memory when the allocated space wasn't enough to store the error message thus leaving unmanaged memory around. 2008-04-12 Robert Millan Add support for GRUB / BIOS partition in GPT. 2008-04-07 Bastian Blank Fix syntax error. Use host_cpu for s390 check. 2008-03-30 Jim Meyering Fix a typo: s/to defragmenting/to defragment/, Remove trailing blanks. 2008-02-03 Jim Meyering Don't write into line[-1] when line starts with a NUL byte. * parted/ui.c (_readline): Check strlen first. dvh.c (dvh_partition_set_name): Include partition name in diagnostic. Enforce inherent limitations of dos and dvh partition table formats. * libparted/disk.c (_check_partition): Enforce the 32-bit limitation on a partition's starting sector number and length (in sectors). With the usual 512-byte sector size, this limits the maximum partition size to just under 2TB. (_partition_max_start, _partition_max_len): New functions. (_check_partition): Use them. * tests/t4100-msdos-partition-limits.sh: New file. Test vs. msdos. * tests/t4100-dvh-partition-limits.sh: New file. Test vs. dvh. * tests/Makefile.am (TESTS): Add t4100-msdos-partition-limits.sh and t4100-dvh-partition-limits.sh. 2008-02-02 Jim Meyering mkpart: Don't require a DVH partition name if it's guaranteed to fail. The mkpart command has an undocumented feature whereby it prompts for (interactive) or requires (-s) a partition name, *regardless* of whether it already knows the partition type (any thing but 'logical') is incompatible with a name. At first I was pissed and simply #if-0'd the offending code. But in case someone is actually relying on it, I've relented, and merely remove the prompt/requirement when the partition table type is "dvh" and the type of the partition in question is not "logical". * parted/parted.c (do_mkpart): 2008-01-14 Jim Meyering Avoid new error detected by very latest gcc. * libparted/fs/fat/traverse.c (fat_dir_entry_get_name): Don't reference ->extension[3] via a pointer into the prior ->name[8] struct member. gcc detected the reference beyond end of name[8]. Declare first parameter to be "const". * libparted/fs/fat/traverse.c: Update prototype. #ifdef function definitions to match uses, to avoid compiler warnings. * parted/ui.c (mask_signal, s_sigint_handler, s_sigsegv_handler) (s_sigfpe_handler): Change two "extern inline" functions to "static inline". * include/parted/natmath.h (ped_div_round_up): This makes it compilable with bleeding-edge gcc. (ped_div_round_to_nearest): Likewise. * libparted/cs/natmath.c (ped_div_round_up, ped_div_round_to_nearest): Remove definitions. 2007-12-18 Jim Meyering Make inter-release --version output more useful. Now, each unofficial build has a version "number" like 1.8.8.1.19-58dd, which indicates that it is built using the 19th change set (in _some_ repository) following the "v1.8.8.1" tag, and that 58dd is a prefix of the commit SHA1. * configure.ac: Run it to set the version. (PED_MAJOR_VERSION): Derive from $PACKAGE_VERSION. (PED_MINOR_VERSION): Likewise. (PED_MICRO_VERSION): Likewise. Remove the test that would ensure $PACKAGE_VERSION != $PED_VERSION, now that the latter is derived from the former. * Makefile.am (dist-hook): Arrange so that .version appears only in distribution tarballs, never in a checked-out repository. * .gitignore: Add .version here, too. Just in case. * lib/.gitignore: Remove now-generated (by bootstrap) file. * build-aux/.gitignore: Likewise. Ensure that $(VERSION) is up to date for dist-related targets. * GNUmakefile: Arrange to rerun autoconf, if the version reported by git-version-gen doesn't match $(VERSION), but only for dist targets. 2007-12-18 Jim Meyering doc/pt_BR/partprobe.8.pt_BR.po: Remove trailing space in generated file. Distribute new file: architecture.h. libparted/Makefile.am (libparted_la_SOURCES): Add architecture.h. libparted/architecture.c: Include . 2007-12-17 David Cantrell Fix up the ChangeLog generation a bit. We can just take the output of git-log. 2007-12-17 Jim Meyering Perform ChangeLog-creation here, rather than in bootstrap, so that the next merge will be less likely to clobber this parted-specific bit. Mention that we should be able to build with -fno-common. * bootstrap: Update from Coreutils, adapting to changes in gnulib. Among them: now gnulib uses git for version control. * libparted/tests/disk.c (START_TEST): Remove decl of unused local. 2007-11-07 David Cantrell Add flags for BSD disklabels (needed for Linux on Alpha) Patch from Sergey Tikhonov from the AlphaCore project. 2007-11-06 David Cantrell Add KNOWN ISSUES section Add a KNOWN ISSUES section explaining that ext3 resizing does not work and that you should use resize2fs. Always define PED_DEVICE_DM Regardless of compile time options, always define PED_DEVICE_DM. Add 'xvd' to the transports array in do_print For the parted print command, add 'xvd' to the transports array so there is a matching string to display when we print a line for Xen virtual block device. 2007-11-03 Otavio Salvador Move PedArchitecture and ped_set_architecture to private Code that works with libparted isn't suppose to need to change the architecture where it's running and then doesn't make sense to export it. Two new files has been create (libparted/architecture.[hc]) that has the PedArchitecture structure and the ped_set_architecture implementation. All changes that were need to get it suported on all currently available architectures has been done too. 2007-11-02 Otavio Salvador parted/geom.h: move includes to after type definition to avoids dependency parted/device.h: move includes to after type definition to avoids dependency parted/filesys.h doesn't use stdio.h, parted/disk.h and parted/exception.h parted/constraint.h needs parted/geom.h since it uses PedGeometry parted/natmath.h needs parted/device.h since it uses PedSector libparted/cs/natmath.c: remove inline since it's not supported by GNU99 standard parted/device.h needs to include parted/constraint.h since it uses PedConstraint 2007-11-02 Debarshi Ray Removing unnecessary type-casts and eerie comments. 2007-10-29 Mark Neyhart Added information to message about ext2 incompatible features. Modifed the message about incompatible ext2 features installed to include a list of compatible features and to recommend the usage of tune2fs or debugfs to remove features which are not compatible. 2007-08-31 Otavio Salvador Really duplicate the disk instead of readd every partition To avoid possible differences between the original disk layout and the duplicated one, a raw copy is done. Has been identified a case[1] where extended partitions had their positions changed due this. 1. http://bugs.debian.org/294520 The recipe[2] to reproduce the problem, on the provided URI, has been used to produced a test and hence be sure it's not forgotten anymore. 2. http://bugs.debian.org/294520#34 The fix has been produced by Samuel Thibault 2007-08-16 Benno Schulenberg Set partprobe's text domain. * partprobe/partprobe.c (main): Set textdomain. 2007-08-14 Jim Meyering Fix mkpart linux-swap bug: would use 0x83 rather than 0x82 * libparted/labels/bsd.c (bsd_partition_set_system): Include "misc.h". Use is_linux_swap to test whether the type string matches. * libparted/labels/dasd.c (dasd_read, dasd_partition_set_system): Likewise. * libparted/labels/dos.c (msdos_partition_set_system): Likewise. * libparted/labels/mac.c (mac_partition_set_system): Likewise. * libparted/labels/rdb.c (amiga_partition_set_system): Likewise. * libparted/labels/sun.c (sun_partition_set_system): Likewise. Based on a patch by Kenneth MacDonald, from . * libparted/labels/misc.h (is_linux_swap): New function/file. * libparted/labels/Makefile.am (liblabels_la_SOURCES): Add misc.h. * tests/t2100-mkswap.sh: New file, test for the above fix. * tests/Makefile.am (TESTS): Add t2100-mkswap.sh. 2007-08-14 Jim Meyering Don't try to avoid "free (x)" when x is NULL. * libparted/arch/linux.c (linux_read): Part of http://git.debian.org/?p=parted/parted.git;a=commitdiff;h=080d3e7078 changed this: free(diobuf); to this: if (diobuf) free(diobuf); Yet, free doesn't have any problem with NULL. Some very old (non-POSIX) implementations did (like SunOS4), but even for them, gnulib's lib/free.c protects us. 2007-08-14 Jim Meyering Avoid test failure with dash's builtin printf. * tests/t0100-print.sh (msdos_magic): Use more-portable octal escapes, not hexadecimal ones. 2007-08-09 David Cantrell Sanity check for dev, safety checks on diobuf. Make sure diobuf is NULL before we begin and make sure it isn't NULL when we try to free it. Throw an exception if dev is NULL and we enter this function. (cherry picked from commit be2ace6e8d381fb836647234ac65d34a4a547e31) Revert "History with undo and redo capabilities." This reverts commit 3bb8494e1ed5af0a48ad0211c3219e653167854f. 2007-08-08 David Cantrell History with undo and redo capabilities. Author: Matt Davis Here is a working version of the history with undo/redo capabilities. The idea here was based on a talk with Otavio Salvador who mentioned the concepts from Vanni Brutto. The idea being to capture all changes and only apply them all at once. This protects the user from performing an unwanted change. What I did was capture all disk modifications that are committed to disk, and put them in a list. The history manager allows the list to be traversed linearly, so that a change can be undone, viewed in parted (print command), or reapplied again. Nothing actually happens to the physical disk until the 'save' command is issued. Jim Meyering suggested that the functionality might be useful to libparted thus most of the functionality has been moved there. The stdout displays (printf) are placed in parted.c as the library should not do any output printing on its own. Three commands were added: 1) Undo : Undoes a disk modification 2) Redo : Redoes the most recent 'undone' modification 3) Save : Actually commits the list of non-undone modifications to disk I feel a bit more testing needs to be done, but I am happy with the results right now. 2007-08-01 Jim Meyering Revert "If we cannot create a new PedDisk for the device we're looking at, return NULL rather than the device path." The reverted change causes almost all tests to fail. This reverts commit a6f86144c0b5fd07c462e256bc7b54095c7b8e7a. Revert "Removed unused label (compiler warning)." The label *is* used. This reverts commit f4bc90ac22de605ad927d2d85ba468a16bf55ae7. 2007-07-31 David Cantrell Probe for all device-mapper devices. Add _dm_probe_all() from Debian and patch linux_probe_all() to probe for device-mapper devices after probing for standard devices. (cherry picked from commit 609b7ae6d274e479027bb46c4bd10227cd921803) Add the PED_DEVICE_XVD device type for Xen virtual block devices. (cherry picked from commit af4bea2ac854343609f3e6688bedd727ddf76ae6) Detect Xen virtual block devices and identify them as such. (cherry picked from commit 64861efcaae95f605614d5e4c6d9c35c5d5712d7) If we cannot create a new PedDisk for the device we're looking at, return NULL rather than the device path. (cherry picked from commit 865ea3d3f2eb7918b64a00825dfa44e05651e2ad) When reading the DASD disk label, look at the partition flags as well as what is on the actual partition using ped_file_system_probe(). This avoids flags being set for partitions when they shouldn't be. (cherry picked from commit dfafc45a3775cc92d3cd89c9b35926cab23db512) Removed unused label (compiler warning). (cherry picked from commit b43bda3134059cdacb13e1a4d0a0bee8a543cfb0) 2007-07-26 Otavio Salvador Fix bootstrap script to support the new translationproject html files 2007-07-23 David Cantrell Updated GPL license boilerplate. Updated COPYING file to the GNU General Public License version 3. Updated boilerplate GPL text to reference version 3 of the license. 2007-07-10 Jim Meyering Flip the switch (expected-failure -> expected-success) in tests/t3100- resize-ext2-partion.sh, now that this bug is fixed. 2007-07-10 Flavio Leitner Fix block state checking for realocated blocks A busy block should be realocated and it's correct in ext2_block_relocator_mark(), but not in ext2_metadata_push(). 2007-07-10 Flavio Leitner Fix block number used when checking for state Hi there, The ext2_bread() returns a descriptor containing a pointer ->data representing the contents of 1 block. In ext2_block_relocate_grow(), it reads the block bitmap from a group descriptor representing a range of blocks: bh = ext2_bread(fs, EXT2_GROUP_BLOCK_BITMAP(fs->gd[i])); Then it does: k = EXT2_GROUP_INODE_TABLE(fs->gd[i]) + fs->inodeblocks + j; k is the absolute block number and then checks the state doing: if (bh->data[k>>3] & _bitmap[k&7]) The k should be the offset inside of group descriptor and not the absolute block number. Example: . Block bitmap represents 512 blocks . Block absolute number is 1023. GrpDesc = Block absolute number / block bitmap size = 1 bh = ext2_bread(fs, EXT2_GROUP_BLOCK_BITMAP(fs->gd[GrpDesc])) bh->data[] contains a bitmap of 512 blocks from 512-1024 relative = absolute block number % block bitmap size relative = 1023/512 = 511 The block state is in bitmap bh->data[relative>>3] & ... 2007-07-10 Michael Brennan Fix syntax error and LIBS problem in configure.ac Make sure LIBS doesn't contain libraries that will prevent successful compilations after libreadline has been tested. A trailing comma generated a syntax error in the configure script. 2007-07-10 Matthew S. Harris More correct handling of the HeaderSize field in GPT labels - Use the HeaderSize field value when determining how many bytes to compute the CRC over. - Don't abort if the HeaderSize field value is bigger than our struct, since more fields may be defined in the future. 2007-07-06 Jim Meyering Don't let the automatically-generated ChangeLog cause "make dist" failure. * Makefile.cfg (local-checks-to-skip): Add sc_changelog. Let "make distcheck" pass once again. * parted/strlist.c (str_list_alloc): Remove unnecessary cast of xmalloc return value. 2007-07-06 Michael Brennan Fix a problem where a partial read would not be handled correctly; also change the status variable to ssize_t. 2007-07-03 Jim Meyering Don't include config.h from internal headers. This avoids redefinition errors (on the new symbol, __STDC_LIMIT_MACROS_TRIGGER) when config.h is included twice. Bob Proulx reported the buildbot failures: http://buildbot.proulx.com:9001/ 2007-06-22 Jim Meyering Avoid test failure on Linux-2.6.8 due to too small underlying file. Overwrite the label creating a 4KB file; 1KB was too small and would trigger the failure. Reported by Bob Proulx. Work around test failures caused by inadequate libreadline. * configure.ac: Reject an inadequate libreadline5.0. * parted/ui.c (_readline) [!HAVE_LIBREADLINE]: Echo each just-read line, to be consistent with libreadline5.2. Avoid mklabel test failure with very small file on Linux-2.6.8. 2007-06-18 Jim Meyering README-hacking: Don't mention Gzip 1.2.4, now that 1.3.12 is out. Mention uuid-devel and pkg-config, too. 2007-06-12 David Vazquez Replace some malloc and strdup by xmalloc and xstrdup respectively I replace some malloc and strdup by xmalloc and xstrdup respectively. 2007-06-12 Jim Meyering Fix the mkfs final-block-group-too-short bug. mkfs would fail for certain sizes resulting in a final block-group that was too small to accommodate the minimum number of admin blocks. There was already work-around code for when a decremented "numgroups" was 1. This change applies that work-around code for larger values of numgroups, too. Also, there was an off-by-one error in the guard test that would allow a few too-small partition sizes to slip through and provoke the error (see tests/t2000-mkfs.sh for two examples). This change fixes that, too. Fix two "make check"-as-root failures. t1100-busy-label.sh: Remove extra copy of "o2" temporary file name. test-lib.sh (emit_superuser_warning): Exit successfully when run as root, too. 2007-06-11 Jim Meyering Fix inconsistent prompt for file system type. * parted/parted.c (do_mkfs): Use a consistent prompt when asking for a file system type. 2007-06-11 Jim Meyering Add a test to record the current EXT2 mkpartfs failure for some sizes. Run this: dev=F dd if=/dev/null of=$dev bs=1 seek=20M ./parted -s $dev mklabel gpt ./parted -s $dev mkpartfs primary ext2 0 16796160B It fails with this diagnostic: Error: Attempt to write sectors 32772-32773 outside of partition on /t/F. But if you choose a size that's one byte smaller, it works: ./parted -s $dev mkpartfs primary ext2 0 16796159B The difference is in how ext2_mkfs_write_meta computes the number of block groups. In the former case, it computes numgroups = 3. In the latter, numgroups = 2. The trouble with the first case is that there isn't enough space for 3 full block groups in a file system of that size. Hence the eventual attempt to write beyond the initially- established end-of-file-system mark. 2007-06-11 Jim Meyering Avoid unnecessary writes in test scripts. This changes the tests to create sparse files for some test inputs rather than zero-filled non-sparse ones. Doing this cuts more than 50% off the run time of "make check" in the tests/ directory. 2007-06-11 Matt Davis Add a test for an ext2-resize failure. This patch is based on the change from Matt Davis: http://thread.gmane.org/gmane.comp.gnu.parted.devel/1695/focus=1704 Demonstrate an ext2-resize failure in parted-1.8.7, based on the report in http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/22 2007-06-05 Jim Meyering Turn off "DEBUG" in libparted/libparted.c, ... thus making it so that ped_malloc no longer initializes all just-allocated memory to all '1' bits. Given the two bugs I've just fixed, this change is long overdue. 2007-06-05 Jim Meyering Make "mklabel amiga" work also when DEBUG is not enabled. I turned off DEBUG and discovered test failures that its bogus always-initialize-malloc'd-memory policy had been hiding: (amiga_write): Initialize all of "->disk_specific" buffer. Avoid buffer overrun when initializing "TABLE". 2007-06-05 Jim Meyering "mklabel bsd": don't read/write initialized memory, with DEBUG turned off I spent the first part of yesterday debugging the ext2-resize failure. As part of that, I turned off DEBUG and was surprised to see new failures in the label checks. At least for label types "amiga" and "bsd", the implementation required that freshly-allocated memory be filled with all "1" bits, as was guaranteed by the default setting of #define DEBUG 1 When I turned that off, bsd.c would read/write uninitialized memory, and rdb.c(amiga) would do more of the same and produce partition tables that it would then fail to recognize. Here's the fix for the bsd problems. I'll send the rdb/amiga ones separately, and once all tests pass without malloc-initialization-to-all-1's, I'll remove that, too. The bsd read-uninit bug was at bsd.c:341 (bsd_write), with this test: if (!bsd_specific->boot_code [0]) _probe_and_add_boot_code (disk); that first byte was never initialized. So, I figured, that'll be easy. Just initialize it. Wrong. That wasn't enough, since then a part of that same 512-byte buffer (starting at offset 340) would be used uninitialized by a write syscall. FYI, the first failure was demonstrated like this: dev=f N=1M dd if=/dev/zero of=$dev bs=$N count=1 && valgrind ./parted -s $dev mklabel bsd Here's the first one: ==20087== Conditional jump or move depends on uninitialised value(s) ==20087== at 0x4429EE: bsd_write (bsd.c:341) ==20087== by 0x411AD3: ped_disk_commit_to_dev (disk.c:485) ==20087== by 0x411B19: ped_disk_commit (disk.c:508) ==20087== by 0x403A12: do_mklabel (parted.c:622) ==20087== by 0x402AF7: command_run (command.c:139) ==20087== by 0x40B00A: non_interactive_mode (ui.c:1530) ==20087== by 0x407A8B: main (parted.c:2479) and even after initializing only that first byte, here's what I got: ==25692== Syscall param write(buf) points to uninitialised byte(s) ==25692== at 0x54874D0: __write_nocancel (in /usr/lib/debug/libc-2.5.so) ==25692== by 0x41A15C: linux_write (linux.c:1599) ==25692== by 0x40D9CA: ped_device_write (device.c:369) ==25692== by 0x442B1E: bsd_write (bsd.c:368) ==25692== by 0x411AD3: ped_disk_commit_to_dev (disk.c:485) ==25692== by 0x411B19: ped_disk_commit (disk.c:508) ==25692== by 0x403A12: do_mklabel (parted.c:622) ==25692== by 0x402AF7: command_run (command.c:139) ==25692== by 0x40B00A: non_interactive_mode (ui.c:1530) ==25692== by 0x407A8B: main (parted.c:2479) ==25692== Address 0x59E9C01 is 340 bytes inside a block of size 512 alloc'd ==25692== at 0x4A1EC7C: memalign (vg_replace_malloc.c:332) ==25692== by 0x4A1ECD5: posix_memalign (vg_replace_malloc.c:425) ==25692== by 0x41A11A: linux_write (linux.c:1594) ==25692== by 0x40D9CA: ped_device_write (device.c:369) ==25692== by 0x442B1E: bsd_write (bsd.c:368) ==25692== by 0x411AD3: ped_disk_commit_to_dev (disk.c:485) ==25692== by 0x411B19: ped_disk_commit (disk.c:508) ==25692== by 0x403A12: do_mklabel (parted.c:622) ==25692== by 0x402AF7: command_run (command.c:139) ==25692== by 0x40B00A: non_interactive_mode (ui.c:1530) ==25692== by 0x407A8B: main (parted.c:2479) 2007-05-31 Jim Meyering Don't leak a partition table buffer. * libparted/labels/rdb.c (amiga_read): Free the buffer upon success as well as on failure. Correct a misleading diagnostic. * libparted/disk.c (ped_disk_new): Remove always-false "Unable to open" part of diagnostic. Leave the "unrecognized disk label" part. Fix build failure (conflicting decl of strnlen) and clean up * parted/strlist.h: Include first. [!ENABLE_NLS]: Define wchar_t to char here, too, since we no longer include "strlist.h" after the definition in table.c. * parted/table.c: Include and unconditionally, and before wchar_t redefinition. Hoist inclusions of xalloc.h and strlist.h, too. Remove wcwidth and strnlen declarations, since they're guaranteed to be in the gnulib-supplied-if-needed headers. Read an msdos partition table from a device with 2K sectors. * libparted/labels/dos.c: Include . (msdos_probe): Don't hard-code 512. Use read_sector, not ped_device_read. Adapt to changed type of "part_table". Now that "label" is malloc'd, be sure to free it before returning. (read_table): Likewise. 2007-05-30 Jim Meyering Fix "make distcheck" failure due to not finding usable partition * m4/o-direct.m4: Require that read as well as write succeed. Require that both work with blocks of size 512 as well as 4096. Reiserfs3 doesn't support 512-byte reads. Allow the user running the test to specify the first directory to test via the PARTED_TMPDIR envvar, in case none of the dirs checked by default is usable. Fix configure-with-nls vs. wchar.h/wcsdup problem differently. * parted/table.c: Include *before* all other #include directives. Remove explicit declaration of wcsdup. Now, we'll get the one from . 2007-05-29 Otavio Salvador parted/table.c: Fix a warning when compiling with translation support ,----[ Output when compiling with translation support ] |... | table.c: In function 'table_add_row_from_strlist': | table.c:168: warning: implicit declaration of function 'wcsdup' | table.c:168: warning: assignment makes pointer from integer without a cast `---- 2007-05-29 Benno Schulenberg fdasd label: Move formatting out of translatable strings. Also gettextize several missed messages, and simplify some of them. vtoc label: Move formatting out of translatable strings. Also gettextize a few missed messages, and remove some whitespace. 2007-05-29 Jim Meyering Avoid a leak. * parted/parted.c (do_print): Use separate variables for the header and for individual rows. Free each when done. * parted/table.c (table_add_row_from_strlist): Insert a newly allocated copy of each string, so that the caller can free the argument corresponding to the "list" parameter. * tests/t0100-print.sh: New test for this. * tests/Makefile.am (TESTS): Add t0100-print.sh. Move a test/utility function into test-lib.sh. * tests/t3000-constraints.sh (emit_superuser_warning): Move this function to... * tests/test-lib.sh (emit_superuser_warning): ...here. * tests/t0000-basic.sh: Use the function instead of open-coding it. 2007-05-29 Jim Meyering On IRC, xeos reported test failures in t0000 and t2000 with diffs like this: -/home/xeos/projects/parted/parted/.libs/lt-parted: invalid token: msdos +parted: invalid token: msdos Here's the patch I expect to apply. It also removes an inter-part dependency by moving the creation of the "o2" temporary file into the test where it's used. Some of this duplication should be factored out, eventually... 2007-05-25 Jim Meyering Diagnose invalid command arguments. This started because I objected to parted failing with no diagnostic when given an invalid file system type: $ /sbin/parted -s $dev mklabel loop mkpartfs hfsplus 0 1.4 WARNING: You are not superuser. Watch out for permissions. [Exit 1] With the changes below, it does this: $ ./parted -s $dev mklabel loop mkpartfs hfsplus 0 1.4 ./parted: invalid token: hfsplus [Exit 1] The following may look like a simple change, but looks are deceptive... For example, if you try to diagnose via ped_exception_throw instead of "error", you'll find that the mere fact of diagnosing the problem introduces new ones because of how the exception handler manipulates the global command line buffer containing the token we're complaining about. But this isn't library code, so using error() is fine. Diagnose invalid command arguments. When a command argument doesn't match the expected candidate values, parted would silently exit (in script mode) or simply act as if that value and any following ones had not been specified (in interactive mode). With this change, it complains about the "invalid token", and in script mode (where there hasn't been a prompt to give context) sometimes tells what type of token it was expecting. * parted/ui.c: Include "error.h". (command_line_get_word): If the user's "token" wasn't a good enough match, give a diagnostic. In script mode, return NULL so that the callers can give additional information. * tests/t2000-mkfs.sh: New test for the above. * tests/t0000-basic.sh: Expect the new diagnostic when "msdos" is treated as an unrecognized first token after "mklabel". This happens when trying to label a disk that already has a label. * tests/t1100-busy-label.sh: Likewise. 2007-05-25 Jim Meyering Use xmalloc and xrealloc, rather than unchecked malloc and realloc. * parted/table.c: Use gnulib's xmalloc and realloc. Remove anachronistic casts of malloc/realloc return value. Change "sizeof(type)" to safer "sizeof(*var)" (one of the former was wrong, but in a harmless way). Fix off-by-one error in previous change. * parted/strlist.c (str_list_print_wrap): Don't output a space unconditionally. 2007-05-25 Jim Meyering Remove a silly (and dangerous) function. This change has no effect, except in a low-memory condition, where the old code would dereference NULL, the new code no longer performs that malloc. * parted/strlist.c (get_spaces): Remove this function. Not only is it useless, but it also has an unchecked malloc. (str_list_print_wrap): Don't allocate and initialize a string just to print a sequence of N spaces. 2007-05-25 Jim Meyering doc/parted.texi (Static binaries): Correct an invalid example. One cannot specify "primary" for a partition on a loop device. 2007-05-24 Jim Meyering Diagnose "ext2 FS too small" rather than triggering an assertion. * libparted/fs/ext2/ext2_mkfs.c (ext2_mkfs): An overlapping ext2 partition request could still lead to a bug: constraint-resolution code would produce a single-sector candidate "range", and that would cause the ext2 fs-creation code to misbehave. Now, it properly detects and reports the FS as being too small. * tests/t3000-constraints.sh: New test for the above. * tests/Makefile.am (TESTS): Add t3000-constraints.sh. Fix typo in privs-required test setup. * tests/test-lib.sh: Fix typo: s/\$parted/$parted_/. 2007-05-23 Jim Meyering Don't fail all tests when "." lacks O_DIRECT support. I often build tools on a tmpfs file system (it's faster), and found that parted tests always failed there. That's because it tries to open the "device" (a file) with O_DIRECT, and at least the linux tmpfs driver always fails with EINVAL in that case. So here's a patch that makes it work. Since the test may require writing in a directory like /tmp, to which others typically have write access, it is particularly careful about security (see the mkdtemp script below), in case "make check" is run by e.g., root. Don't fail all tests when "." lacks O_DIRECT support. Before, running "make check" on a file system that doesn't support O_DIRECT (e.g. tmpfs), would always fail. Now, it works, as long as the test machinery can find a writable directory in which open with O_DIRECT *does* work. * m4/o-direct.m4: New file. Find a directory/FS with O_DIRECT support. * configure.ac: Use the new macro. * libparted/tests/t1000-label.sh: New file. Wrap the binary, so it can take advantage of the code that finds O_DIRECT supporting FS. * tests/mkdtemp: New file. Required, since when running tests as root, we may have to create a temporary directory in a directory like /tmp that's writable by others. * tests/Makefile.am (EXTRA_DIST): Add mkdtemp. * tests/test-lib.sh: When creating test subdir, and setting up "trap", use the directory specified in $PARTED_USABLE_TEST_DIR. Don't set PATH here. Now, that's done via the generated, and always- sourced, init.sh. As a result, invoke parted via its full file name. 2007-05-19 Jim Meyering Make all tests get their initialization from the same place. * tests/t2000-mkfs.sh: Get initialization via ". ./init.sh", not via ". ./test-lib.sh". * Makefile.maint (sc_test_init): New test, to ensure we stay consistent. 2007-05-18 Jim Meyering * tests/Makefile.am (init.sh): Make this generated file read-only. mkpartfs ext2 2 10 would erroneously report "file system too small" for some small (single-group) partitions. It would also fail to report "file system too small" in some cases, and instead continue on to into inode-allocation code where it'd report "File system full!" * libparted/fs/ext2/ext2_mkfs.c (compute_block_counts): New function, factored out of... (ext2_mkfs): ...here. Call compute_block_counts rather than open-coded it. When decrementing numblocks, call compute_block_counts again, to recompute all of the derived values. Require at least 14 free blocks in a 16-inode-per-group partition. * tests/t1500-small-ext2.sh: New file. Test for the above. * tests/Makefile.am (TESTS): Add t1500-small-ext2.sh. 2007-05-17 Jim Meyering Avoid spurious test failures due to buggy ncurses-5.6. * tests/test-lib.sh: Also unset TERM. 2007-05-16 Benno Schulenberg partprobe: new option: --dry-run, synonym for now-deprecated --no-update; improve its description 2007-05-15 Anant Narayanan Test commit 2007-05-14 David Cantrell Removed clean.sh script. Using git now, we don't need it anymore (git clean -d -x). Use gnulib xmalloc() and xrealloc(). 2007-05-14 Flavio Leitner Fix exception handling in mkpart and mkpartfs Parted mkpart and mkpartfs commands does: ... ped_exception_fetch_all(); if (!ped_disk_add_partition (disk, part, final_constraint)) { ped_exception_leave_all(); ... } ... In mkpart if the ped_disk_add_partition() returns true it skips ped_exception_leave_all() leaving ex_fetch_count = 1. In mkpartfs if the ped_disk_add_partition() returns false it will call ped_exception_leave_all() leaving ex_fetch_count negative. The wrong count in ex_fetch_count will prevent next commands to correctly handle exceptions, failing to prompt users for example. Note: test script t2000-mkfs.sh improved to verify against this issue. 2007-05-11 Jim Meyering * tests/t1100-busy-label.sh: Quote uses of $dev, in case the user's device name contains a shell meta-character. SCALAR(0x7f6040) When labeling a disk in --script mode, fail if it is in use. * parted/parted.c (_disk_warn_busy): In script mode, throw a "PED_EXCEPTION_ERROR", not a warning. (do_mklabel): Guard only the _disk_warn_loss call with "if (!opt_script_mode...", not the _disk_warn_loss call. * tests/t1100-busy-label.sh: New file. Test the above, in interactive mode as well as in script mode. Requires root privilege (to mount a fs), and an actual block device. * tests/Makefile.am (TESTS): Add t1100-busy-label.sh. * tests/test-lib.sh: Add infrastructure to support new privileges_required_=1 and erasable_device_required_=1 settings used by t1100. No longer require "srcdir=." when running a test manually. * tests/Makefile.am (init.sh): New rule, so one doesn't have to set "srcdir=." when running a test manually. * .gitignore: Ignore new generated file: tests/init.sh. * tests/t0000-basic.sh: Source new init.sh, rather than test-lib.sh. * tests/t1000-mkpartfs.sh: Likewise. * tests/t2000-mkfs.sh: Likewise. * tests/test-lib.sh: Remove useless srcdir-setting code. 2007-05-09 Otavio Salvador [parted] Fix script mode support on mkfs commandline command Parted was lacking support to script mode on do_mkfs method hence always failing. Note: tests/t2000-mkfs.sh was created to avoid it to happen again 2007-05-08 Debarshi Ray Preventing compilation of DASD code on GNU Hurd systems through the use of AC_COMPILE_IFELSE and AM_CONDITIONAL, instead of #ifdef. 2007-05-07 Jim Meyering Rewrite integration tests to use a new framework (git's). * tests/t1000-mkpartfs.sh: New file. * tests/t0000-basic.sh: New file. * tests/test-lib.sh: New file. Derived from git's t/test-lib.sh. * tests/lang-default, tests/priv-check: Remove files. * tests/Makefile.am (EXTRA_DIST): Add test-lib.sh. Remove lang-default and priv-check; no longer used. * tests/part-01, tests/label-01: Remove files. * tests/part-02, tests/label-02: Likewise. Merge branch 'inhibit-word-wrap' Merge branch 'include-limits-h-for-CHAR_MAX' Make ---pretend-input-tty inhibit output word-wrap. * parted/ui.c (screen_width): Use effectively-unlimited screen width with ---pretend-input-tty, just as for '--script' mode. Suppress "you are not superuser..." warning in script mode. * parted/parted.c (_init): Do not emit this warning in script mode: "You are not superuser. Watch out for permissions." Avoid "make distcheck" failure, with newer system headers. * parted/parted.c: Include , for use of CHAR_MAX. 2007-05-03 Anant Narayanan Updated Doxyfile 2007-05-02 David Cantrell On the edge branch, labeled the version as 1.9.0 so we can mark it more correctly as the development tree. Whitespace cleanups. Whitespace cleanups. Whitespace cleanups. Whitespace cleanups. Revert "Remove unused label." This reverts commit bfd9a6d8b6322d870650b0e92bd936035ab28e76. Patch from Jim Meyering to linux_write() to support logical sector sizes other than 512 (PED_SECTOR_SIZE_DEFAULT). Fix primary partition cylinder alignment error for DOS disk labels. Fix off-by-one bug in parted when displaying information about the disk label (the disk size, specifically). Do not translate partition names in 'parted print' command. This causes problems for non-Latin-based character sets. Also, we don't want to translate the partition name here as we are just showing what is in the disklabel, translating it distorts what the value is. Also added some malloc checks in table.c. Remove unused label. 2007-05-02 David Cantrell Reverted my patch to configure.ac to remove -Wl,--as-needed from LDFLAGS when checking for libreadline. 2007-05-02 David Cantrell libreadline is a problematic library. Autoconf adds a block to the generated configure script that checks to see if we should be passing the --as-needed flag to ld(1). There are portability reasons this code exists (best I can figure), but it presents a problem when we scan for libreadline. libreadline specifically has unresolved symbols on at least Fedora and RHEL. Why? Well, the developer can choose to provide libtermcap, libncurses, or libncursesw (wide-char support) at compile time which all satisfy the curses API dependency that libreadline has. When the parted configure script runs, it fails on readline because the --as-needed flag causes the linker to not include libncurses even though we already have that on the link line. My solution is to remove the --as-needed flag when we scan for libreadline and then later check for rl_completion_matches() in libreadline. 2007-05-02 David Cantrell More changes to set the version number to 1.8.3. Set version to 1.8.3 for upcoming release. 2007-04-30 Debarshi Ray [tests] Separate and improved test for reading of disk labels. 2007-04-30 Matthew Harris Fix endianness bugs 2007-04-26 Jim Meyering Add integration tests, then adjust code so that they pass. These changes affect how --script (-s) works, and when diagnostics are displayed. * Makefile.am (SUBDIRS): Add tests. * configure.ac (AC_OUTPUT): Add tests/Makefile. * tests/Makefile.am: New file. * tests/part-01, tests/label-01: New files. * tests/part-02, tests/label-02: New files. * parted/parted.c (enum) [PRETEND_INPUT_TTY]: Define. Support a new, undocumented option: ---pretend-input-tty. It is intended solely for testing. The leading '---' ensures that it will never conflict with a "regular" long option. (do_mkpartfs): Prompt only when not in script mode. Call ped_exception_leave_all() to decrement global counter. Without this, the use of parted in tests/part-01 would still fail, but would not issue the diagnostic explaining why. * parted/ui.h (pretend_input_tty): Declare new global. * parted/ui.c (exception_handler): Let the new "pretend_input_tty" option override "!isatty (0)". (init_ui): Don't set opt_script_mode. * tests/lang-default, tests/priv-check: New files. Temporarily disable the clone-dvh-label test. * libparted/tests/label.c (test_clone_label): 2007-04-21 Jim Meyering [PATCH] Avoid warning from -Wformat-security; tweak error diagnostic. * parted/parted.c (_parse_options): Upon failure, output diagnostic to stderr, not stdout. Use "program_name" value, not literal "parted". 2007-04-20 Debarshi Ray [tests] New test for probing of disk labels. 2007-04-20 Otavio Salvador Revert "[libparted] dvh label fixes" This reverts commit dcf8e966abf997b9df69b1664c470ed2aa5c166b. [libparted] dvh label fixes 2007-04-19 Otavio Salvador [tests] Simplify test_clone_label removing the label reading test Since the test_create_label already tests the label reading we shouldn't redo it. It's always better to have simple tests so is much easier to find the bugs. [tests] Trivial coding style fixes around the tests code 2007-04-19 Otavio Salvador [tests] Add _test_exception_handler to fail every time an exception is raised Sometimes parts of code raises exceptions and this shouldn't happen on tests. To ensure we catch them a specific exception handler has been implemented. The handler usage is very easy. You just need to put the following code at testsuite main method: ... /* Fail when an exception is raised */ ped_exception_set_handler (_test_exception_handler); ... 2007-04-19 Debarshi Ray [tests] New test for cloning of disk labels. [tests] Fix spacing around brackets and asterisks. 2007-04-18 Benno Schulenberg Handle options independent of their order. Abort on any invalid option, and handle -v and -h first. 2007-04-18 Otavio Salvador [tests] Small refactoring on test_create_label - Destroy the temporary device once the test has been finished, - Use the _implemented_disk_label and _create_disk_label methods to avoid code duplication. 2007-04-18 Otavio Salvador [tests] Implements _implemented_disk_label and _create_disk_label on common.[hc] - _implemented_disk_label: returns 0 when we haven't yet implemented this specific label and 1 otherwise; - _create_disk_label: creates a disk label of a specific type on a specific device; 2007-04-18 Otavio Salvador [tests] Ensure that we're able to read the just created disk label To ensure we're able to read the just created disk label we introduced a call ped_disk_new using the same loopback. This could detect bad label creating or probing detectiong mistakes. 2007-04-17 Debarshi Ray Indentation fixes in libparted/tests/. 2007-04-16 Debarshi Ray Show the update /etc/fstab message only when there has been a change to the disk. The message is now shorter and more direct. 2007-04-06 solsTiCe d'Hiver change the variable named start to offset to be consistent with the doc 2007-04-05 solsTiCe d'Hiver remove any trace of PED_PARTITION_PRIMARY which was deprecated a long time ago to use PED_PARTITION_NORMAL 2007-04-05 Benno Schulenberg Added 'rescue', 'unit', and 'version' to the man page, plus some small edits. 2007-04-04 Otavio Salvador Avoid segfault due a double free on reiserfs support (patch sent by Jakub Bogusz ) 2007-04-04 Benno Schulenberg Make the wording of warning somewhat clearer. 2007-03-27 Benno Schulenberg Tweak some help messages: change third person to imperative for consistency, add single quotes and remove letters for clarity 2007-03-19 David Cantrell Conditionalize the System Z stuff correctly. We get headers installed on non-System Z platforms, but the code only compiles on that platform. Remove the COMPILE_FOR_S390 flag-setting stuff. It wasn't correct anyway. Take a kernel-style approach and check uname -m to see if we are on s390. If so, we build for zSeries. Otherwise we do not. Sleep for one second after uploading a file to ftp-upload.gnu.org. Seems transactions need to be spaced out a bit otherwise the server will reject files. Fix for compile problems with gcc-4.1.2 as indicated here: http://lists.gnu.org/archive/html/bug-parted/2007-03/msg00008.html Check for tgetent() in libtinfo as well as ncurses, curses, termcap, and termlib. Remove some unused variables, check the return values from fgets() and asprintf(), and remove the unused _dm_remove_map() function. Include vtoc.h for the format1_label_t typedef. Remove GNU make-specific things from po4a.mk. 2007-03-16 David Cantrell Install the libparted.pc file, not the libparted.pc.in file. More spec file template cleanups. Updated the release script to work with the new source layout. 2007-03-16 Debarshi Ray Fixed faulty information in README-hacking (Bison is not a maintainer tool for Parted), and Makefile.maint (every project has certain variations of it). 2007-03-16 Jim Meyering po/POTFILES.in: Add lib/getopt.c 2007-03-15 Debarshi Ray Prevented DASD specific headers and sources from being compiled/installed on non-s390 systems; and conditionally included fdasd.h in linux.h for s390 systems. 2007-03-15 David Cantrell Move static variable flagging little endian or not to journal.c. We don't want static variables in general, but if they must exist, put them in a C file, not a header. Parameterize the little_endian flag for the macros in journal.h. 2007-03-13 David Cantrell Modernize the spec file template. Ignore more files. Patch from Matthew Garrett to add HFS+ resize support. 2007-03-12 Jim Meyering hfs.c: Detect write failure. * libparted/fs/hfs/hfs.c (hfs_extract_file, hfs_extract_bitmap): (hfs_extract_mdb, hfsplus_extract_file, hfsplus_extract_vh): Fail when fclose fails for a written-to file handle. 2007-03-08 Jim Meyering aix.c: Avoid memory overrun. Don't assume logical sector size <= 512B * libparted/labels/aix.c (struct AixLabel): Remove definition. (aix_label_magic_get, aix_label_magic_set): New functions. (read_sector): New function. (aix_probe): Rewrite not to use the above, and not a static buffer. (aix_clobber): Likewise. Also, rather than PED_ASSERT'ing that aix_probe returns 1, simply return 0 if aix_probe returns fails. (ped_disk_aix_init): Remove assertion, now that AixLabel is gone. Use PED_SECTOR_SIZE_DEFAULT not 512 * libparted/arch/beos.c (beos_read, beos_write): * libparted/arch/linux.c (_device_get_length, _device_seek) (linux_read, linux_write, _blkpg_add_partition): * libparted/fs/fat/bootsector.c (fat_boot_sector_read): * libparted/labels/bsd.c (bsd_alloc): * libparted/labels/dos.c (probe_filesystem_for_geom): * libparted/labels/rdb.c (amiga_read): * parted/ui.c (non_interactive_mode): Plug a tiny leak. Exercise by running the following with a CD-ROM in the drive: valgrind --leak-check=full parted/parted /dev/cdrom print Before, we'd leak the 6-byte command: "print\0". linux.c: Avoid memory overrun. Handle 2048-byte logical sectors. * libparted/arch/linux.c (linux_read): Allocate the right amount of space for the (potentially 2048-byte-long) sectors we're about to read. 2007-03-07 Jim Meyering Don't use deprecated mktemp, to avoid linker warning * libparted/tests/common.c (_create_disk): Rewrite to use mkstemp instead. * libparted/tests/label.c: Plug a trivial leak. 2007-03-07 Debarshi Ray Merge branch 'master' of git+ssh://rishi-guest@git.debian.org/git/parted/parted 2007-03-07 Debarshi Ray Replaced [f]printf with fput[c|s] globally. 2007-03-07 Jim Meyering libparted/unit.c: constify interfaces * include/parted/unit.h (PED_UNIT_LAST): * libparted/unit.c (ped_unit_get_size): (ped_unit_format_custom_byte, ped_unit_format_byte): (ped_unit_format_custom, ped_unit_format, ped_unit_parse): (find_suffix, parse_chs, clip, geometry_from_centre_radius): (ped_unit_parse_custom): Declare some static arrays to be "const". * libparted/labels/dos.c (MBR_BOOT_CODE): * libparted/labels/efi_crc32.c (crc32_tab): * libparted/labels/pc98.c (MBR_BOOT_CODE): * libparted/labels/vtoc.c (EBCtoASC, ASCtoEBC): * configure.ac: Fix a typo: s/have_scintilla/have_check/ tests/label: Don't dereference NULL if open fails. * libparted/tests/label.c (START_TEST): Return right away if ped_device_get returns NULL. Add "const" to parameters in these public interfaces. * libparted/disk.c (ped_disk_check): (ped_disk_get_primary_partition_count): (ped_disk_get_last_partition_num, ped_partition_print): (ped_disk_print): (ped_partition_print): Also declare to be "static". This is ok, since the function is referenced only from this file. * include/parted/disk.h: Update their prototypes. Use consistently, not "config.h". * Makefile.cfg (local-checks-to-skip): Remove sc_require_config_h, to enable the "make distcheck" test for this. 2007-03-06 David Cantrell start_pos is a PedSector, not a PedGeometry. 2007-03-06 David Cantrell Preserve starting sector for primary NTFS 3.1 partitions (Windows Vista) when modifying the DOS disk label. NTFS 3.1 partitions do not start on the 2nd head of the 1st cylinder at the beginning of the drive. Patched parted.8 man page to show partition names apply to GPT disk labels as well as Mac and PC98 disk labels. 2007-03-06 Debarshi Ray Replaced [f]printf with fput[c|s] in libparted/fs/ext2/ext2_block_relocator.c. Re-arranging .gitignore in alphabetical order. Defined a dummy '_dump_history' function in parted/ui.c when Readline is absent. Thanks to Jim Meyering for the suggestion. Added libparted/tests/label to .gitignore. Fixed parted/ui.c to incorporate signal handlers for systems lacking 'sigaction', 'SA_SIGINFO', and other constants in signal.h. 2007-03-05 Jim Meyering Undo part of the dos.c constification. * libparted/disk.c: The sole parameter of ped_disk_type_register and ped_disk_type_unregister must *not* be const. * libparted/labels/dos.c (msdos_disk_type): Likewise for the corresponding static struct in dos.c, since those functions modify the struct. This didn't show up at compile time due to casts. * include/parted/disk.h: Update prototypes, too. Hide two unnecessarily-"extern" functions. * libparted/labels/mac.c (mac_alloc): Declare static. * libparted/labels/dos.c (raw_part_parse): Declare static. * libparted/labels/dos.c: Complete constification of this file. * libparted/disk.c (ped_disk_type_register): Make the sole parameter "const", so that caller's argument may be "const". (ped_disk_type_unregister): Likewise. * po/POTFILES.in: Add partprobe/partprobe.c, now that it contains translatable strings. Make partprobe accept --help and --version options. Add long options: --no-update (same as existing -d), and --summary (same as existing -s). * partprobe/partprobe.c Include configmake.h, getopt.h, and NLS-related things. (main): Rewrite option handling. Along the way, fix a bug whereby "partprobe DEV1 DEV2 ... DEVN" would exit successfully whenever process_dev (DEVN) returns nonzero, even when that function fails for each of the preceding devices. Make clearfat accept --help and --version options. * debug/clearfat/clearfat.c (AUTHORS, PROGRAM_NAME): Define. Include gettext-related things. Include closeout.h. (usage): New function. (main): Set up for translations, use close_stdout. * bootstrap.conf: Add long-options, for clearfat. * debug/clearfat/Makefile.am: Use gnulib. * include/parted/disk.h (struct _PedDiskOps) [write]: Change parameter type to be "const". Begin making libparted/labels/*.c const-correct. For an introduction, see http://mail-archive.com/parted-devel@lists.alioth.debian.org/msg00930.html In particular, I've used a const-adding case in mac.c to work around the current, inconsistent semantics of mac_write. Avoid a libtool warning: libtool: link: warning: `-release' is ignored for convenience libraries * libparted/labels/Makefile.am (liblabels_la_LDFLAGS): Don't define. Make "make distcheck" work better. * Makefile.cfg (local-checks-to-skip): Skip sc_system_h_headers, too. * Makefile.maint (my-distcheck): Don't depend on $(release_archive_dir). 2007-03-02 Jim Meyering Avoid recursive "LIBS = ... $(LIBS)" assignments. * libparted/labels/Makefile.am (liblabels_la_LIBADD): Add $(INTLLIBS) here rather than via a recursive LIBS = ... $(LIBS) assignment. * libparted/fs/Makefile.am (libfs_la_LIBADD): Likewise. 2007-03-02 Jim Meyering Use $(VAR), rather than obsolescent @VAR@ automake notation. Enable the makefile-check rule. * Makefile.cfg: Remove makefile-check from the list of rules to skip. * Makefile.am: change e.g., @VERSION@ to $(VERSION). * debug/clearfat/Makefile.am: Likewise. * libparted/Makefile.am: Likewise. * libparted/fs/Makefile.am: Likewise. * libparted/fs/amiga/Makefile.am: Likewise. * libparted/fs/bfs/Makefile.am: Likewise. * libparted/fs/ext2/Makefile.am: Likewise. * libparted/fs/fat/Makefile.am: Likewise. * libparted/fs/hfs/Makefile.am: Likewise. * libparted/fs/jfs/Makefile.am: Likewise. * libparted/fs/linux_swap/Makefile.am: Likewise. * libparted/fs/ntfs/Makefile.am: Likewise. * libparted/fs/reiserfs/Makefile.am: Likewise. * libparted/fs/ufs/Makefile.am: Likewise. * libparted/fs/xfs/Makefile.am: Likewise. * libparted/labels/Makefile.am: Likewise. * libparted/tests/Makefile.am: Likewise. * parted/Makefile.am: Likewise. * partprobe/Makefile.am: Likewise. The above conversion caused a problem: * libparted/Makefile.am: Remove this recursive definition: LIBS = @INTLLIBS@ @LIBS@. Once converted to LIBS = ...$(LIBS), GNU make would (rightly) fail, objecting to the recursive definition. (libparted_la_LIBADD): Instead, add $(INTLLIBS) here. 2007-03-02 Jim Meyering Enable the po-check rule. * Makefile.cfg (local-checks-to-skip): Remove po-check. * po/POTFILES.in: Add a bunch of names of files that contain translatable strings. Remove some which contain none. Add infrastructure for more rigorous "make distcheck" rules. * GNUmakefile: New file. * .prev-version: New file. * Makefile.am (MAINTAINERCLEANFILES): Remove names of files now in build-aux/. (distcheck-hook): New rule, to run the checks in Makefile.maint. (EXTRA_DIST): Add .prev-version. * Makefile.maint: New file. Improved "make distcheck" rules. * Makefile.cfg: Select which Makefile.maint checks to run. (local-checks-to-skip): List all currently-failing and irrelevant tests here. * build-aux/vc-list-files: New file. List version-controlled files. * .gitignore: Remove build-aux, since now it contains a version-controlled file. 2007-03-01 Debarshi Ray Fixing indentation in parted/ui.c. Replaced TABs with spaces to ensure uniformity in all editors. 2007-02-28 Debarshi Ray Fixing indentation in parted/ui.c. 2007-02-27 Jim Meyering Normalize the way we handle a generated-and-distributed file, parted.spec. * Makefile.am (EXTRA_DIST): Add parted.spec. (parted.spec): New rule. (MAINTAINERCLEANFILES): Add parted.spec. * configure.ac (AC_OUTPUT): Remove parted.spec from the list. Add -I$(top_srcdir)/lib, required for new use of close_stdout. * partprobe/Makefile.am (partedincludedir): Arrange for "make distcheck" to be stricter. 2007-02-26 Jim Meyering * bootstrap: new file. 2007-02-26 Debarshi Ray Fixing libparted/arch/gnu.c to remove build-time errors. 2007-02-25 Jim Meyering partprobe: Detect/report any error when writing to stdout. * partprobe/Makefile.am (partprobe_LDADD): Add lib/libparted.la. * partprobe/partprobe.c: Include "closeout.h" for close_stdout. Include "version-etc.h" for version_etc prototype. Declare global, program_name. (PROGRAM_NAME, AUTHORS): Define. (help): Use PROGRAM_NAME, rather than hard-coding it. (version): Use gnulib's version_etc. (main): Set program_name. Use atexit to close stdout carefully upon exit. Add a bunch of .gitignore files. Avoid a gcc format warning: * debug/clearfat/clearfat.c (_do_help): Use fputs, not printf. Remove now-generated files. * po/ca.po, po/cs.po, po/da.po, po/de.po, po/es.po, po/fr.po: * po/gl.po, po/id.po, po/it.po, po/ja.po, po/nl.po, po/nn.po: * po/pl.po, po/pt.po, po/pt_BR.po, po/ru.po: * po/sv.po, po/tr.po, po/uk.po, po/vi.po, po/zh_CN.po, po/zh_TW.po: * po/Makevars: Remove now-generated file. * po/parted.pot: Remove -generated file. mv parted.m4 into new dir, m4/ * Makefile.am (EXTRA_DIST): Remove parted.m4. Now that it's in m4, it's included automatically. (aclocal_DATA): Remove unnecessary definition. * libparted/tests/label.c: Fail if _create_disk returns NULL. Make global and functions static. * libparted/tests/common.c (_create_disk): Handle fopen failure. Handle fclose failure. Include from every .c file: * libparted/unit.c, libparted/timer.c: * libparted/cs/natmath.c, libparted/cs/constraint.c: * libparted/tests/label.c, libparted/tests/common.c: * libparted/fs/fat/count.c, libparted/fs/fat/bootsector.c: * libparted/fs/fat/context.c, libparted/fs/fat/fatio.c: * libparted/fs/fat/fat.c, libparted/fs/fat/clstdup.c: * libparted/fs/fat/resize.c, libparted/fs/fat/traverse.c: * libparted/fs/fat/table.c, libparted/fs/fat/calc.c: * libparted/fs/amiga/amiga.c, libparted/labels/fdasd.c: * libparted/labels/dvh.c, libparted/labels/efi_crc32.c: * libparted/labels/vtoc.c, parted/command.c: * libparted/tests/label.c, libparted/tests/common.c: * libparted/libparted.c: Include "configmake.h" for LOCALEDIR defn. parted: Detect/report stdout write errors. * parted/parted.c: Include "closeout.h" for close_stdout. Include "configmake.h" for LOCALEDIR definition. Include "version-etc.h" for version_etc prototype. Declare global, program_name. (PROGRAM_NAME, AUTHORS): Define. (_version): Use gnulib's version_etc. (main): Set program_name. Use atexit to close stdout carefully upon exit. Include , not "../config.h". Begin adjusting Makefile.am files to use gnulib. * libparted/Makefile.am (partedincludedir): Add -I$(top_srcdir)/lib. * parted/Makefile.am (parted_LDADD): Add lib/libparted.la. (partedincludedir): Add -I$(top_srcdir)/lib. 2007-02-25 Jim Meyering Update to use gnulib, and newer autoconf, automake conventions. Add build-from-checkout instructions. * README-hacking: New file. Mostly copied from coreutils' README-cvs. * bootstrap: Generate ChangeLog here, if needed/possible, before invoking tools that require its presence. * autogen.sh: Remove this file. It's superseded by bootstrap. Use gnulib, modernize some uses of autoconf, automake, etc. * bootstrap, bootstrap.conf: New files. * configure.ac: Modernize. Require the latest stable releases: autoconf-2.61, automake-1.10. Require gettext-0.15. Use more modern form of AC_INIT, etc. Now that the version string must be hard-coded in the AC_INIT line, add code to ensure it agrees with the PED_* and LT_* variables. Use AM_CPPFLAGS, not CFLAGS Remove obsolete setting of ALL_LINGUAS. Don't set CFLAGS=-D_GNU_SOURCE=1 explicitly , since that's already done via AC_GNU_SOURCE, which gnulib pulls in by default, through gl_EARLY. Use gl_INIT and gl_EARLY. * Makefile.am (SUBDIRS): Add lib. (EXTRA_DIST): Remove names that are automatically included. * lib/Makefile.am: New file. 2007-02-23 Anant Narayanan Fix memleaks. Patch thanks to Mike Hommey 2007-02-18 Debarshi Ray Introduced MAINTAINERCLEANFILES in Makefile.am for carrying out 'make maintainer-clean'. Cleaning up nested structs & unions. 2007-02-16 Jim Meyering Avoid compiler warnings with gcc -Wall -Wshadow. * libparted/arch/linux.c (init_ide): Add missing "break" at end of final case: stmt. Add "default:" in the same switch to avoid a compiler warning. * libparted/fs/fat/bootsector.c (fat_boot_sector_analyse): Likewise. * libparted/fs/fat/resize.c (ask_type): Likewise. * libparted/fs/fat/traverse.c (fat_dir_entry_set_first_cluster): Likewise. * debug/clearfat/clearfat.c (_calc_fat_entry_offset): Likewise. * parted/parted.c (_timer_handler): Cast time_t values to "int" to agree with %d printf format. (g_timer): Rename file-scoped global from shadowed "timer". Update all uses of the global. (version_msg): Remove decl of unused global. * parted/ui.c (current_exception_opt): Remove decl of unused global. * libparted/filesys.c (ped_file_system_close): Remove unused label. * libparted/unit.c (parse_chs): Likewise. * libparted/debug.c (ped_assert): Use "int" as type of backtrace return value, not size_t. * libparted/fs/reiserfs/reiserfs.c (reiserfs_check): Guard declaration of local with #ifdef HAVE_REISERFS_FS_CHECK, since it's used only in a similarly-guarded block. (reiserfs_fs_check): Likewise for this file-scoped global. Avoid warnings about unused file-scoped global variables. * libparted/fs/hfs/hfs.h (hfs_type, hfsplus_type): Remove these declarations of file-scoped static variables. * libparted/fs/hfs/hfs.c: Put them here, instead. * libparted/fs/fat/table.c (_test_code_active): Remove unused function. * libparted/arch/linux.c: Add casts to avoid performing pointer arithmetic on "void *" pointers. * libparted/fs/hfs/file_plus.c (hfsplus_file_read): Don't do pointer arithmetic on a "void *" pointer. (hfsplus_file_write): Likewise. * libparted/fs/fat/count.c (flag_traverse_dir): Move decl of unused local into #if-0'd block where it is referenced. (print_chain): Guard definition with #ifdef PED_VERBOSE, since the sole use of this function is guarded the same way. * libparted/fs/amiga/amiga.c: (_amiga_valid_block_id): Remove unused function. (_amiga_get_bstr): Likewise. (_amiga_set_bstr): Likewise. Remove unused labels and/or declarations of unused variables. * parted/ui.c (_readline): Likewise. * libparted/cs/constraint.c (_constraint_get_canonical_start_range): Likewise. * libparted/cs/geom.c (ped_geometry_read): Likewise. * libparted/fs/amiga/apfs.c (_generic_apfs_probe): Likewise. * libparted/fs/ext2/ext2_mkfs.c (ext2_mkfs_write_meta): Likewise. * libparted/disk.c: Likewise. * libparted/fs/hfs/hfs.c: Likewise. * libparted/fs/fat/fat.c: Likewise. * libparted/fs/fat/clstdup.c: Likewise. * libparted/fs/fat/calc.c: Likewise. * libparted/fs/ext2/ext2.c: Likewise. * libparted/fs/amiga/affs.c: Likewise. * libparted/fs/amiga/asfs.c: Likewise. * libparted/labels/aix.c: Likewise. * libparted/labels/sun.c: Likewise. * libparted/labels/pc98.c: Likewise. * libparted/labels/mac.c: Likewise. * libparted/labels/dos.c: Likewise. * libparted/labels/loop.c (loop_alloc): Likewise. * libparted/labels/gpt.c: Likewise. * libparted/labels/dvh.c (dvh_alloc): Likewise. (dvh_read) [!DISCOVER_ONLY]: Add "default:" in a switch. * libparted/labels/fdasd.c (fdasd_reread_partition_table): Remove decl of unused local(s). (fdasd_get_partition_data): Likewise. (fdasd_partition_type): Remove unused function. (fdasd_write_vtoc_labels): Likewise. (fdasd_change_volser): Likewise. (fdasd_check_volser): Likewise. (fdasd_reread_partition_table): Likewise. 2007-02-16 Jim Meyering * libparted/labels/rdb.c (amiga_read): Remove decl of unused local(s). * libparted/labels/bsd.c (bsd_partition_new): Remove unused label. * libparted/labels/dasd.c: Remove unused labels and declarations of unused variables. 2007-02-15 Debarshi Ray Fix the style of typedef, enum, struct and __attribute__ ((packed)). 2007-02-14 Debarshi Ray Deprecating ped_[register|unregister]_disk_type in favour of ped_disk_type_[register|unregister]. 2007-02-14 Jim Meyering Use lighter-weight fputs and putchar in place of printf, when possible. * parted/ui.c (wipe_line, _dump_history, reset_env): (sigsegv_handler, sigfpe_handler, sigill_handler, _readline): (help_msg, interactive_mode, non_interactive_mode): Use puts, fputs, and putchar in place of printf, when possible. (reset_env): Correct misleading indentation. (wipe_line): Split a long string. Make it so "make distcheck" passes. * doc/po4a.mk (updatepo): Don't choke when *.$(lang).po matches no file. * doc/C/Makefile.am (updatepo): Don't do anything when $(srcdir) is not writable. 2007-02-14 Debarshi Ray Fixed the copyright notices. Cleaned up the formatting of AUTHORS. Tidying up the formatting and comments in linux_swap.c. 2007-02-13 Jim Meyering Don't define _GNU_SOURCE manually. It's better not to define _GNU_SOURCE manually. By using AC_GNU_SOURCE, you get the definition in exactly one place: in config.h. I verified that each affected file also includes config.h. Don't define _GNU_SOURCE manually. * configure.ac: Use AC_GNU_SOURCE instead. * libparted/arch/gnu.c: Remove definition of _GNU_SOURCE. * libparted/arch/linux.c: Likewise. * libparted/device.c: Likewise. * parted/table.c: Likewise. * parted/table.h: Likewise. 2007-02-13 Jim Meyering Remove some #ifdefs Remove some #ifdefs. * parted/table.c (L_): define. Remove in-function #ifdefs; use L_(str) instead. * libparted/labels/fdasd.c (GETARG): Remove unused definition. A tiny change... 2007-02-13 Otavio Salvador Create 'm4' directory when generating the building system 2007-02-13 Jim Meyering Work with automake-1.10. I've just tried building parted from scratch (running ./autogen.sh after git-clone) and hit a couple of snags: Without aclocal's -I m4, ./autogen.sh produced this: configure.ac:192: warning: macro `AM_GNU_GETTEXT_VERSION' not found in library configure.ac:193: warning: macro `AM_GNU_GETTEXT' not found in library configure.ac:192: error: possibly undefined macro: AM_GNU_GETTEXT_VERSION If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. With automake-1.10, I got this: parted/Makefile.am:5: compiling `command.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac' Here's a patch that fixes those and also removes some trailing blanks. 2007-02-13 Jim Meyering Compile warning-free with "gcc -Wall -Wshadow". Hello, I find that keeping code warning-free (wrt gcc -Wall -Wshadow) makes it easier to avoid certain classes of bugs. Compiling with gcc -Wall -Wshadow evoked a few warnings on a Debian/unstable system. Here are patches to fix those: * libparted/exception.c (default_handler): Rename parameter "ex" to "e", to avoid shadowing file-scoped global. * libparted/fs/linux_swap/linux_swap.c (_generic_swap_probe): Add a "can't happen" (with current callers) "default: goto error" clause in a switch to avoid a may-be-used-uninitialized warning. (_generic_swap_clobber): Likewise. * libparted/fs/hfs/reloc_plus.c (hfsplus_pack_free_space_from_block): Rename local variable "div" to "divisor", to avoid shadowing the function in . * libparted/fs/hfs/reloc.c (hfs_pack_free_space_from_block): Likewise. * libparted/fs/hfs/cache.c (hfsc_cache_add_extent): Rename parameter "index" to "ref_index" to avoid shadowing the function. * libparted/labels/sun.c (sun_partition_enumerate): Rename local variable "i" to "j", to avoid shadowing another local. 2007-02-13 Jim Meyering configure.ac: Add LOCALEDIR definition to CFLAGS only once. I noticed that there were two identical lines in configure.ac, adding the same LOCALEDIR definition to CFLAGS. This change removes the latter. * configure.ac: Add LOCALEDIR definition to CFLAGS only once. 2007-02-12 Riccardo Setti Added a pkgconfig file for libparted, adjusted Makefile.am and configure.ac for reflect the canges modified: Makefile.am modified: configure.ac new file: libparted.pc.in 2007-01-30 Debarshi Ray Renaming PARTITION_EXT to PARTITION_DOS_EXT in MSDOS disk-label code, to maintain similarity with Linux v2.6.18.2 2007-01-17 Debarshi Ray Enable support for swsusp partitions, and the ability to differentiate between old and new versions of linux-swap partitions. Changed the swap_init signature and removed extra ped_geometry_read from _swap*_open. 2007-01-16 Debarshi Ray Synchronize the linux-swap (new version) header according to the Linux kernel sources. cb6ca73be06f360308e6a2fccb7142ed8175af29 continued. 2007-01-15 Debarshi Ray Add stdint.h stdlib.h & string.h to include/parted/parted.h and remove them from other files. 2007-01-14 Debarshi Ray Synchronise manual page and --help documentation. 2007-01-12 David Cantrell Updated i18n information. Add ped_device_cache_remove() prototype. (cherry picked from commit cb53b87ab2f779633f152f478c7f8c99c2fd1817) Only call _disk_warn_loss(disk) in do_mklabel() if disk is not NULL. Fixes a segfault when initializing new volumes. (cherry picked from commit 70e3bf5e7818df49a11e203ac8519e037818d592) Fix a segfault in ped_assert() where the wrong pointer is freed in the backtrace. (cherry picked from commit 63f7b33b352d0d699efeb1095340ed6139c49e3b) Add the ped_device_cache_remove() function to remove a device from the cache. (cherry picked from commit 5fb6658d124050a9dc27a87f2e1c3ffd3d1ad7c0) Updated the AUTHORS file. (cherry picked from commit 7ab32d423cc43a5e9372a7dc000feb183db9a89a) 2007-01-11 Debarshi Ray Rectify segmentation fault caused by 9e05418de3477666b0709f5d1996149febd33100 Update doc/C/parted.8 to document --list. 2007-01-06 Otavio Salvador parted/parted.c: Destroy all objects before return when called with --list or --all option. 2007-01-05 Anant Narayanan Dump readline history on crash 2006-12-14 Anant Narayanan Loosen requirement for the 'check' library. 2006-12-14 Debarshi Ray Update AUTHORS. 2006-12-13 Leslie P. Polzer added scripts/update-po 2006-12-12 David Cantrell Merge branches 'master' and 'master' of git+ssh://dcantrell-guest@git.debian.org/git/parted/parted 2006-12-11 Leslie P. Polzer Updated translations. 2006-12-11 Debarshi Ray Alias 'print list' with 'print all'. 2006-12-11 Otavio Salvador Include a disk probing test If CHECK is installed on configure time, build our unittest framework Add CHECK unittext library detection to Autoconf script 2006-12-09 Leslie P. Polzer Release script: cannot call "return" from top level; replaced with "exit". 2006-12-08 Debarshi Ray Zero sized device is shown as 0.00B and not -0.00kB. 2006-12-06 Otavio Salvador libparted/exception.c: Dynamically allow space of exception message. Output a backtrace when catching SEGV_MAPERR or a general SIGSEGV signals. 2006-12-06 Debarshi Ray Implement 'print devices'. 2006-12-05 Benno Schulenberg Translate the copyright message, and hard wrap it 2006-12-05 Otavio Salvador libparted/disk.c: Standarize the way we walk throught the disk types overall the code 2006-12-05 Otavio Salvador Revert "Add check unittest support and a initial test for a resizing bug." This code wasn't ready for commit yet. This reverts commit ba43cb6ff7bb1d945062e25b94efecb1b84c0c33. 2006-12-05 Otavio Salvador parted/parted.c: Remove useless line break 2006-12-04 Otavio Salvador Add check unittest support and a initial test for a resizing bug. 2006-12-03 David Cantrell Fix the upload script to correctly reference the sig files. Remove ChangeLog, doc/mdate-sh, and doc/texinfo.tex since they are unmanaged files and get generated automatically at release time. Generate ChangeLog before running the autogen tools because we need a file called 'ChangeLog' to exist when running those tools. Pass git changelog through 'fold -s' to wrap long lines. Added the --enable-selinux switch to the configure script. If set, it adds -lselinux and -lsepol to the list of libraries to link libparted with. Bumped the version number to 1.9.9 since this is the edge branch. Rename all old ChangeLog files to ChangeLog.0. Added code to the tarball_upload.sh script to generate a toplevel ChangeLog from the git changelog. 2006-12-02 Leslie P. Polzer Updated URL of static parted in docs. 2006-12-02 Anant Narayanan Make parted ignore '-i' option instead of failing Support machine parseable output. 2006-11-30 Debarshi Ray Cleanup _partition_warn_busy, _disk_warn_busy, _partition_warn_loss and _disk_warn_loss. 2006-11-28 Otavio Salvador Proper print when there're no extended partitions, but partition names (patch from Sven Luther) libparted/arch/linux.c: initialize task point to please GCC Don't enforce libselinux and libsepol linking when using device-mapper support 2006-11-28 Debarshi Ray Warn before mklabel and mkfs. Make mktable aliased to mklabel. 2006-11-27 Otavio Salvador Fix 'print' command help 'print' command help was missing a new line at end and then breaking the help printing. 2006-11-27 Leslie P. Polzer Updated translations. 2006-11-26 Otavio Salvador Remove doc/mdate-sh and doc/texinfo.tex since they are included when we run autogen.sh 2006-11-23 Anant Narayanan Introduce the -list command-line switch, patch by Debarshi Ray 2006-11-22 Otavio Salvador Avoid warning about user permissions when using --version parted/parted.c: Remove redeclaration of current_dev fixing a compilation error Readd the 'return 0;' to please GCC The commit d000de8f062ce070d5310f164ebf4f5ed26fcad0 included a compilation warning that makes sense when Parted is built without debugging. To solve the warning and ensure that when running without debugging we return a sinsible value I've reverted d000de8f062ce070d5310f164ebf4f5ed26fcad0 change and added a nice comment to avoid misunderstandings again. 2006-11-22 Anant Fix loop in print_all, thanks to Debarshi Ray for the patch. 2006-11-20 Otavio Salvador Remove useless 'return 0;' call Since PED_ASSERT will always be run, the return 0 is useless, hence removed. Remove useless semicolon from PED_ASSERT calls 2006-11-20 David Cantrell Generate SHA-1 digests of the archive files and upload those along with the actual archive files. 2006-11-20 Otavio Salvador Rework backtrace support While doing a deeply check about the backtrace support I found that -rdynamic is useless on CFLAGS and my previous change was wrong since it wasn't avoiding -rdynamic on LFLAGS if the running system missed the execinfo.h support. That would probably cause a build error on some systems. 2006-11-17 David Cantrell Final changes for parted-1.8.0 git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@896 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-11-11 Otavio Salvador Apply changes done on Darcs and suitable for release on 1.8 final: Sat Nov 11 18:09:17 BRST 2006 Otavio Salvador * Enable backtrace just if it's has support on libc. Sat Nov 11 17:41:12 BRST 2006 Otavio Salvador * Add -rdynamic to LDFLAGS. Sat Nov 11 17:40:19 BRST 2006 Otavio Salvador * Add -rdynamic to CFLAGS Sat Nov 11 17:38:11 BRST 2006 Otavio Salvador * Print backtrace stack when throwing an exception git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@895 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-11-11 Otavio Salvador Remove files that can be generated. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@894 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-11-11 Otavio Salvador Changes done on darcs repository suitable for 1.8 release: Sat Nov 11 10:41:54 BRST 2006 Otavio Salvador * Break lines bigger then 80 columns. Sat Nov 11 02:02:26 BRST 2006 Otavio Salvador * Fix autogen.sh script to call autopoint with -f git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@892 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-11-10 Otavio Salvador Changes done on darcs repository suitable for 1.8 release: Fri Nov 10 23:19:15 BRST 2006 Otavio Salvador * Code clean-up on registering and unregistering of disks * libparted/disk.c (ped_register_disk_type, ped_unregister_disk_type): Clean-up. Patch sent by Debarshi 'Rishi' Ray . Fri Nov 10 23:14:58 BRST 2006 Otavio Salvador * Fix filesystem unregistering * libparted/filesys.c (ped_file_system_type_unregister): Handle instances where fs_types == NULL and the given fs_type is not in the list of registered file-system types. Some code clean-up. Patch sent by Debarshi 'Rishi' Ray . git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@891 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-11-10 Otavio Salvador Changes done on darcs repository suitable for 1.8 release: Wed Nov 8 20:40:43 BRST 2006 Otavio Salvador * Merge libparted/ChangeLog conflict caused by Subversion syncing Wed Nov 8 21:15:58 BRST 2006 Otavio Salvador * doc/C/parted.8: small documentation simplification Wed Nov 8 20:09:03 BRST 2006 Otavio Salvador * libparted/fs/hfs/probe.c: Fix a segmentation fault when running without debug git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@890 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-11-05 David Cantrell Updates for parted-1.8.0rc3 git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@882 2d424fd7-7fe2-0310-af74-8bc65edeb173 * arch/linux.c: Define PROC_DEVICES_BUFSIZ for reading /proc/devices, set to 16384. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@881 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-11-02 David Cantrell * labels/mac.c (_rawpart_is_boot): Check for Apple_Boot type. * labels/mac.c (_rawpart_analyse): Don't check the data_region_length against the part->geom.length for boot partitions. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@880 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-10-31 David Cantrell 2048 -> 1024 git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@871 2d424fd7-7fe2-0310-af74-8bc65edeb173 * device.c (canonicalize_file_name): calloc should use sizeof(char) instead of 1 (from Debarshi Ray). * arch/linux.c (readFD): Use a 1KB buffer to read /proc/devices rather than a 16KB buffer. Init filesize to zero at declaration. Combine error and EOF check for read() loop. Memory cleanups at function exit. Use malloc() instead of calloc() (from Debarshi Ray). * arch/linux.c (_is_dm_major): Test expression and loop cleanups (from Debarshi Ray). git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@870 2d424fd7-7fe2-0310-af74-8bc65edeb173 * parted.c (do_print): Add device-mapper type to the transport type list (from Debarshi Ray). git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@869 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-10-26 David Cantrell * arch/linux.c: Go to error_free_arch_specific rather than error_free_dev for init_generic() failure on PED_DEVICE_UBD. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@866 2d424fd7-7fe2-0310-af74-8bc65edeb173 Line length fixes. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@865 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-10-11 David Cantrell Need the filename: directive as well. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@858 2d424fd7-7fe2-0310-af74-8bc65edeb173 Set directive file version to 1.1. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@855 2d424fd7-7fe2-0310-af74-8bc65edeb173 Conditionalize the device-mapper stuff. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@852 2d424fd7-7fe2-0310-af74-8bc65edeb173 i18n updates. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@850 2d424fd7-7fe2-0310-af74-8bc65edeb173 Bump version. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@849 2d424fd7-7fe2-0310-af74-8bc65edeb173 Updates for 1.8.0rc2 release. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@848 2d424fd7-7fe2-0310-af74-8bc65edeb173 Added /dev/mapper device support (patch from Peter Jones). git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@847 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-10-09 David Cantrell * cs/geom.c (ped_geometry_read): Do not throw PED_EXCEPTION_ERROR here if accessing sectors outside of partition boundary. Returning false causes ped_geometry_check() to shift correctly anyway. This occurs on current Mac disklabels, among other systems. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@845 2d424fd7-7fe2-0310-af74-8bc65edeb173 * disk.c (ped_unregister_disk_type): Handle instances where disk_types == NULL and the given type is not in the list of registered disk types (from Debarshi Ray). git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@844 2d424fd7-7fe2-0310-af74-8bc65edeb173 * parted.c (do_print): Define transport type list and display disk model type and transport type (from Debarshi Ray). git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@843 2d424fd7-7fe2-0310-af74-8bc65edeb173 Forgot changelog notice. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@842 2d424fd7-7fe2-0310-af74-8bc65edeb173 Updated i18n files. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@841 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-10-06 David Cantrell * arch/linux.c: Change __GNU_SOURCE define to _GNU_SOURCE (only one underscore at the beginning). Fixes problem with certain systems not getting posix_memalign() defined during compilation. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@840 2d424fd7-7fe2-0310-af74-8bc65edeb173 * scripts/release/tarball_upload.sh: Since v1.0 directive files will no longer be supported by ftp-upload.gnu.org after 2006, modified the upload script to use the v1.1 format. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@839 2d424fd7-7fe2-0310-af74-8bc65edeb173 * scripts/release/tarball_upload.sh: Support the -a (or --alpha) switch on the tarball upload script. This switch will upload the release to alpha.gnu.org rather than ftp.gnu.org. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@838 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-09-15 David Cantrell Fix execution of autogen.sh and configure. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@836 2d424fd7-7fe2-0310-af74-8bc65edeb173 These (upx and statifier) are not called from anywhere. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@835 2d424fd7-7fe2-0310-af74-8bc65edeb173 Updated for parted-1.8.0rc1. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@834 2d424fd7-7fe2-0310-af74-8bc65edeb173 * doc/po4a.mk: Removed fake* stuff. Fixed all-local target so you don't end up in an infinite make loop trying to make '*'. Fixed the remove target as well. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@833 2d424fd7-7fe2-0310-af74-8bc65edeb173 Tabs for the updatepo target. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@832 2d424fd7-7fe2-0310-af74-8bc65edeb173 Add vtoc.h and fdasd.h to the list. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@831 2d424fd7-7fe2-0310-af74-8bc65edeb173 Removed the extra double quote at the end of line 6 in partprobe.8.pt_BR.po. Other updates for i18n. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@830 2d424fd7-7fe2-0310-af74-8bc65edeb173 Added a script to clean the tree after running 'make distclean'. Gets it back to the checked-out state from svn. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@829 2d424fd7-7fe2-0310-af74-8bc65edeb173 i18n updates for parted-1.8.0. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@828 2d424fd7-7fe2-0310-af74-8bc65edeb173 Removed *.h files from the Makefile. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@827 2d424fd7-7fe2-0310-af74-8bc65edeb173 i18n updates for parted-1.8.0. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@826 2d424fd7-7fe2-0310-af74-8bc65edeb173 Removed from version control. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@825 2d424fd7-7fe2-0310-af74-8bc65edeb173 i18n updates for parted-1.8.0. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@824 2d424fd7-7fe2-0310-af74-8bc65edeb173 Removed from version control. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@823 2d424fd7-7fe2-0310-af74-8bc65edeb173 Updated for version 1.8.0rc1. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@822 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-09-14 David Cantrell * labels/mac.c (mac_partition_new): memset() inits everything to zero, no need to do it manually. * labels/mac.c (mac_partition_set_flag): Prevent LVM and RAID partition types from corrupting the partition table. * arch/linux.c (_blkpg_add_partition): Set linux_part.length based on whether or not this partition is PED_PARTITION_EXTENDED or not. * arch/linux.c (_disk_sync_part_table): Remove the check and continue for PED_PARTITION_EXTENDED types. git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@821 2d424fd7-7fe2-0310-af74-8bc65edeb173 2006-09-14 Anant Narayanan Fix ChangeLog git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@820 2d424fd7-7fe2-0310-af74-8bc65edeb173