OSDN Git Service
Jim Meyering [Thu, 5 Mar 2009 10:03:45 +0000 (11:03 +0100)]
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.
Joel Granados Moreno [Thu, 5 Mar 2009 09:44:48 +0000 (10:44 +0100)]
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.
Joel Granados Moreno [Thu, 19 Feb 2009 15:53:12 +0000 (16:53 +0100)]
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.
Petr Uzel [Fri, 20 Feb 2009 13:52:39 +0000 (14:52 +0100)]
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.
Petr Uzel [Wed, 18 Feb 2009 13:43:36 +0000 (14:43 +0100)]
test for the gpt_read failed-assertion fix
* tests/t0201-gpt.sh: New file.
* tests/Makefile.am (TESTS): Add it.
Jim Meyering [Mon, 16 Feb 2009 18:02:58 +0000 (19:02 +0100)]
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
Jim Meyering [Mon, 16 Feb 2009 16:54:57 +0000 (17:54 +0100)]
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.
Petr Uzel [Fri, 13 Feb 2009 12:27:55 +0000 (13:27 +0100)]
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.
Jim Meyering [Mon, 16 Feb 2009 16:58:50 +0000 (17:58 +0100)]
tests: use "compare", not "$compare"
* test-lib.sh (compare): Define "compare" as a function, not a variable.
* tests/t*.sh: use "compare", not "$compare"
Jim Meyering [Fri, 13 Feb 2009 11:08:13 +0000 (12:08 +0100)]
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
Jim Meyering [Sun, 8 Feb 2009 09:53:01 +0000 (10:53 +0100)]
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"
Jim Meyering [Sat, 7 Feb 2009 16:17:54 +0000 (17:17 +0100)]
clearfat: diagnose an invalid device number
* debug/clearfat/clearfat.c: Include <limits.h> and "xstrtol.h".
(main): Diagnose an invalid minor device number argument.
* bootstrap.conf (gnulib_modules): Add xstrtol.
Jim Meyering [Sat, 7 Feb 2009 14:07:42 +0000 (15:07 +0100)]
maint.mk: sync from coreutils
Jim Meyering [Sat, 7 Feb 2009 13:59:32 +0000 (14:59 +0100)]
Revert "don't try to translate 'lib/xstrtol-error.c'"
This reverts commit
39adc77de255b7df33e1efb93853c7ccfd4c45f5.
Otherwise, "make syntax-check" fails the sc_po_check test.
Otavio Salvador [Sat, 31 Jan 2009 19:07:22 +0000 (17:07 -0200)]
don't try to translate 'lib/xstrtol-error.c'
Otavio Salvador [Tue, 6 Nov 2007 03:51:14 +0000 (01:51 -0200)]
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.
Otavio Salvador [Tue, 6 Nov 2007 02:31:38 +0000 (00:31 -0200)]
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.
Jim Meyering [Tue, 27 Jan 2009 09:58:09 +0000 (10:58 +0100)]
avoid bootstrap failure
* bootstrap.conf: Ensure the gnulib-tests/ exists.
Reported by Matt Domsch.
Jim Meyering [Mon, 26 Jan 2009 16:24:10 +0000 (17:24 +0100)]
better m4 quoting
Jim Meyering [Mon, 26 Jan 2009 16:12:53 +0000 (17:12 +0100)]
* parted/ui.c: Include <config.h> before any other file.
Jim Meyering [Mon, 26 Jan 2009 16:12:01 +0000 (17:12 +0100)]
maint.mk: sync from coreutils
Jim Meyering [Mon, 26 Jan 2009 15:32:57 +0000 (16:32 +0100)]
* po/POTFILES.in: Add lib/xstrtol-error.c.
Jim Meyering [Mon, 26 Jan 2009 15:24:52 +0000 (16:24 +0100)]
_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.
Jim Meyering [Thu, 8 Jan 2009 13:18:14 +0000 (14:18 +0100)]
* bootstrap.conf: sync from coreutils
Debarshi Ray [Wed, 7 Jan 2009 07:05:10 +0000 (12:35 +0530)]
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.
Jim Meyering [Thu, 8 Jan 2009 08:39:03 +0000 (09:39 +0100)]
fix a "make syntax-check" failure (update copyright date)
* doc/parted.texi: Update copyright dates for 2009.
Jim Meyering [Tue, 23 Dec 2008 09:20:20 +0000 (10:20 +0100)]
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.
Tom "spot" Callaway [Mon, 22 Dec 2008 14:39:23 +0000 (09:39 -0500)]
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.
Harald Welte [Sun, 5 Oct 2008 13:11:03 +0000 (15:11 +0200)]
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.
Petr Uzel [Tue, 19 Aug 2008 14:12:08 +0000 (16:12 +0200)]
Remove obsolete 'i' from parted optstring (--interactive/-i option is not supported anymore)
Petr Uzel [Tue, 19 Aug 2008 16:24:29 +0000 (18:24 +0200)]
doc: remove obsolete --interactive (-i) option descriptions
Jim Meyering [Thu, 7 Aug 2008 20:32:17 +0000 (22:32 +0200)]
update build/test infrastructure from coreutils
* bootstrap: Update from coreutils.
* maint.mk: Likewise.
Soren Hansen [Wed, 6 Aug 2008 18:15:00 +0000 (20:15 +0200)]
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.
Jim Meyering [Wed, 6 Aug 2008 17:31:16 +0000 (19:31 +0200)]
don't exhaust virtual memory for mklabel on a loopback device
Report and analysis by Soren Hansen <soren@canonical.com>:
"""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.
Jim Meyering [Wed, 30 Jul 2008 09:10:56 +0000 (11:10 +0200)]
linux.c: plug a leak
* libparted/arch/linux.c (_disk_sync_part_table): Free local, "rets".
Reported by Mike Hwang <Mike.Hwang@iqstor.com.cn>.
Jim Meyering [Sat, 26 Jul 2008 19:22:10 +0000 (21:22 +0200)]
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):
Joel Andres Granados [Fri, 18 Jul 2008 15:26:53 +0000 (17:26 +0200)]
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.
Jim Meyering [Tue, 8 Jul 2008 08:48:07 +0000 (10:48 +0200)]
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.
Jim Meyering [Tue, 8 Jul 2008 08:41:20 +0000 (10:41 +0200)]
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
Jim Meyering [Mon, 7 Jul 2008 10:29:01 +0000 (12:29 +0200)]
fix to allow compilation with gcc's -fno-common option
* libparted/fs/fat/count.h (fat16): Remove bogus (unused)
globally-scoped variable declaration.
Jim Meyering [Mon, 7 Jul 2008 08:50:22 +0000 (10:50 +0200)]
* maint.mk: update from coreutils
Jim Meyering [Mon, 7 Jul 2008 08:49:45 +0000 (10:49 +0200)]
* parted/parted.c (options): Remove redundant "const" in declaration.
Jim Meyering [Thu, 26 Jun 2008 12:37:43 +0000 (14:37 +0200)]
* libparted/fs/fat/table.c: Remove a few trailing blanks.
Jim Meyering [Thu, 26 Jun 2008 12:37:05 +0000 (14:37 +0200)]
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.
Jim Meyering [Tue, 24 Jun 2008 13:46:21 +0000 (15:46 +0200)]
adjust for const-correctness
* libparted/arch/linux.c (_blkpg_add_partition): Make the "part"
parameter "const".
(_disk_sync_part_table): Make local "part" const.
Jim Meyering [Tue, 24 Jun 2008 13:39:10 +0000 (15:39 +0200)]
* libparted/arch/linux.c (_disk_sync_part_table): Plug an obvious leak.
Jim Meyering [Tue, 24 Jun 2008 14:38:07 +0000 (16:38 +0200)]
* configure.ac: Remove useless 'exit's after AC_MSG_ERROR.
Jim Meyering [Fri, 20 Jun 2008 12:12:25 +0000 (14:12 +0200)]
tests: avoid test failure due to added newline in diagnostic
* tests/t3000-constraints.sh: Adapt to changed output syntax.
Jim Meyering [Fri, 20 Jun 2008 12:04:30 +0000 (14:04 +0200)]
tests: factor out duplication
* tests/t7000-scripting.sh: Use a loop rather than
two copies of each of 7 tests.
Jim Meyering [Fri, 20 Jun 2008 10:09:40 +0000 (12:09 +0200)]
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".
Jim Meyering [Fri, 20 Jun 2008 10:01:42 +0000 (12:01 +0200)]
tests: avoid failure when run as non-root
* tests/t7000-scripting.sh: and avoid some duplication
Joel Andres Granados [Fri, 20 Jun 2008 09:49:27 +0000 (11:49 +0200)]
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.
Guido Guenther [Fri, 6 Jun 2008 13:33:55 +0000 (15:33 +0200)]
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.
Jim Meyering [Sun, 8 Jun 2008 21:18:02 +0000 (23:18 +0200)]
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.
Jim Meyering [Sun, 8 Jun 2008 21:06:49 +0000 (23:06 +0200)]
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 <frodo.drogo@gmail.com>.
* 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.
Jim Meyering [Fri, 6 Jun 2008 10:48:57 +0000 (12:48 +0200)]
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.
Jim Meyering [Fri, 6 Jun 2008 08:10:02 +0000 (10:10 +0200)]
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.
Jim Meyering [Fri, 6 Jun 2008 07:44:10 +0000 (09:44 +0200)]
* tests/Makefile.am (EXTRA_DIST): Add lvm-utils.sh.
Jim Meyering [Fri, 6 Jun 2008 07:42:52 +0000 (09:42 +0200)]
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.
Jim Meyering [Fri, 6 Jun 2008 07:40:59 +0000 (09:40 +0200)]
protect against bogus absolute srcdir name
* test-lib.sh: add quotes to protect against $abs_top_srcdir containing
shell meta-characters
Jim Meyering [Fri, 6 Jun 2008 07:38:44 +0000 (09:38 +0200)]
* test-lib.sh: Guard against bogus $device_mapper_required value in env.
Jim Meyering [Fri, 6 Jun 2008 07:38:11 +0000 (09:38 +0200)]
sync from lvm-utils.sh
Jim Meyering [Fri, 6 Jun 2008 07:16:38 +0000 (09:16 +0200)]
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.
Jim Meyering [Fri, 6 Jun 2008 07:05:35 +0000 (09:05 +0200)]
* dm-utils: Restore uses of $test_dir_rand_.
Jim Meyering [Fri, 6 Jun 2008 07:09:35 +0000 (09:09 +0200)]
* libparted/arch/linux.c (linux_new): Initialize new member.
Jim Meyering [Fri, 6 Jun 2008 07:08:29 +0000 (09:08 +0200)]
* libparted/arch/linux.c (_dm_maptype): Add space after "if".
Guido Günther [Thu, 5 Jun 2008 11:36:17 +0000 (13:36 +0200)]
honor DM_DEV_DIR envvar
* libparted/arch/linux.c (_dm_maptype): Make libparted handle $DM_DEV_DIR
the same way dmsetup does.
Guido Günther [Thu, 5 Jun 2008 07:55:53 +0000 (09:55 +0200)]
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
Jim Meyering [Thu, 5 Jun 2008 07:55:46 +0000 (09:55 +0200)]
avoid useless initialization
Guido Guenther [Wed, 23 Apr 2008 13:13:50 +0000 (15:13 +0200)]
linux device-mapper map type detection
detect the type of the device map and add it to the displayed type
information
Jim Meyering [Thu, 5 Jun 2008 11:55:30 +0000 (13:55 +0200)]
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.
Jim Meyering [Thu, 5 Jun 2008 07:23:51 +0000 (09:23 +0200)]
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.
Jim Meyering [Thu, 5 Jun 2008 07:10:57 +0000 (09:10 +0200)]
* maint.mk: Merge from coreutils.
Jim Meyering [Fri, 30 May 2008 19:10:06 +0000 (21:10 +0200)]
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
Jim Meyering [Thu, 29 May 2008 20:35:06 +0000 (22:35 +0200)]
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)
Jim Meyering [Thu, 29 May 2008 19:48:14 +0000 (21:48 +0200)]
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)
Jim Meyering [Thu, 29 May 2008 18:53:08 +0000 (20:53 +0200)]
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)
Jim Meyering [Thu, 29 May 2008 18:47:44 +0000 (20:47 +0200)]
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)
Jim Meyering [Thu, 29 May 2008 18:38:13 +0000 (20:38 +0200)]
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)
Jim Meyering [Thu, 29 May 2008 17:38:09 +0000 (19:38 +0200)]
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)
Jim Meyering [Thu, 29 May 2008 17:36:02 +0000 (19:36 +0200)]
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.
Jim Meyering [Thu, 29 May 2008 13:47:21 +0000 (15:47 +0200)]
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)
Colin Watson [Thu, 29 May 2008 20:27:13 +0000 (22:27 +0200)]
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.
Jim Meyering [Sun, 4 May 2008 07:55:00 +0000 (09:55 +0200)]
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):
Jim Meyering [Sun, 4 May 2008 07:51:33 +0000 (09:51 +0200)]
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)
Jim Meyering [Thu, 29 May 2008 09:37:51 +0000 (11:37 +0200)]
* maint.mk: Update from coreutils.
Jim Meyering [Thu, 29 May 2008 09:21:05 +0000 (11:21 +0200)]
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.
Colin Watson [Wed, 28 May 2008 11:12:51 +0000 (12:12 +0100)]
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
Jim Meyering [Fri, 23 May 2008 13:58:20 +0000 (15:58 +0200)]
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.
Otavio Salvador [Tue, 6 May 2008 17:09:37 +0000 (14:09 -0300)]
properly test for __s390__ and __s390x__ macros to disable O_DIRECT on that
Jim Meyering [Wed, 30 Apr 2008 16:35:44 +0000 (18:35 +0200)]
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.
Jim Meyering [Tue, 29 Apr 2008 06:47:24 +0000 (08:47 +0200)]
Pass NEWS-checking part of "make syntax-check".
* NEWS: Tweak format so it passes.
* cfg.mk (old_NEWS_hash): Update MD5 checksum.
Jim Meyering [Tue, 29 Apr 2008 06:42:22 +0000 (08:42 +0200)]
Exempt a build-related script from the copyright check.
* .x-sc_GPL_version: New file.
* Makefile.am (EXTRA_DIST): Add .x-sc_GPL_version.
Jim Meyering [Tue, 29 Apr 2008 06:39:46 +0000 (08:39 +0200)]
Turn off strcmp/STREQ check.
* cfg.mk (local-checks-to-skip): Add sc_prohibit_strcmp.
Jim Meyering [Tue, 29 Apr 2008 06:35:48 +0000 (08:35 +0200)]
* bootstrap.conf (gnulib_modules): Add useless-if-before-free.
Jim Meyering [Tue, 29 Apr 2008 06:34:52 +0000 (08:34 +0200)]
* doc/parted.texi: Update copyright dates.
Jim Meyering [Tue, 29 Apr 2008 06:27:22 +0000 (08:27 +0200)]
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.
Jim Meyering [Tue, 29 Apr 2008 06:08:32 +0000 (08:08 +0200)]
use gnulib's gnumakefile module
* GNUmakefile: Remove from version control.
* bootstrap.conf (gnulib_modules): Add gnumakefile.
* .gitignore: Add GNUmakefile
Signed-off-by: Jim Meyering <meyering@redhat.com>
Matt Davis [Tue, 29 Apr 2008 02:56:59 +0000 (22:56 -0400)]
Corrected a few memory leaks from unallocated ped_unit_format calls.
Deallocated memory in do_print() allocated by ped_unit_format calls.
Matt Davis [Tue, 29 Apr 2008 02:28:49 +0000 (22:28 -0400)]
Corrected memory leak when displaying partition flags.
Deallocated memory allocated by partition_print_flags()