Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory
parted
parted-add-ignore-busy-option.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File parted-add-ignore-busy-option.patch of Package parted
From: Sebastian Parschauer <sparschauer@suse.de> Date: Mon, 20 Nov 2017 18:01:56 +0100 Subject: parted: Add '--ignore-busy' option References: bsc#1058667 Patch-mainline: not yet, based on v3 submitted on 2017-11-07 There are dangerous actions like e.g. shrinking or removing a busy partition which should be possible in script mode but not without using an option to enforce that. This is meant to prevent buggy scripts from doing those actions unintentionally. Also add proper printing of the help text for a long option without a short option. Suggested-by: Phillip Susi <psusi@ubuntu.com> Signed-off-by: Sebastian Parschauer <sparschauer@suse.de> --- doc/C/parted.8 | 3 +++ parted/parted.c | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) Index: parted-3.3/doc/C/parted.8 =================================================================== --- parted-3.3.orig/doc/C/parted.8 +++ parted-3.3/doc/C/parted.8 @@ -30,6 +30,9 @@ never prompts for user intervention .B -v, --version displays the version .TP +.B --ignore-busy +perform the requested action in script mode although a partition is busy +.TP .B --wipesignatures mkpart wipes the superblock signatures from the disk region where it is about to create the partition Index: parted-3.3/parted/parted.c =================================================================== --- parted-3.3.orig/parted/parted.c +++ parted-3.3/parted/parted.c @@ -76,8 +76,9 @@ static int MEGABYTE_SECTORS (PedDevice* enum { PRETEND_INPUT_TTY = CHAR_MAX + 1, - WIPESIGNATURES = CHAR_MAX + 2, + IGNORE_BUSY = CHAR_MAX + 2, + WIPESIGNATURES = CHAR_MAX + 3, }; /* Output modes */ enum @@ -118,6 +119,7 @@ static struct option const options[] = { {"fix", 0, NULL, 'f'}, {"version", 0, NULL, 'v'}, {"align", required_argument, NULL, 'a'}, + {"ignore-busy", 0, NULL, IGNORE_BUSY}, {"wipesignatures", 0, NULL, WIPESIGNATURES}, {"-pretend-input-tty", 0, NULL, PRETEND_INPUT_TTY}, {NULL, 0, NULL, 0} @@ -130,10 +132,13 @@ static const char *const options_help [] {"fix", N_("in script mode, fix instead of abort when asked")}, {"version", N_("displays the version")}, {"align=[none|cyl|min|opt]", N_("alignment for new partitions")}, + {"ignore-busy", N_("perform action although partition is busy")}, {"wipesignatures", N_("wipe superblock signatures when creating partition")}, {NULL, NULL} }; +#define LONGOPT_HELP_START 6 /* index to first long option help */ + int opt_script_mode = 0; int opt_fix_mode = 0; int pretend_input_tty = 0; @@ -141,6 +146,7 @@ int opt_machine_mode = 0; int disk_is_modified = 0; int is_toggle_mode = 0; int alignment = ALIGNMENT_OPTIMAL; +int ignore_busy = 0; static const char* number_msg = N_( "NUMBER is the partition number used by Linux. On MS-DOS disk labels, the " @@ -514,12 +520,17 @@ print_options_help () { int i; - for (i=0; options_help [i][0]; i++) { + for (i=0; i < LONGOPT_HELP_START; i++) { printf (" -%c, --%-25.25s %s\n", options_help [i][0][0], options_help [i][0], _(options_help [i][1])); } + for (i=LONGOPT_HELP_START; options_help [i][0]; i++) { + printf (" --%-29.25s %s\n", + options_help [i][0], + _(options_help [i][1])); + } } int @@ -2299,6 +2310,7 @@ while (1) alignment = XARGMATCH ("--align", optarg, align_args, align_types); break; + case IGNORE_BUSY: ignore_busy = 1; break; case PRETEND_INPUT_TTY: pretend_input_tty = 1; break;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor