Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Brian C. Lane
b98a9ed12a - drop ldconfig, it no longer needs to be called on un/install (bcl)
- Fix msdos-overlap py3 conversion (bcl)
2018-07-19 16:51:20 -07:00
Brian C. Lane
c7e5ffd322 - Use python3 in buildroot
- Add make to BuildRequires
- Switch gpt-header-move and msdos-overlap to python3 (bcl)
- Modify gpt-header-move and msdos-overlap to work with py2 or py3 (bcl)
- Fix atari label false positives (psusi)
- Lift 512 byte restriction on fat resize (psusi)
- build: Remove unused traces of dynamic loading (cjwatson)
- Fix resizepart iec unit end sector (psusi)
- mkpart: Allow negative start value when FS-TYPE is not given (mail)
- Fix set and disk_set to not crash when no flags are supported (psusi)
- tests: fix t6100-mdraid-partitions (psusi)
- Fix make check (psusi)
- linux: Include <sys/sysmacros.h> for major() macro. (rjones)
2018-06-27 15:07:57 -07:00
12 changed files with 848 additions and 9 deletions

View file

@ -0,0 +1,27 @@
From 6ac7054494df5b6d2e711e30df6f7df280db8776 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 24 Mar 2018 17:37:02 +0000
Subject: [PATCH 82/92] linux: Include <sys/sysmacros.h> for major() macro.
Since glibc 2.27 this header is required.
(cherry picked from commit ba5e0451b51c983e40afd123b6e0d3eddb55e610)
---
libparted/arch/linux.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 1c26b8c..ec61b11 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -41,6 +41,7 @@
#include <sys/utsname.h> /* for uname() */
#include <scsi/scsi.h>
#include <assert.h>
+#include <sys/sysmacros.h>
#ifdef ENABLE_DEVICE_MAPPER
#include <libdevmapper.h>
#endif
--
2.17.1

65
0083-Fix-make-check.patch Normal file
View file

@ -0,0 +1,65 @@
From fb77f300560a80e6e63de8fd412a5228b981a84c Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Fri, 4 May 2018 10:12:05 -0400
Subject: [PATCH 83/92] 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.
(cherry picked from commit d91acc645ad1204ded41cfecad337bf9c48952f6)
---
configure.ac | 2 +-
libparted/tests/volser.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5251dfb..f14cd71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -226,7 +226,7 @@ if test "$gl_gcc_warnings" = yes; then
nw="$nw -Wpacked"
nw="$nw -Wmissing-prototypes"
nw="$nw -Wmissing-declarations"
- nw="$nw -Wmissing-noreturn"
+ nw="$nw -Wsuggest-attribute=noreturn"
# things I might fix soon:
nw="$nw -Wfloat-equal" # sort.c, seq.c
nw="$nw -Wmissing-format-attribute" # copy.c
diff --git a/libparted/tests/volser.c b/libparted/tests/volser.c
index 9063821..c6efa5f 100644
--- a/libparted/tests/volser.c
+++ b/libparted/tests/volser.c
@@ -14,6 +14,8 @@
#include "common.h"
#include "progname.h"
+#if defined __s390__ || defined __s390x__
+
/* set dasd first */
static char vol_devno[7] = {0};
static char *tmp_disk;
@@ -75,7 +77,6 @@ END_TEST
START_TEST (test_check_volser)
{
- char vol[7] = {0};
char vol_long[] = "abcdefg";
char vol_short[] = "ab_c ";
char vol_null[] = " ";
@@ -135,6 +136,8 @@ START_TEST (test_reuse_vtoc)
}
END_TEST
+#endif
+
int main (int argc, char **argv)
{
--
2.17.1

View file

@ -0,0 +1,28 @@
From f04220e52032fbeadcd75465303d97e60047db5b Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Fri, 4 May 2018 10:35:42 -0400
Subject: [PATCH 84/92] tests: fix t6100-mdraid-partitions
The test was failing because it didn't wait for the md device
to appear after creating it.
(cherry picked from commit ddb9cce8a2ec87cdd9853bdca25c852c7aee8bdf)
---
tests/t6100-mdraid-partitions.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/t6100-mdraid-partitions.sh b/tests/t6100-mdraid-partitions.sh
index dbb1686..b37cddf 100755
--- a/tests/t6100-mdraid-partitions.sh
+++ b/tests/t6100-mdraid-partitions.sh
@@ -47,6 +47,7 @@ cleanup_fn_() {
# create mdraid on top of both partitions
mdadm -C $md_dev --force -R -l1 -n2 "${scsi_dev}1" "${scsi_dev}2"
+wait_for_dev_to_appear_ ${md_dev} || { fail=1; cat /proc/partitions; }
# create gpt and two partitions on the raid device
parted -s $md_dev mklabel gpt \
--
2.17.1

View file

@ -0,0 +1,79 @@
From 553045a79013988d00e7e61aef56f4298a1b8c93 Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Thu, 10 May 2018 12:31:36 -0400
Subject: [PATCH 85/92] 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.
(cherry picked from commit 9e196cc2902255c328a90584e44666b79e4344c3)
---
parted/ui.c | 18 ++++++++++++++++--
tests/t3310-flags.sh | 13 +++++++++++++
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/parted/ui.c b/parted/ui.c
index c603ed2..c3f2369 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -1132,7 +1132,14 @@ command_line_get_disk_flag (const char* prompt, const PedDisk* disk,
opts = str_list_append_unique (opts, _(walk_name));
}
}
-
+ if (opts == NULL)
+ {
+ ped_exception_throw (PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_OK,
+ _("No flags supported"));
+
+ return 0;
+ }
flag_name = command_line_get_word (prompt, NULL, opts, 1);
str_list_destroy (opts);
@@ -1161,7 +1168,14 @@ command_line_get_part_flag (const char* prompt, const PedPartition* part,
opts = str_list_append_unique (opts, _(walk_name));
}
}
-
+ if (opts == NULL)
+ {
+ ped_exception_throw (PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_OK,
+ _("No flags supported"));
+
+ return 0;
+ }
flag_name = command_line_get_word (prompt, NULL, opts, 1);
str_list_destroy (opts);
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
index 2da72d0..0997748 100644
--- a/tests/t3310-flags.sh
+++ b/tests/t3310-flags.sh
@@ -114,4 +114,17 @@ for table_type in aix amiga atari bsd dvh gpt mac msdos pc98 sun loop; do
done
done
+# loop filesystems support no flags. Make sure this doesn't crash
+
+if [ $ss == 512 ]; then
+ # only test on 512 byte ss since mke2fs assumes this on a file
+ truncate -s 5m img || framework_failure
+ mke2fs img || framework_failure
+ echo Error: No flags supported > out.exp
+ parted -s img set 1 foo on > out 2>&1
+ compare out.exp out || fail=1
+ parted -s img disk_set foo on > out 2>&1
+ compare out.exp out || fail=1
+fi
+
Exit $fail
--
2.17.1

View file

@ -0,0 +1,123 @@
From 7baf9fc4f50723869ffa2d3aae8123a3ed9f2b7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= <mail@nh2.me>
Date: Fri, 11 May 2018 21:09:05 +0200
Subject: [PATCH 86/92] mkpart: Allow negative start value when FS-TYPE is not
given
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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
Signed-off-by: Niklas Hambüchen <mail@nh2.me>
(cherry picked from commit f3b4015e216a3733082e71ff930526f3e8bf0c26)
---
parted/parted.c | 2 +-
tests/Makefile.am | 1 +
tests/t0213-mkpart-start-negative.sh | 48 ++++++++++++++++++++++++++++
4 files changed, 52 insertions(+), 1 deletion(-)
create mode 100755 tests/t0213-mkpart-start-negative.sh
diff --git a/parted/parted.c b/parted/parted.c
index b49e1df..2af324c 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -682,7 +682,7 @@ do_mkpart (PedDevice** dev, PedDisk** diskp)
peek_word = command_line_peek_word ();
if (part_type == PED_PARTITION_EXTENDED
- || (peek_word && isdigit (peek_word[0]))) {
+ || (peek_word && (isdigit (peek_word[0]) || peek_word[0] == '-'))) {
fs_type = NULL;
} else {
if (!command_line_get_fs_type (_("File system type?"),
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a840304..3851983 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,6 +25,7 @@ TESTS = \
t0210-gpt-resized-partition-entry-array.sh \
t0211-gpt-rewrite-header.sh \
t0212-gpt-many-partitions.sh \
+ t0213-mkpart-start-negative.sh \
t0220-gpt-msftres.sh \
t0250-gpt.sh \
t0251-gpt-unicode.sh \
diff --git a/tests/t0213-mkpart-start-negative.sh b/tests/t0213-mkpart-start-negative.sh
new file mode 100755
index 0000000..182ef0c
--- /dev/null
+++ b/tests/t0213-mkpart-start-negative.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Make sure parted mkpart ends the partition one sector before the specified
+# value if end is specified with IEC units.
+
+# Copyright (C) 2011-2018 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_512_byte_sector_size_
+n_mbs=8
+dev=dev-file
+
+dd if=/dev/null of=$dev bs=1M seek=$n_mbs || fail=1
+# start negative, end positive
+parted --align=none -s $dev -- mklabel gpt mkpart p1 -7MiB 2MiB > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+
+# start negative, end negative
+parted --align=none -s $dev -- mkpart p2 -6MiB -5MiB > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+
+# check boundaries of the partitions
+parted -m -s $dev u s p > out || fail=1
+
+# prepare expected output
+cat <<EOF > exp || framework_failure
+1:2048s:4095s:2048s::p1:;
+2:4096s:6143s:2048s::p2:;
+EOF
+
+# compare expected and actual outputs
+sed -e "1,2d" out > k; mv k out
+compare exp out || fail=1
+
+Exit $fail
--
2.17.1

View file

@ -0,0 +1,34 @@
From 5997eeff8313b9b7a413fd2becb042699061ea99 Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Thu, 12 May 2016 21:38:51 -0400
Subject: [PATCH 87/92] 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.
(cherry picked from commit 247e3fc6cd8bca79b7c0362886ae9b5b06ba6f8c)
---
parted/parted.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/parted/parted.c b/parted/parted.c
index 2af324c..60f9a89 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1562,8 +1562,11 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
start = part->geom.start;
end = oldend = part->geom.end;
- if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, NULL))
+ char *end_input;
+ if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
goto error;
+ _adjust_end_if_iec(&start, &end, range_end, end_input);
+ free(end_input);
/* Do not move start of the partition */
constraint = constraint_from_start_end_fixed_start (*dev, start, range_end);
if (!ped_disk_set_partition_geom (disk, part, constraint,
--
2.17.1

View file

@ -0,0 +1,239 @@
From 0380940d7c9e8301e7b52fd27672d5e0cb4971b0 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 21 Sep 2015 12:10:02 +0100
Subject: [PATCH 88/92] 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.
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
(cherry picked from commit b49388018931cab220b9dd50f3a2bd51401e48af)
---
README | 9 ++----
configure.ac | 49 --------------------------------
doc/parted.texi | 15 ----------
libparted/Makefile.am | 1 -
libparted/fs/reiserfs/reiserfs.c | 16 +----------
libparted/tests/Makefile.am | 1 -
libparted/tests/t2100-zerolen.sh | 3 --
parted.spec.in | 3 +-
8 files changed, 4 insertions(+), 93 deletions(-)
diff --git a/README b/README
index 3d1fee9..de91d4c 100644
--- a/README
+++ b/README
@@ -56,10 +56,5 @@ dangerous bugs before they would have done damage, so we think it's worth
it. Also, it means we get more bug reports ;)
-(2) When doing dependencies, remember that libreiserfs is a *soft* dependency,
-so I guess that means Debian-look-alikes should do a "suggests", but
-not a "requires".
-
-
-(3) When space is important, we suggest --without-readline, --disable-shared,
-and possibly --disable-nls and --disable-dynamic-loading.
+(2) When space is important, we suggest --without-readline, --disable-shared,
+and possibly --disable-nls.
diff --git a/configure.ac b/configure.ac
index f14cd71..0178dea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,20 +103,6 @@ if test "$enable_discover_only" = yes; then
fi
PARTED_LIBS=""
-AC_ARG_ENABLE([dynamic-loading],
-[ --enable-dynamic-loading support dynamic fs libraries [default=yes]], ,
- if test "$enable_discover_only" = yes; then
- enable_dynamic_loading=no
- else
- enable_dynamic_loading=yes
- fi
-)
-if test "$enable_discover_only" = yes \
- && test "$enable_dynamic_loading" = yes; then
- AC_MSG_ERROR(
-[You can't use --enable-dynamic-loading and --disable-discover-only together]
- )
-fi
AC_ARG_ENABLE([debug],
[ --enable-debug compile in assertions [default=yes]], ,
@@ -303,23 +289,6 @@ Or install gettext. GNU gettext is available from
])
fi
-dnl Check for libdl, if we are doing dynamic loading
-DL_LIBS=""
-AC_SUBST([DYNAMIC_LOADING])
-DYNAMIC_LOADING=no
-if test "$enable_dynamic_loading" = yes; then
- AC_CHECK_LIB([dl], [dlopen],
- DL_LIBS="-ldl"
- PARTED_LIBS="$PARTED_LIBS -ldl"
- DYNAMIC_LOADING=yes
- AC_DEFINE([DYNAMIC_LOADING], [1], [Lazy linking to fs libs]),
- AC_MSG_ERROR(
- [-ldl not found! Try using --disable-dynamic-loading]
- )
- )
-fi
-AC_SUBST([DL_LIBS])
-
dnl Check for libuuid
UUID_LIBS=""
AC_CHECK_LIB([uuid], [uuid_generate], [UUID_LIBS="-luuid"],
@@ -357,24 +326,6 @@ if test "$enable_selinux" = yes; then
fi
AC_SUBST([SELINUX_LIBS])
-dnl Check for libreiserfs
-REISER_LIBS=""
-if test "$enable_dynamic_loading" = no && test "$enable_discover_only" = no; then
- OLD_LIBS="$LIBS"
- AC_CHECK_LIB([dal], [dal_equals],
- LIBS="-ldal"
- AC_CHECK_LIB([reiserfs], [reiserfs_fs_probe],
- REISER_LIBS="-ldal -lreiserfs"
- AC_DEFINE([HAVE_LIBREISERFS], [1], [Have libreiserfs])
- )
- AC_CHECK_LIB([reiserfs], [reiserfs_fs_check],
- AC_DEFINE([HAVE_REISERFS_FS_CHECK], [1], [Have reiserfs_fs_check()])
- )
- )
- LIBS="$OLD_LIBS"
-fi
-AC_SUBST([REISER_LIBS])
-
dnl Check for termcap
if test "$with_readline" = yes; then
OLD_LIBS="$LIBS"
diff --git a/doc/parted.texi b/doc/parted.texi
index 414179d..f12459e 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -178,13 +178,6 @@ internationalisation support is desired.
@uref{ftp://ftp.gnu.org/gnu/gettext}
-@item libreiserfs, if you want reiserfs support:
-
- @uref{http://reiserfs.osdn.org.ua}
-
-Note that parted will automatically detect libreiserfs at runtime, and enable
-reiserfs support. libreiserfs is new, and hasn't been widely tested yet.
-
@end itemize
@node Supported Platforms
@@ -242,14 +235,6 @@ etc., where few libraries are available.
@item --disable-debug
don't include assertions
-@item --disable-dynamic-loading
-disables dynamic loading of some libraries (only libreiserfs for now,
-although we hope to expand this). Dynamic loading is useful because it
-allows you to reuse libparted shared libraries even when you don't know
-if some libraries will be available. It has a small overhead (mainly
-linking with libdl), so it may be useful to disable it on bootdisks if
-you don't need the flexibility.
-
@item --disable-nls
turns off native language support. This is useful for use with old
versions of glibc, or a trimmed down version of glibc suitable for
diff --git a/libparted/Makefile.am b/libparted/Makefile.am
index edc5f2e..81a5bbd 100644
--- a/libparted/Makefile.am
+++ b/libparted/Makefile.am
@@ -54,7 +54,6 @@ libparted_la_LIBADD = \
labels/liblabels.la \
$(top_builddir)/lib/libgnulib.la \
$(OS_LIBS) \
- $(DL_LIBS) \
$(DM_LIBS) \
$(SELINUX_LIBS) \
$(LIB_BLKID) \
diff --git a/libparted/fs/reiserfs/reiserfs.c b/libparted/fs/reiserfs/reiserfs.c
index 2efcdf3..ef809cd 100644
--- a/libparted/fs/reiserfs/reiserfs.c
+++ b/libparted/fs/reiserfs/reiserfs.c
@@ -1,5 +1,5 @@
/*
- reiserfs.c -- libparted / libreiserfs glue
+ reiserfs.c -- ReiserFS detection
Copyright (C) 2001-2002, 2007, 2009-2014 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -14,17 +14,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- This is all rather complicated. There are a few combinations:
- * shared libraries full support
- * dynamic libraries present full support (via dlopen)
- * dynamic libraries absent (full support disabled) (via dlopen)
- * discover only
-
- We'd love to hear comments...
-
- So far, we've opted for maximum flexibility for the user. Is it
- all worth it?
*/
#include <config.h>
@@ -49,9 +38,6 @@
static PedSector reiserfs_super_offset[] = { 128, 16, -1 };
static PedFileSystemType* reiserfs_type;
-#define FPTR
-#define FCLASS extern
-
static PedGeometry *reiserfs_probe(PedGeometry *geom)
{
int i;
diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
index 9689fb3..7954e91 100644
--- a/libparted/tests/Makefile.am
+++ b/libparted/tests/Makefile.am
@@ -35,5 +35,4 @@ $(TEST_LOGS): prereq
TESTS_ENVIRONMENT = \
top_srcdir='$(top_srcdir)' \
abs_top_srcdir='$(abs_top_srcdir)' \
- DYNAMIC_LOADING=$(DYNAMIC_LOADING) \
ENABLE_DEVICE_MAPPER=$(ENABLE_DEVICE_MAPPER)
diff --git a/libparted/tests/t2100-zerolen.sh b/libparted/tests/t2100-zerolen.sh
index ecd579c..e0e521e 100755
--- a/libparted/tests/t2100-zerolen.sh
+++ b/libparted/tests/t2100-zerolen.sh
@@ -28,9 +28,6 @@ init_root_dir_
test "$(uname -s)" = Linux \
|| skip_ "not on Linux"
-test "x$DYNAMIC_LOADING" = xyes \
- || skip_ "no dynamic loading support"
-
test "x$ENABLE_DEVICE_MAPPER" = xyes \
|| skip_ "no device-mapper support"
diff --git a/parted.spec.in b/parted.spec.in
index cd5a99a..bdbe218 100644
--- a/parted.spec.in
+++ b/parted.spec.in
@@ -60,8 +60,7 @@ Parted library, you need to install this package.
%endif
--enable-part-static \
--enable-pc98=no \
- --enable-Werror=no \
- --disable-dynamic-loading
+ --enable-Werror=no
%{__make} %{?_smp_mflags}
%install
--
2.17.1

View file

@ -0,0 +1,54 @@
From 754da2f4e5d96a813941125e7400c68f53fe127a Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Fri, 4 May 2018 10:57:56 -0400
Subject: [PATCH 89/92] 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.
(cherry picked from commit 4347ddb8e2dd01674c759e94eaaf5872915a2e48)
---
NEWS | 2 ++
libparted/fs/r/fat/bootsector.c | 12 ------------
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/NEWS b/NEWS
index 16f67b3..f7cc422 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,8 @@ GNU parted NEWS -*- outline -*-
** New Features
+ libparted-fs-resize: Work on non 512 byte sectors.
+
Add resizepart command to resize a partition. This works even on
mounted partitions.
diff --git a/libparted/fs/r/fat/bootsector.c b/libparted/fs/r/fat/bootsector.c
index 1d2b601..683b986 100644
--- a/libparted/fs/r/fat/bootsector.c
+++ b/libparted/fs/r/fat/bootsector.c
@@ -125,18 +125,6 @@ fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs)
PED_ASSERT (bs != NULL);
- if (PED_LE16_TO_CPU (bs->sector_size) != 512) {
- if (ped_exception_throw (
- PED_EXCEPTION_BUG,
- PED_EXCEPTION_IGNORE_CANCEL,
- _("This file system has a logical sector size of %d. "
- "GNU Parted is known not to work properly with sector "
- "sizes other than 512 bytes."),
- (int) PED_LE16_TO_CPU (bs->sector_size))
- != PED_EXCEPTION_IGNORE)
- return 0;
- }
-
fs_info->logical_sector_size = PED_LE16_TO_CPU (bs->sector_size) / 512;
fs_info->sectors_per_track = PED_LE16_TO_CPU (bs->secs_track);
--
2.17.1

View file

@ -0,0 +1,43 @@
From 80e2dcfb6253d6e2af51b4a4458acdef18438ff5 Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Fri, 11 May 2018 11:01:01 -0400
Subject: [PATCH 90/92] Fix atari label false positives
The atari label gets false positives easily, so probe it after
all other labels have said no.
(cherry picked from commit 395f8aabfecb28820006d37ec37e9ffe1d2eb1e3)
---
libparted/libparted.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libparted/libparted.c b/libparted/libparted.c
index d855d0e..3bd071d 100644
--- a/libparted/libparted.c
+++ b/libparted/libparted.c
@@ -80,12 +80,13 @@ extern void ped_disk_atari_init ();
static void
init_disk_types ()
{
+ /* Note that probing is done in the reverse order of init */
ped_disk_loop_init (); /* must be last in the probe list */
#if defined __s390__ || defined __s390x__
ped_disk_dasd_init();
#endif
-
+ ped_disk_atari_init (); /* easy false positives, so probe others first */
ped_disk_sun_init ();
#ifdef ENABLE_PC98
ped_disk_pc98_init ();
@@ -97,7 +98,6 @@ init_disk_types ()
ped_disk_bsd_init ();
ped_disk_amiga_init ();
ped_disk_aix_init ();
- ped_disk_atari_init ();
}
extern void ped_file_system_amiga_init (void);
--
2.17.1

View file

@ -0,0 +1,87 @@
From 073c24b5d2361857b8ce8b5dcd81a3e26fc05b96 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 27 Jun 2018 13:45:09 -0700
Subject: [PATCH 91/92] 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
---
tests/gpt-header-move | 15 ++++++++-------
tests/msdos-overlap | 5 ++---
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/tests/gpt-header-move b/tests/gpt-header-move
index 05cdc65..3dda5cb 100755
--- a/tests/gpt-header-move
+++ b/tests/gpt-header-move
@@ -3,20 +3,21 @@
# open img file, subtract 33 from altlba address, and move the last 33 sectors
# back by 33 sectors
-from struct import *
+from struct import unpack_from, pack_into
from zipfile import crc32
import array
import sys
+
file = open(sys.argv[1],'rb+')
file.seek(512)
gptheader = file.read(512)
-altlba = unpack_from('<q', gptheader,offset=32)[0]
-gptheader = array.array('c',gptheader)
+altlba = unpack_from('<q', gptheader, offset=32)[0]
+gptheader = array.array('B', gptheader)
pack_into('<Q', gptheader, 32, altlba-33)
#zero header crc
pack_into('<L', gptheader, 16, 0)
#compute new crc
-newcrc = ((crc32(buffer(gptheader,0,92))) & 0xFFFFFFFF)
+newcrc = ((crc32(gptheader[:92])) & 0xFFFFFFFF)
pack_into('<L', gptheader, 16, newcrc)
file.seek(512)
file.write(gptheader)
@@ -25,7 +26,7 @@ gptheader = file.read(512)
file.seek(512*(altlba-32))
backup = file.read(512*32)
altlba -= 33
-gptheader = array.array('c',gptheader)
+gptheader = array.array('B',gptheader)
#update mylba
pack_into('<Q', gptheader, 24, altlba)
#update table lba
@@ -33,9 +34,9 @@ pack_into('<Q', gptheader, 72, altlba-32)
#zero header crc
pack_into('<L', gptheader, 16, 0)
#compute new crc
-newcrc = ((crc32(buffer(gptheader,0,92))) & 0xFFFFFFFF)
+newcrc = ((crc32(gptheader[:92])) & 0xFFFFFFFF)
pack_into('<L', gptheader, 16, newcrc)
file.seek(512*(altlba-32))
file.write(backup)
file.write(gptheader)
-file.write("\0" * (512 * 33))
+file.write(b"\0" * (512 * 33))
diff --git a/tests/msdos-overlap b/tests/msdos-overlap
index 5bddfb0..d6ae8d6 100755
--- a/tests/msdos-overlap
+++ b/tests/msdos-overlap
@@ -14,12 +14,11 @@ BAD_ENTRY = (0x72, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
OFFSET = 0x1b8
if len(sys.argv) < 2:
- print "%s: <image or device>"
+ print("%s: <image or device>" % sys.argv[0])
sys.exit(1)
-data = "".join(chr(c) for c in BAD_ENTRY)
with open(sys.argv[1], "rb+") as f:
f.seek(OFFSET, 0)
- f.write(data)
+ f.write(bytes(bytearray(BAD_ENTRY)))
sys.exit(0)
--
2.17.1

View file

@ -0,0 +1,33 @@
From 38badae4d6b858da713b383b9bc7bdad6294ca1b Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 27 Jun 2018 13:47:33 -0700
Subject: [PATCH 92/92] Switch gpt-header-move and msdos-overlap to python3
---
tests/gpt-header-move | 2 +-
tests/msdos-overlap | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/gpt-header-move b/tests/gpt-header-move
index 3dda5cb..18f58d0 100755
--- a/tests/gpt-header-move
+++ b/tests/gpt-header-move
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# open img file, subtract 33 from altlba address, and move the last 33 sectors
# back by 33 sectors
diff --git a/tests/msdos-overlap b/tests/msdos-overlap
index d6ae8d6..b2b03e6 100755
--- a/tests/msdos-overlap
+++ b/tests/msdos-overlap
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
"""
Write an overlapping partition to a msdos disk
--
2.17.1

View file

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.2
Release: 31%{?dist}
Release: 33%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@ -95,7 +95,20 @@ Patch0078: 0078-libparted-Fix-udev-cookie-leak-in-_dm_resize_partiti.patch
Patch0079: 0079-atari.c-Drop-xlocale.h-1476934.patch
Patch0080: 0080-libparted-labels-link-with-libiconv-if-needed.patch
Patch0081: 0081-Add-support-for-NVDIMM-devices.patch
Patch0082: 0082-linux-Include-sys-sysmacros.h-for-major-macro.patch
Patch0083: 0083-Fix-make-check.patch
Patch0084: 0084-tests-fix-t6100-mdraid-partitions.patch
Patch0085: 0085-Fix-set-and-disk_set-to-not-crash-when-no-flags-are-.patch
Patch0086: 0086-mkpart-Allow-negative-start-value-when-FS-TYPE-is-no.patch
Patch0087: 0087-Fix-resizepart-iec-unit-end-sector.patch
Patch0088: 0088-build-Remove-unused-traces-of-dynamic-loading.patch
Patch0089: 0089-Lift-512-byte-restriction-on-fat-resize.patch
Patch0090: 0090-Fix-atari-label-false-positives.patch
# Use python3 in the buildroot
# Sent upstream 2018-06-27
Patch0091: 0091-Modify-gpt-header-move-and-msdos-overlap-to-work-wit.patch
Patch0092: 0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gcc
@ -116,13 +129,12 @@ BuildRequires: xfsprogs
BuildRequires: dosfstools
BuildRequires: perl-Digest-CRC
BuildRequires: bc
Buildrequires: python2
Buildrequires: python3
BuildRequires: gperf
BuildRequires: make
Requires(post): /sbin/ldconfig
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
Requires(postun): /sbin/ldconfig
# bundled gnulib library exception, as per packaging guidelines
# https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries
@ -192,7 +204,6 @@ make check
%post
/sbin/ldconfig
if [ -f %{_infodir}/parted.info.gz ]; then
/sbin/install-info %{_infodir}/parted.info.gz %{_infodir}/dir || :
fi
@ -202,9 +213,6 @@ if [ $1 = 0 ]; then
/sbin/install-info --delete %{_infodir}/parted.info.gz %{_infodir}/dir >/dev/null 2>&1 || :
fi
%postun -p /sbin/ldconfig
%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS NEWS README THANKS
@ -231,9 +239,28 @@ fi
%changelog
* Thu Jul 19 2018 Brian C. Lane <bcl@redhat.com> - 3.2-33
- drop ldconfig, it no longer needs to be called on un/install (bcl)
- Fix msdos-overlap py3 conversion (bcl)
* Wed Jun 27 2018 Brian C. Lane <bcl@redhat.com> - 3.2-32
- Use python3 in buildroot
- Add make to BuildRequires
- Switch gpt-header-move and msdos-overlap to python3 (bcl)
- Modify gpt-header-move and msdos-overlap to work with py2 or py3 (bcl)
- Fix atari label false positives (psusi)
- Lift 512 byte restriction on fat resize (psusi)
- build: Remove unused traces of dynamic loading (cjwatson)
- Fix resizepart iec unit end sector (psusi)
- mkpart: Allow negative start value when FS-TYPE is not given (mail)
- Fix set and disk_set to not crash when no flags are supported (psusi)
- tests: fix t6100-mdraid-partitions (psusi)
- Fix make check (psusi)
- linux: Include <sys/sysmacros.h> for major() macro. (rjones)
* Mon Feb 19 2018 Brian C. Lane <bcl@redhat.com> - 3.2-31
- Add gcc BuildRequires for future minimal buildroot support
- Remove %clean section
- Remove %%clean section
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-30
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild