Hello community,

here is the log from the commit of package parted for openSUSE:Factory checked 
in at 2017-12-21 11:22:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/parted (Old)
 and      /work/SRC/openSUSE:Factory/.parted.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "parted"

Thu Dec 21 11:22:04 2017 rev:121 rq:558625 version:3.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/parted/parted.changes    2017-11-25 
08:40:26.191116189 +0100
+++ /work/SRC/openSUSE:Factory/.parted.new/parted.changes       2017-12-21 
11:22:05.256777111 +0100
@@ -1,0 +2,7 @@
+Tue Dec 19 17:23:10 UTC 2017 - sparscha...@suse.de
+
+- fatresize: Fix getting the device name from partition name
+  (boo#959181)
+  - add: fatresize-fix-getting-dev-name.patch
+
+-------------------------------------------------------------------

New:
----
  fatresize-fix-getting-dev-name.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ parted.spec ++++++
--- /var/tmp/diff_new_pack.Cy910y/_old  2017-12-21 11:22:06.676707877 +0100
+++ /var/tmp/diff_new_pack.Cy910y/_new  2017-12-21 11:22:06.680707682 +0100
@@ -87,6 +87,7 @@
 Patch59:        parted-fix-resizepart-and-rm-command.patch
 # Fatresize
 Patch100:       parted-fatresize-autoconf.patch
+Patch101:       fatresize-fix-getting-dev-name.patch
 # Upstream tests patches
 Patch150:       tests-set-optimal-blocks-for-scsi_debug.patch
 Patch151:       tests-increase-scsi_debug-tmo.patch
@@ -194,6 +195,7 @@
 %patch58 -p1
 %patch59 -p1
 %patch100 -p1
+%patch101 -p1
 %patch150 -p1
 %patch151 -p1
 %patch152 -p1

++++++ fatresize-fix-getting-dev-name.patch ++++++
From: Sebastian Parschauer <sparscha...@suse.de>
Date: Sun, 3 Dec 2017 12:09:44 +0100
Subject: Fix getting the device name from partition name
References: boo#959181
Patch-mainline: submitted, https://github.com/ya-mouse/fatresize/pull/4

There are many partition device names like e.g. /dev/mmcblk0p1 where
it is not enough to trim the trailing digits to get the disk device
name. Using open() here would depend on a POSIX platform. So do it
like _ped_device_probe() and silence libparted exceptions and try
to get the device with ped_device_get(). Trim further trailing
characters until libparted finds it. Print an error and exit if
the partition name is invalid.

Fixes #2

Signed-off-by: Sebastian Parschauer <sparscha...@suse.de>
---
 fatresize/fatresize.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

--- a/fatresize/fatresize.c
+++ b/fatresize/fatresize.c
@@ -9,6 +9,7 @@
 #include <unistd.h>
 #include <ctype.h>
 
+#include <parted/parted.h>
 #include <parted/device.h>
 #include <parted/filesys.h>
 
@@ -79,6 +80,18 @@ resize(const char* disk_device, int part
 }
 
 
+/* Code parts have been taken from _ped_device_probe(). */
+static void
+probe_device(PedDevice **dev, const char *path)
+{
+       ped_exception_fetch_all();
+       *dev = ped_device_get(path);
+       if (!*dev)
+               ped_exception_catch();
+       ped_exception_leave_all();
+}
+
+
 int
 main(int argc, char** argv)
 {
@@ -126,6 +139,22 @@ main(int argc, char** argv)
        disk_device = strndup(argv[1], pos - argv[1] + 1);
        partition_number = strtol(pos + 1, NULL, 10);
 
+       PedDevice *peddev = NULL;
+       /* check if the device really exists */
+       while (pos != argv[1] && *pos != '/' && !peddev)
+       {
+               disk_device[pos - argv[1] + 1] = '\0';
+               probe_device(&peddev, disk_device);
+               --pos;
+       }
+       if (!peddev)
+       {
+               free(disk_device);
+               fprintf(stderr, "invalid device\n");
+               exit(EXIT_FAILURE);
+       }
+       ped_device_destroy(peddev);
+
        if (argc == 3)
        {
                char* endptr = NULL;



Reply via email to