OSDN Git Service

android-x86/external-parted.git
16 years ago* configure.ac: Remove useless 'exit's after AC_MSG_ERROR.
Jim Meyering [Tue, 24 Jun 2008 14:38:07 +0000 (16:38 +0200)]
* configure.ac: Remove useless 'exit's after AC_MSG_ERROR.

16 years agotests: avoid test failure due to added newline in diagnostic
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.

16 years agotests: factor out duplication
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.

16 years agotests: use consistent output normalization code
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".

16 years agotests: avoid failure when run as non-root
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

16 years agoFix the script mode for mkpart and mkpartfs.
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.

16 years agomove new dmtype member from PedDevice to LinuxSpecific,
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.

16 years agoadjust tests here (libparted/tests/), as done for tests/
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.

16 years agofix compile/link problems in libparted/tests
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.

16 years agoskip device-mapper test if support is not enabled
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.

16 years agodevice mapper clean-up: remove #ifdefs, plug a leak
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.

16 years ago* tests/Makefile.am (EXTRA_DIST): Add lvm-utils.sh.
Jim Meyering [Fri, 6 Jun 2008 07:44:10 +0000 (09:44 +0200)]
* tests/Makefile.am (EXTRA_DIST): Add lvm-utils.sh.

16 years agoreflect renaming: dm-utils.sh -> 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.

16 years agoprotect against bogus absolute srcdir name
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

16 years ago* test-lib.sh: Guard against bogus $device_mapper_required value in env.
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.

16 years agosync from lvm-utils.sh
Jim Meyering [Fri, 6 Jun 2008 07:38:11 +0000 (09:38 +0200)]
sync from lvm-utils.sh

16 years agosource test-lib.sh (not init.sh) from each test
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.

16 years ago* dm-utils: Restore uses of $test_dir_rand_.
Jim Meyering [Fri, 6 Jun 2008 07:05:35 +0000 (09:05 +0200)]
* dm-utils: Restore uses of $test_dir_rand_.

16 years ago* libparted/arch/linux.c (linux_new): Initialize new member.
Jim Meyering [Fri, 6 Jun 2008 07:09:35 +0000 (09:09 +0200)]
* libparted/arch/linux.c (linux_new): Initialize new member.

16 years ago* libparted/arch/linux.c (_dm_maptype): Add space after "if".
Jim Meyering [Fri, 6 Jun 2008 07:08:29 +0000 (09:08 +0200)]
* libparted/arch/linux.c (_dm_maptype): Add space after "if".

16 years agohonor DM_DEV_DIR envvar
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.

16 years agoadd basic device mapper tests
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

16 years agoavoid useless initialization
Jim Meyering [Thu, 5 Jun 2008 07:55:46 +0000 (09:55 +0200)]
avoid useless initialization

16 years agolinux device-mapper map type detection
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

16 years agouse gnulib's mktempd module/script
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.

16 years agouse gnulib's progname module
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.

16 years ago* maint.mk: Merge from coreutils.
Jim Meyering [Thu, 5 Jun 2008 07:10:57 +0000 (09:10 +0200)]
* maint.mk: Merge from coreutils.

16 years agogpt_write: fix a write-uninitialized error
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

16 years agoplug leaks in do_print
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)

16 years agoplug two more leaks in gpt_write
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)

16 years agoplug a blatant leak in gpt_write
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)

16 years agoplug leaks in gpt_write
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)

16 years agoplug a leak in gpt_read
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)

16 years agoplug leak in ped_device_get_constraint
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)

16 years agoplug leaks in parted.c
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.

16 years agoplug a leak in ped_device_get_constraint
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)

16 years agoAvoid "comparison between signed and unsigned" warning from gcc.
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.

16 years agoremove more useless "if" tests before free
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):

16 years agoUse free, not ped_free.
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)

16 years ago* maint.mk: Update from coreutils.
Jim Meyering [Thu, 29 May 2008 09:37:51 +0000 (11:37 +0200)]
* maint.mk: Update from coreutils.

16 years agotest for improved DOS-partition-table recognition
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.

16 years agobug fix: improve DOS partition table recognition
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

16 years agoavoid const-related compiler warnings
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.

16 years agoproperly test for __s390__ and __s390x__ macros to disable O_DIRECT on that
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

16 years agoRemove useless "if" tests before free.
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.

16 years agoPass NEWS-checking part of "make syntax-check".
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.

16 years agoExempt a build-related script from the copyright check.
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.

16 years agoTurn off strcmp/STREQ check.
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.

16 years ago* bootstrap.conf (gnulib_modules): Add useless-if-before-free.
Jim Meyering [Tue, 29 Apr 2008 06:35:48 +0000 (08:35 +0200)]
* bootstrap.conf (gnulib_modules): Add useless-if-before-free.

16 years ago* doc/parted.texi: Update copyright dates.
Jim Meyering [Tue, 29 Apr 2008 06:34:52 +0000 (08:34 +0200)]
* doc/parted.texi: Update copyright dates.

16 years agomore updates from gnulib and coreutils
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.

16 years agouse gnulib's gnumakefile module
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>
16 years agoCorrected a few memory leaks from unallocated ped_unit_format calls.
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.

16 years agoCorrected memory leak when displaying partition flags.
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()

16 years agoCorrected a small memory leak when displaying partition information
Matt Davis [Sun, 27 Apr 2008 00:31:39 +0000 (20:31 -0400)]
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.

16 years agodo not loop in case message exception has no message
Otavio Salvador [Thu, 24 Apr 2008 20:46:28 +0000 (17:46 -0300)]
do not loop in case message exception has no message

The exception handler was looping when the exception had no message.

16 years agofix memory leak in exception handler
Otavio Salvador [Thu, 24 Apr 2008 18:55:47 +0000 (15:55 -0300)]
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.

16 years agoAdd support for GRUB / BIOS partition in GPT.
Robert Millan [Mon, 25 Feb 2008 20:51:13 +0000 (21:51 +0100)]
Add support for GRUB / BIOS partition in GPT.

16 years agoFix syntax error.
Bastian Blank [Mon, 7 Apr 2008 11:18:45 +0000 (13:18 +0200)]
Fix syntax error.

16 years agoUse host_cpu for s390 check.
Bastian Blank [Mon, 7 Apr 2008 11:07:12 +0000 (13:07 +0200)]
Use host_cpu for s390 check.

16 years agoFix a typo: s/to defragmenting/to defragment/, Remove trailing blanks.
Jim Meyering [Sun, 30 Mar 2008 12:15:26 +0000 (14:15 +0200)]
Fix a typo: s/to defragmenting/to defragment/, Remove trailing blanks.

16 years agoDon't write into line[-1] when line starts with a NUL byte.
Jim Meyering [Mon, 4 Feb 2008 07:35:17 +0000 (08:35 +0100)]
Don't write into line[-1] when line starts with a NUL byte.

* parted/ui.c (_readline): Check strlen first.

16 years agodvh.c (dvh_partition_set_name): Include partition name in diagnostic.
Jim Meyering [Sat, 2 Feb 2008 16:00:42 +0000 (17:00 +0100)]
dvh.c (dvh_partition_set_name): Include partition name in diagnostic.

16 years agoEnforce inherent limitations of dos and dvh partition table formats.
Jim Meyering [Thu, 10 Jan 2008 13:51:56 +0000 (14:51 +0100)]
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.

16 years agomkpart: Don't require a DVH partition name if it's guaranteed to fail.
Jim Meyering [Sat, 2 Feb 2008 19:57:01 +0000 (20:57 +0100)]
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):

16 years agoAvoid new error detected by very latest gcc.
Jim Meyering [Mon, 14 Jan 2008 19:01:39 +0000 (20:01 +0100)]
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.

16 years ago#ifdef function definitions to match uses, to avoid compiler warnings.
Jim Meyering [Mon, 14 Jan 2008 17:50:54 +0000 (18:50 +0100)]
#ifdef function definitions to match uses, to avoid compiler warnings.

* parted/ui.c (mask_signal, s_sigint_handler, s_sigsegv_handler)
(s_sigfpe_handler):

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoChange two "extern inline" functions to "static inline".
Jim Meyering [Mon, 14 Jan 2008 17:48:38 +0000 (18:48 +0100)]
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.

Signed-off-by: Jim Meyering <meyering@redhat.com>
16 years agoMake inter-release --version output more useful.
Jim Meyering [Mon, 17 Dec 2007 20:44:43 +0000 (21:44 +0100)]
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.

16 years agodoc/pt_BR/partprobe.8.pt_BR.po: Remove trailing space in generated file.
Jim Meyering [Tue, 18 Dec 2007 08:38:41 +0000 (09:38 +0100)]
doc/pt_BR/partprobe.8.pt_BR.po: Remove trailing space in generated file.

16 years agoDistribute new file: architecture.h.
Jim Meyering [Tue, 18 Dec 2007 08:24:52 +0000 (09:24 +0100)]
Distribute new file: architecture.h.

libparted/Makefile.am (libparted_la_SOURCES): Add architecture.h.

16 years agolibparted/architecture.c: Include <config.h>.
Jim Meyering [Tue, 18 Dec 2007 08:22:34 +0000 (09:22 +0100)]
libparted/architecture.c: Include <config.h>.

16 years agoFix up the ChangeLog generation a bit.
David Cantrell [Mon, 17 Dec 2007 22:04:06 +0000 (12:04 -1000)]
Fix up the ChangeLog generation a bit.

We can just take the output of git-log.

16 years agoPerform ChangeLog-creation here, rather than in bootstrap,
Jim Meyering [Mon, 17 Dec 2007 20:53:58 +0000 (21:53 +0100)]
Perform ChangeLog-creation here, rather than in bootstrap,

so that the next merge will be less likely to clobber this parted-specific bit.

16 years agoMention that we should be able to build with -fno-common.
Jim Meyering [Mon, 17 Dec 2007 15:50:23 +0000 (16:50 +0100)]
Mention that we should be able to build with -fno-common.

16 years ago* bootstrap: Update from Coreutils, adapting to changes in gnulib.
Jim Meyering [Mon, 17 Dec 2007 15:42:42 +0000 (16:42 +0100)]
* bootstrap: Update from Coreutils, adapting to changes in gnulib.

Among them: now gnulib uses git for version control.

16 years ago* libparted/tests/disk.c (START_TEST): Remove decl of unused local.
Jim Meyering [Mon, 17 Dec 2007 15:37:08 +0000 (16:37 +0100)]
* libparted/tests/disk.c (START_TEST): Remove decl of unused local.

16 years agoAdd flags for BSD disklabels (needed for Linux on Alpha)
David Cantrell [Wed, 7 Nov 2007 16:52:47 +0000 (11:52 -0500)]
Add flags for BSD disklabels (needed for Linux on Alpha)

Patch from Sergey Tikhonov from the AlphaCore project.

16 years agoAdd KNOWN ISSUES section
David Cantrell [Tue, 6 Nov 2007 20:13:54 +0000 (15:13 -0500)]
Add KNOWN ISSUES section

Add a KNOWN ISSUES section explaining that ext3 resizing does not work
and that you should use resize2fs.

16 years agoAlways define PED_DEVICE_DM
David Cantrell [Tue, 6 Nov 2007 20:13:15 +0000 (15:13 -0500)]
Always define PED_DEVICE_DM

Regardless of compile time options, always define PED_DEVICE_DM.

16 years agoAdd 'xvd' to the transports array in do_print
David Cantrell [Tue, 6 Nov 2007 20:12:29 +0000 (15:12 -0500)]
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.

16 years agoMove PedArchitecture and ped_set_architecture to private
Otavio Salvador [Fri, 2 Nov 2007 16:33:05 +0000 (14:33 -0200)]
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.

16 years agoparted/geom.h: move includes to after type definition to avoids dependency
Otavio Salvador [Fri, 2 Nov 2007 20:42:52 +0000 (18:42 -0200)]
parted/geom.h: move includes to after type definition to avoids dependency

16 years agoparted/device.h: move includes to after type definition to avoids dependency
Otavio Salvador [Fri, 2 Nov 2007 20:42:48 +0000 (18:42 -0200)]
parted/device.h: move includes to after type definition to avoids dependency

16 years agoparted/filesys.h doesn't use stdio.h, parted/disk.h and parted/exception.h
Otavio Salvador [Fri, 2 Nov 2007 16:57:32 +0000 (14:57 -0200)]
parted/filesys.h doesn't use stdio.h, parted/disk.h and parted/exception.h

16 years agoparted/constraint.h needs parted/geom.h since it uses PedGeometry
Otavio Salvador [Fri, 2 Nov 2007 14:22:03 +0000 (12:22 -0200)]
parted/constraint.h needs parted/geom.h since it uses PedGeometry

16 years agoparted/natmath.h needs parted/device.h since it uses PedSector
Otavio Salvador [Fri, 2 Nov 2007 14:15:22 +0000 (12:15 -0200)]
parted/natmath.h needs parted/device.h since it uses PedSector

16 years agolibparted/cs/natmath.c: remove inline since it's not supported by GNU99 standard
Otavio Salvador [Fri, 2 Nov 2007 14:14:36 +0000 (12:14 -0200)]
libparted/cs/natmath.c: remove inline since it's not supported by GNU99 standard

16 years agoparted/device.h needs to include parted/constraint.h since it uses PedConstraint
Otavio Salvador [Fri, 2 Nov 2007 13:54:42 +0000 (11:54 -0200)]
parted/device.h needs to include parted/constraint.h since it uses PedConstraint

16 years agoRemoving unnecessary type-casts and eerie comments.
Debarshi Ray [Fri, 2 Nov 2007 11:53:32 +0000 (17:23 +0530)]
Removing unnecessary type-casts and eerie comments.

16 years agoAdded information to message about ext2 incompatible features.
Mark Neyhart [Mon, 29 Oct 2007 18:15:03 +0000 (10:15 -0800)]
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.

16 years agoReally duplicate the disk instead of readd every partition
Otavio Salvador [Thu, 30 Aug 2007 12:52:03 +0000 (09:52 -0300)]
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 <samuel.thibault@ens-lyon.org>

16 years agoSet partprobe's text domain.
Benno Schulenberg [Thu, 16 Aug 2007 14:24:50 +0000 (16:24 +0200)]
Set partprobe's text domain.

* partprobe/partprobe.c (main): Set textdomain.

16 years agoFix mkpart linux-swap bug: would use 0x83 rather than 0x82
Jim Meyering [Mon, 13 Aug 2007 20:36:27 +0000 (22:36 +0200)]
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
<http://lists.gnu.org/archive/html/bug-parted/2007-07/msg00012.html>.
* 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.

16 years agoDon't try to avoid "free (x)" when x is NULL.
Jim Meyering [Mon, 13 Aug 2007 20:41:39 +0000 (22:41 +0200)]
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.

Signed-off-by: Jim Meyering <jim@meyering.net>
16 years agoAvoid test failure with dash's builtin printf.
Jim Meyering [Tue, 14 Aug 2007 09:06:29 +0000 (11:06 +0200)]
Avoid test failure with dash's builtin printf.
* tests/t0100-print.sh (msdos_magic): Use more-portable octal escapes,
not hexadecimal ones.

16 years agoSanity check for dev, safety checks on diobuf.
David Cantrell [Wed, 8 Aug 2007 22:04:00 +0000 (18:04 -0400)]
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)

16 years agoRevert "History with undo and redo capabilities."
David Cantrell [Thu, 9 Aug 2007 15:20:44 +0000 (11:20 -0400)]
Revert "History with undo and redo capabilities."

This reverts commit 3bb8494e1ed5af0a48ad0211c3219e653167854f.

16 years agoHistory with undo and redo capabilities.
David Cantrell [Wed, 8 Aug 2007 22:14:08 +0000 (18:14 -0400)]
History with undo and redo capabilities.

Author: Matt Davis <mattdavis@gmail.com>

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.

16 years agoRevert "If we cannot create a new PedDisk for the device we're looking at, return...
Jim Meyering [Wed, 1 Aug 2007 07:44:56 +0000 (09:44 +0200)]
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.