summaryrefslogtreecommitdiff
path: root/sys-block/parted/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-block/parted/files
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-block/parted/files')
-rw-r--r--sys-block/parted/files/parted-2.4-no-gets.patch10
-rw-r--r--sys-block/parted/files/parted-2.4-readline.patch11
-rw-r--r--sys-block/parted/files/parted-3.1-readline.patch11
-rw-r--r--sys-block/parted/files/parted-3.1-zfs.patch170
-rw-r--r--sys-block/parted/files/parted-3.2-devmapper.patch60
-rw-r--r--sys-block/parted/files/parted-3.2-fix-resizing-FAT16.patch64
-rw-r--r--sys-block/parted/files/parted-3.2-po4a-mandir.patch11
-rw-r--r--sys-block/parted/files/parted-3.2-sysmacros.patch28
8 files changed, 365 insertions, 0 deletions
diff --git a/sys-block/parted/files/parted-2.4-no-gets.patch b/sys-block/parted/files/parted-2.4-no-gets.patch
new file mode 100644
index 000000000000..efa6e00b8d45
--- /dev/null
+++ b/sys-block/parted/files/parted-2.4-no-gets.patch
@@ -0,0 +1,10 @@
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -735,7 +735,6 @@
+ /* It is very rare that the developer ever has full control of stdin,
+ so any use of gets warrants an unconditional warning. Assume it is
+ always declared, since it is required by C89. */
+-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+ #endif
+
+
diff --git a/sys-block/parted/files/parted-2.4-readline.patch b/sys-block/parted/files/parted-2.4-readline.patch
new file mode 100644
index 000000000000..5873ed1e5d43
--- /dev/null
+++ b/sys-block/parted/files/parted-2.4-readline.patch
@@ -0,0 +1,11 @@
+--- a/parted/ui.c
++++ b/parted/ui.c
+@@ -1440,7 +1440,7 @@
+ #ifdef HAVE_LIBREADLINE
+ if (!opt_script_mode) {
+ rl_initialize ();
+- rl_attempted_completion_function = (CPPFunction*) complete_function;
++ rl_attempted_completion_function = (rl_completion_func_t*) complete_function;
+ readline_state.in_readline = 0;
+ }
+ #endif
diff --git a/sys-block/parted/files/parted-3.1-readline.patch b/sys-block/parted/files/parted-3.1-readline.patch
new file mode 100644
index 000000000000..936ec00cbefc
--- /dev/null
+++ b/sys-block/parted/files/parted-3.1-readline.patch
@@ -0,0 +1,11 @@
+--- a/parted/ui.c
++++ b/parted/ui.c
+@@ -1474,7 +1474,7 @@
+ #ifdef HAVE_LIBREADLINE
+ if (!opt_script_mode) {
+ rl_initialize ();
+- rl_attempted_completion_function = (CPPFunction*) complete_function;
++ rl_attempted_completion_function = (rl_completion_func_t*) complete_function;
+ readline_state.in_readline = 0;
+ }
+ #endif
diff --git a/sys-block/parted/files/parted-3.1-zfs.patch b/sys-block/parted/files/parted-3.1-zfs.patch
new file mode 100644
index 000000000000..a87d6d346551
--- /dev/null
+++ b/sys-block/parted/files/parted-3.1-zfs.patch
@@ -0,0 +1,170 @@
+commit 65f838008107a688751dd5a2753c9073e9353daf
+Author: root <root@desktop.(none)>
+Date: Fri Jun 1 16:26:34 2012 -0400
+
+ Add ZFS Support
+
+diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am
+index 8d48ea1..51b4151 100644
+--- a/libparted/fs/Makefile.am
++++ b/libparted/fs/Makefile.am
+@@ -49,7 +49,8 @@ libfs_la_SOURCES = \
+ xfs/platform_defs.h \
+ xfs/xfs.c \
+ xfs/xfs_sb.h \
+- xfs/xfs_types.h
++ xfs/xfs_types.h \
++ zfs/zfs.c
+
+ lib_LTLIBRARIES = libparted-fs-resize.la
+
+diff --git a/libparted/fs/Makefile.in b/libparted/fs/Makefile.in
+index 4335eb1..e3a134b 100644
+--- a/libparted/fs/Makefile.in
++++ b/libparted/fs/Makefile.in
+@@ -1112,7 +1112,8 @@ libfs_la_SOURCES = \
+ xfs/platform_defs.h \
+ xfs/xfs.c \
+ xfs/xfs_sb.h \
+- xfs/xfs_types.h
++ xfs/xfs_types.h \
++ zfs/zfs.c
+
+ lib_LTLIBRARIES = libparted-fs-resize.la
+ EXTRA_DIST = hfs/DOC hfs/HISTORY hfs/TODO fsresize.sym
+diff --git a/libparted/fs/zfs/Makefile.am b/libparted/fs/zfs/Makefile.am
+new file mode 100644
+index 0000000..3273c6a
+--- /dev/null
++++ b/libparted/fs/zfs/zfs.c
+@@ -0,0 +1,81 @@
++/*
++ libparted - a library for manipulating disk partitions
++ Copyright (C) 2000, 2007, 2009-2010 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/>.
++*/
++
++#include <config.h>
++
++#include <parted/parted.h>
++#include <parted/endian.h>
++
++#if ENABLE_NLS
++# include <libintl.h>
++# define _(String) dgettext (PACKAGE, String)
++#else
++# define _(String) (String)
++#endif /* ENABLE_NLS */
++
++#include <unistd.h>
++
++#define ZFS_BLOCK_SIZES ((int[2]){512, 0})
++
++#define ZFS_SIGNATURE 0x00bab10c
++
++struct zfs_uberblock
++{
++ uint64_t signature;
++ uint64_t version;
++};
++
++static PedGeometry*
++zfs_probe (PedGeometry* geom)
++{
++ uint8_t buf[512];
++ struct zfs_uberblock *uber = (void *) buf;
++
++ if (!ped_geometry_read (geom, buf, 256, 1))
++ return 0;
++
++ if ((le64toh (uber->signature) == ZFS_SIGNATURE
++ || be64toh (uber->signature) == ZFS_SIGNATURE)
++ && uber->version != 0)
++ return ped_geometry_new (geom->dev, geom->start, geom->length);
++ else
++ return NULL;
++}
++
++static PedFileSystemOps zfs_ops = {
++ probe: zfs_probe,
++};
++
++static PedFileSystemType zfs_type = {
++ next: NULL,
++ ops: &zfs_ops,
++ name: "zfs",
++ block_sizes: ZFS_BLOCK_SIZES
++};
++
++void
++ped_file_system_zfs_init ()
++{
++ ped_file_system_type_register (&zfs_type);
++}
++
++void
++ped_file_system_zfs_done ()
++{
++ ped_file_system_type_unregister (&zfs_type);
++}
+diff --git a/libparted/libparted.c b/libparted/libparted.c
+index a6d86f0..6545989 100644
+--- a/libparted/libparted.c
++++ b/libparted/libparted.c
+@@ -109,6 +109,7 @@ extern void ped_file_system_hfs_init (void);
+ extern void ped_file_system_fat_init (void);
+ extern void ped_file_system_ext2_init (void);
+ extern void ped_file_system_nilfs2_init (void);
++extern void ped_file_system_zfs_init (void);
+
+ static void
+ init_file_system_types ()
+@@ -124,6 +125,7 @@ init_file_system_types ()
+ ped_file_system_fat_init ();
+ ped_file_system_ext2_init ();
+ ped_file_system_nilfs2_init ();
++ ped_file_system_zfs_init ();
+ }
+
+ extern void ped_disk_aix_done ();
+@@ -186,6 +188,7 @@ extern void ped_file_system_reiserfs_done (void);
+ extern void ped_file_system_ufs_done (void);
+ extern void ped_file_system_xfs_done (void);
+ extern void ped_file_system_amiga_done (void);
++extern void ped_file_system_zfs_done (void);
+
+ static void
+ done_file_system_types ()
+@@ -201,6 +204,7 @@ done_file_system_types ()
+ ped_file_system_ufs_done ();
+ ped_file_system_xfs_done ();
+ ped_file_system_amiga_done ();
++ ped_file_system_zfs_done ();
+ }
+
+ static void _done() __attribute__ ((destructor));
+diff --git a/scripts/data/abi/baseline_symbols.txt b/scripts/data/abi/baseline_symbols.txt
+index 9162f1a..8bb87e6 100644
+--- a/scripts/data/abi/baseline_symbols.txt
++++ b/scripts/data/abi/baseline_symbols.txt
+@@ -344,6 +344,8 @@ FUNC:ped_file_system_ufs_done
+ FUNC:ped_file_system_ufs_init
+ FUNC:ped_file_system_xfs_done
+ FUNC:ped_file_system_xfs_init
++FUNC:ped_file_system_zfs_done
++FUNC:ped_file_system_zfs_init
+ FUNC:ped_geometry_check
+ FUNC:ped_geometry_destroy
+ FUNC:ped_geometry_duplicate
diff --git a/sys-block/parted/files/parted-3.2-devmapper.patch b/sys-block/parted/files/parted-3.2-devmapper.patch
new file mode 100644
index 000000000000..0cd3e0e3307f
--- /dev/null
+++ b/sys-block/parted/files/parted-3.2-devmapper.patch
@@ -0,0 +1,60 @@
+--- a/libparted/arch/linux.c
++++ b/libparted/arch/linux.c
+@@ -2304,6 +2304,7 @@
+ return r < 0 ? NULL : resultp;
+ }
+
++#ifdef ENABLE_DEVICE_MAPPER
+ static char *
+ dm_canonical_path (PedDevice const *dev)
+ {
+@@ -2326,12 +2327,22 @@
+ err:
+ return NULL;
+ }
++#endif /* ENABLE_DEVICE_MAPPER */
+
+ static char*
+ _device_get_part_path (PedDevice const *dev, int num)
+ {
+- char *devpath = (dev->type == PED_DEVICE_DM
+- ? dm_canonical_path (dev) : dev->path);
++ char *devpath =
++#ifdef ENABLE_DEVICE_MAPPER
++ (
++ dev->type == PED_DEVICE_DM
++ ? dm_canonical_path (dev) :
++#endif /* ENABLE_DEVICE_MAPPER */
++ dev->path
++#ifdef ENABLE_DEVICE_MAPPER
++ )
++#endif /* ENABLE_DEVICE_MAPPER */
++ ;
+ size_t path_len = strlen (devpath);
+ char *result;
+ /* Check for devfs-style /disc => /partN transformation
+@@ -2945,12 +2956,14 @@
+ unsigned long long *length);
+
+
++#ifdef ENABLE_DEVICE_MAPPER
+ if (disk->dev->type == PED_DEVICE_DM) {
+ add_partition = _dm_add_partition;
+ remove_partition = _dm_remove_partition;
+ resize_partition = _dm_resize_partition;
+ get_partition_start_and_length = _dm_get_partition_start_and_length;
+ } else {
++#endif /* ENABLE_DEVICE_MAPPER */
+ add_partition = _blkpg_add_partition;
+ remove_partition = _blkpg_remove_partition;
+ #ifdef BLKPG_RESIZE_PARTITION
+@@ -2959,7 +2972,9 @@
+ resize_partition = NULL;
+ #endif
+ get_partition_start_and_length = _kernel_get_partition_start_and_length;
++#ifdef ENABLE_DEVICE_MAPPER
+ }
++#endif /* ENABLE_DEVICE_MAPPER */
+
+ /* lpn = largest partition number.
+ * for remove pass, use greater of device or label limit */
diff --git a/sys-block/parted/files/parted-3.2-fix-resizing-FAT16.patch b/sys-block/parted/files/parted-3.2-fix-resizing-FAT16.patch
new file mode 100644
index 000000000000..2a5a2311f1dd
--- /dev/null
+++ b/sys-block/parted/files/parted-3.2-fix-resizing-FAT16.patch
@@ -0,0 +1,64 @@
+From 1e9e770f4bc7f3d80e09ecd1df58575fad064163 Mon Sep 17 00:00:00 2001
+From: Mike Fleetwood <mike.fleetwood@googlemail.com>
+Date: Sun, 28 Sep 2014 15:15:48 +0000
+Subject: lib-fs-resize: Prevent crash resizing FAT16 file systems
+
+Resizing FAT16 file system crashes in libparted/fs/r/fat/resize.c
+create_resize_context() because it was dereferencing NULL pointer
+fs_info->info_sector to copy the info_sector.
+
+Only FAT32 file systems have info_sector populated by fat_open() ->
+fat_info_sector_read(). FAT12 and FAT16 file systems don't have an
+info_sector so pointer fs_info->info_sector remains assigned NULL from
+fat_alloc(). When resizing a FAT file system create_resize_context()
+was always dereferencing fs_info->info_sector to memory copy the
+info_sector, hence it crashed for FAT12 and FAT16.
+
+Make create_resize_context() only copy the info_sector for FAT32 file
+systems.
+
+Reported by Christian Hesse in
+https://bugzilla.gnome.org/show_bug.cgi?id=735669
+---
+diff --git a/NEWS b/NEWS
+index 297b0a5..da7db50 100644
+--- a/NEWS
++++ b/NEWS
+@@ -2,6 +2,10 @@ GNU parted NEWS -*- outline -*-
+
+ * Noteworthy changes in release ?.? (????-??-??) [?]
+
++** Bug Fixes
++
++ libparted-fs-resize: Prevent crash resizing FAT16 file systems.
++
+
+ * Noteworthy changes in release 3.2 (2014-07-28) [stable]
+
+diff --git a/libparted/fs/r/fat/resize.c b/libparted/fs/r/fat/resize.c
+index 919acf0..bfe60a0 100644
+--- a/libparted/fs/r/fat/resize.c
++++ b/libparted/fs/r/fat/resize.c
+@@ -668,11 +668,17 @@ create_resize_context (PedFileSystem* fs, const PedGeometry* new_geom)
+
+ /* preserve boot code, etc. */
+ new_fs_info->boot_sector = ped_malloc (new_geom->dev->sector_size);
+- new_fs_info->info_sector = ped_malloc (new_geom->dev->sector_size);
+ memcpy (new_fs_info->boot_sector, fs_info->boot_sector,
+ new_geom->dev->sector_size);
+- memcpy (new_fs_info->info_sector, fs_info->info_sector,
+- new_geom->dev->sector_size);
++ new_fs_info->info_sector = NULL;
++ if (fs_info->fat_type == FAT_TYPE_FAT32)
++ {
++ PED_ASSERT (fs_info->info_sector != NULL);
++ new_fs_info->info_sector =
++ ped_malloc (new_geom->dev->sector_size);
++ memcpy (new_fs_info->info_sector, fs_info->info_sector,
++ new_geom->dev->sector_size);
++ }
+
+ new_fs_info->logical_sector_size = fs_info->logical_sector_size;
+ new_fs_info->sector_count = new_geom->length;
+--
+cgit v0.9.0.2
diff --git a/sys-block/parted/files/parted-3.2-po4a-mandir.patch b/sys-block/parted/files/parted-3.2-po4a-mandir.patch
new file mode 100644
index 000000000000..be0a9c69f403
--- /dev/null
+++ b/sys-block/parted/files/parted-3.2-po4a-mandir.patch
@@ -0,0 +1,11 @@
+--- a/doc/po4a.mk
++++ b/doc/po4a.mk
+@@ -23,7 +23,7 @@
+ # threshold is 80%), it won't be distributed, and the build won't fail.
+ #
+
+-mandir = $(mandir)/$(lang)
++mandir := $(mandir)/$(lang)
+
+ # Inform automake that we want to install some man pages in section 1, 5
+ # and 8.
diff --git a/sys-block/parted/files/parted-3.2-sysmacros.patch b/sys-block/parted/files/parted-3.2-sysmacros.patch
new file mode 100644
index 000000000000..a29e7619b148
--- /dev/null
+++ b/sys-block/parted/files/parted-3.2-sysmacros.patch
@@ -0,0 +1,28 @@
+https://bugs.gentoo.org/580022
+
+From dec8995fe80508374beba6356f6ecbba8ef6b18b Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 21 Jun 2016 15:01:08 -0400
+Subject: [PATCH] include sysmacros.h for major/minor/makedev
+
+Linux C libs are moving away from including this header implicitly via
+sys/types.h, so include it explicitly.
+---
+ libparted/arch/linux.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
+index 326b95619d31..e5c168be3c68 100644
+--- a/libparted/arch/linux.c
++++ b/libparted/arch/linux.c
+@@ -37,6 +37,7 @@
+ #include <dirent.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <sys/types.h>
+ #include <sys/utsname.h> /* for uname() */
+ #include <scsi/scsi.h>
+--
+2.8.2
+