bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FS-support removal postponed: warn-only, for starters


From: Jim Meyering
Subject: FS-support removal postponed: warn-only, for starters
Date: Thu, 01 Oct 2009 15:12:35 +0200

In the interest of making a release promptly, so that the >512-byte
sector support can begin to get some exposure, I've scaled back to
merely warning about the upcoming removal of FS-manipulation capabilities.

With this change, any attempt to use an FS-manip operation will now
evoke this warning:

  $ sudo parted/parted -s /dev/sdd check 1
  WARNING: you are attempting to use parted to operate on (check) a file system.
  parted's file system manipulation code is not as robust as what you'll find in
  dedicated, file-system-specific packages like e2fsprogs.  We recommend
  you use parted only to manipulate partition tables, whenever possible.
  Support for performing most types and operations on most types of file
  systems will be removed in an upcoming release.
  Error: Partition /dev/sdd1 is being used. You must unmount it before you 
modify it with Parted.
  [Exit 1]

unless you set the undocumented environment variable,
PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING.

>From a2f21d4ba78eab54e20721b8975151edb95e0ab4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 1 Oct 2009 15:01:52 +0200
Subject: [PATCH] parted: issue a warning upon any use of a file-system op

* parted/parted.c (issue_fs_op_warning): New function.
(do_cp, do_mkfs, do_mkpartfs, do_move, do_resize, do_check): Call it.
* tests/test-lib.sh: Export the envvar setting,
PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING=1 to suppress
those warnings while running the few remaining FS-related tests.
---
 parted/parted.c   |   22 ++++++++++++++++++++++
 tests/test-lib.sh |    1 +
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/parted/parted.c b/parted/parted.c
index 0dd11d2..30500db 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -444,9 +444,26 @@ help_on (char* topic)
         command_print_help (cmd);
 }

+/* Issue a warning about upcoming removal of FS support.  */
+static void
+issue_fs_op_warning (char const *op)
+{
+  if (getenv ("PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING"))
+    return;
+  fprintf (stderr,
+ _("WARNING: you are attempting to use %s to operate on (%s) a file system.\n"
+   "%s's file system manipulation code is not as robust as what you'll find 
in\n"
+   "dedicated, file-system-specific packages like e2fsprogs.  We recommend\n"
+   "you use %s only to manipulate partition tables, whenever possible.\n"
+   "Support for performing most types and operations on most types of file\n"
+   "systems will be removed in an upcoming release.\n"),
+   program_name, op, program_name, program_name);
+}
+
 static int
 do_check (PedDevice** dev)
 {
+        issue_fs_op_warning ("check");
         PedDisk*        disk;
         PedFileSystem*  fs;
         PedPartition*   part = NULL;
@@ -483,6 +500,7 @@ error:
 static int
 do_cp (PedDevice** dev)
 {
+        issue_fs_op_warning ("cp");
         PedDisk*                src_disk;
         PedDisk*                dst_disk;
         PedPartition*           src = NULL;
@@ -635,6 +653,7 @@ error:
 static int
 do_mkfs (PedDevice** dev)
 {
+        issue_fs_op_warning ("mkfs");
         PedDisk*                disk;
         PedPartition*           part = NULL;
         const PedFileSystemType* type = ped_file_system_type_get ("ext2");
@@ -863,6 +882,7 @@ error:
 static int
 do_mkpartfs (PedDevice** dev)
 {
+        issue_fs_op_warning ("mkpartfs");
         PedDisk*            disk;
         PedPartition*       part;
         PedPartitionType    part_type;
@@ -1036,6 +1056,7 @@ error:
 static int
 do_move (PedDevice** dev)
 {
+        issue_fs_op_warning ("move");
         PedDisk*        disk;
         PedPartition*   part = NULL;
         PedFileSystem*  fs;
@@ -1778,6 +1799,7 @@ error:
 static int
 do_resize (PedDevice** dev)
 {
+        issue_fs_op_warning ("resize");
         PedDisk                 *disk;
         PedPartition            *part = NULL;
         PedFileSystem           *fs;
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index ff22fbc..3deec79 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -7,6 +7,7 @@ LANG=C
 LC_ALL=C
 TZ=UTC
 export LANG LC_ALL TZ
+export PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING=1

 . ./init.sh || { echo >&2 you must run make first; exit 1; }

--
1.6.5.rc2.177.ga9dd6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]