Accepting request 1115845 from Base:System

OBS-URL: https://build.opensuse.org/request/show/1115845
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/parted?expand=0&rev=140
This commit is contained in:
Ana Guerrero 2023-10-06 19:12:41 +00:00 committed by Git OBS Bridge
commit d68f9166e0
5 changed files with 14 additions and 81 deletions

BIN
fatresize-0.1.tar.bz2 (Stored with Git LFS)

Binary file not shown.

3
fatresize-0.2.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f06a0a83d086d44295b7b79983d00988a99abe22b286dfa59785efd09c9b7c74
size 2152

View File

@ -1,73 +0,0 @@
From: Sebastian Parschauer <sparschauer@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 <sparschauer@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;

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Oct 05 11:18:18 CEST 2023 - aschnell@suse.com
- updated fatresize to version 0.2 which includes a man-page
removed patches:
- fatresize-fix-getting-dev-name.patch
-------------------------------------------------------------------
Thu Jun 23 07:34:55 CEST 2022 - aschnell@suse.com
@ -1816,7 +1823,7 @@ Thu Jun 27 11:18:53 CEST 2002 - fehr@suse.de
-------------------------------------------------------------------
Mon Jun 10 12:55:00 CEST 2002 - fehr@suse.de
- add patch to resize also partitions with unkown fs under YaST2
- add patch to resize also partitions with unknown fs under YaST2
-------------------------------------------------------------------
Tue May 7 13:04:28 CEST 2002 - fehr@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package parted
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -28,7 +28,7 @@ Source1: ftp://ftp.gnu.org/gnu/parted/%{name}-%{version}.tar.xz.sig
# Taken from https://savannah.gnu.org/project/release-gpgkeys.php?group=parted&download=1
Source2: %{name}.keyring
Source3: baselibs.conf
Source4: fatresize-0.1.tar.bz2
Source4: fatresize-0.2.tar.xz
# Build patches
Patch1: parted-2.4-ncursesw6.patch
@ -67,7 +67,6 @@ Patch39: type-command.patch
# bsc#1164907
# Fatresize
Patch100: parted-fatresize-autoconf.patch
Patch101: fatresize-fix-getting-dev-name.patch
# Tests patches
Patch156: tests-add-helper-require_swap_.patch
Patch157: tests-add-dev-md-check-to-t6100.patch
@ -161,7 +160,6 @@ to develop applications that require these.
%patch38 -p1
%patch39 -p1
%patch100 -p1
%patch101 -p1
%patch156 -p1
%patch157 -p1
%patch158 -p1
@ -204,6 +202,7 @@ rm %{buildroot}%{_libdir}/*.la
%doc AUTHORS BUGS ChangeLog NEWS README THANKS TODO
%{_sbindir}/*
%{_mandir}/man8/part*.8.gz
%{_mandir}/man8/fatresize.8.gz
%doc %{_infodir}/*.info*
%files devel