Skip to content
  1. Jul 26, 2024
  2. Jun 15, 2024
  3. Mar 17, 2024
    • Mike Fleetwood's avatar
      Recognise NBDs (Network Block Devices) (#247) · 81c22713
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Network Block Devices are not displayed in GParted as partitionable
      devices.  They do appear in /proc/partitions, are reported by
      fdisk -l [1] and by ped_device_probe_all() from libparted.  Therefore
      include them.
      
      Create NBD device for testing:
          # truncate -s 1G /tmp/disk-1G.img
          # nbd-server -C /dev/null 9000 /tmp/disk-1G.img
          # nbd-client localhost 9000 /dev/nbd0
      
      After creating a couple of partitions for testing, the contents of
      /proc/partitions looks like this:
          # egrep 'name|nbd' /proc/partitions
          major minor  #blocks  name
            43        0    1048576 nbd0
            43        1     262144 nbd0p1
            43        2     785408 nbd0p2
      
      Listing all disks using fdisk:
          # fdisk -l
          ...
      
          Disk /dev/nbd0: 1 GiB, 1073741824 bytes, 2097152 sectors
          Units: sectors of 1 * 512 = 512 bytes
          Sector size (logical/physical): 512 bytes / 512 bytes
          I/O size (minimum/optimal): 512 bytes / 512 bytes
          Disklabel type: dos
          Disk identifier: 0...
      81c22713
  4. Mar 16, 2024
  5. Mar 09, 2024
  6. Mar 02, 2024
  7. Feb 26, 2024
  8. Feb 25, 2024
    • Mike Fleetwood's avatar
      Document future Debian/Ubuntu build time dependency in README (!121) · 16c2533a
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      When preparing the GParted Live 1.6.0 distribution, which is based on
      Debian unstable ("sid"), compiling GParted failed like this:
          $ make
          ...
          /usr/bin/msgfmt --desktop --template gparted.desktop.in -d ./po -o gparted.desktop
          chmod +x gparted
          /usr/bin/msgfmt --xml --template org.gnome.gparted.policy.in -d ./po -o org.gnome.gparted.policy
          /usr/bin/msgfmt: cannot locate ITS rules for org.gnome.gparted.policy.in
          make[3]: *** [Makefile:1060: org.gnome.gparted.policy] Error 1
          make[3]: *** Waiting for unfinished jobs....
          make[3]: Leaving directory '/root/gparted/gparted-1.6.0-beta1'
          make[2]: *** [Makefile:618: all-recursive] Error 1
          make[2]: Leaving directory '/root/gparted/gparted-1.6.0-beta1'
          make[1]: *** [Makefile:452: all] Error 2
          make[1]: Leaving directory '/root/gparted/gparted-1.6.0-beta1'
          dh_auto_build: error: make -j16 returned exit code 2
          make: *** [debian/rules:9: build] Err...
      16c2533a
  9. Feb 10, 2024
  10. Feb 08, 2024
    • Mike Fleetwood's avatar
      Remove final namespace qualifiers from use of GParted's own enums · 2a8ec0e4
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      ... because it is not necessary and clutters the code.
      2a8ec0e4
    • Mike Fleetwood's avatar
      Remove optional desktop filemanager dependency from README · adca4d40
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      ... now Attempt Data Rescue has been removed and GParted no longer has
      code to show "file:/tmp/gparted-roview-XXXXXX" URIs.  Missed in earlier
      commit:
          8ce9074a
          Remove Attempt Data Rescue and use of gpart (!118)
      adca4d40
    • Mike Fleetwood's avatar
      Rename Makefile.am variables to APPSTREAM*/appstream* (#241) · 3b5cc486
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      As the AppStream 1.0 [1] specification no longer describes them as
      appdata files, but instead as metainfo files, rename the Makefile.am
      variables for consistency with the name of the standard.
      
      [1] AppStream 1.0
          https://www.freedesktop.org/software/appstream/docs/index.html
      
      Closes #241 - Move appstream metadata out of legacy path
      3b5cc486
    • Mike Fleetwood's avatar
      Install AppStream file into ${datadir}/metainfo (#241) · 6da0d61f
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      AppData files always were a subset of the AppStream specification
      [1][2].  AppStream 0.12 specification [3] onwards says the metainfo
      files will be found when placed in /usr/share/metainfo/ *AND* that
      /usr/share/appdata/ is a legacy location *AND* a future release of
      AppStream will likely drop support for it [4].
      
      Debian 10, RHEL 7 and Ubuntu 18.04 LTS distributions all have the
      /usr/share/metainfo/ directory containing application .appdata.xml and
      .metainfo.xml files.  Ubuntu 16.04 LTS does not have the directory
      despite the AppStream specification [3] claiming it does.  As old
      supported distributions do have the directory, unconditionally update
      this.
      
      For reference are these commits in projects GNOME System Monitor [4] and
      Evince [5] from 2017 making the same change.
      
      [1] AppData Specification [circa 2016]
          https://web.archive.org/web/20160903181519/https://people.freedesktop.org/~hughsient/appdata/
          "Rather than create a new schema from scratch, we'll be using a
          subset of the AppStream metadata proposal.
      
          Applications wishing to have long descriptions, screenshots and
          other useful things are required to ship one or more files in
          /usr/share/appdata/%{id}.appdata.xml.
          "
      [2] AppStream 0.4, 2.2 AppData XML files [circa 2013]
          https://web.archive.org/web/20131204004054/http://www.freedesktop.org/software/appstream/docs/sect-AppStream-Metadata-AppData.html
      [3] AppStream 0.12, 2.1.2 Filesystem locations [circa 2020]
          https://web.archive.org/web/20200615042130/https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#spec-component-location
          "2.1.2 Filesystem locations
      
          Upstream projects can ship one or more metainfo files in
          /usr/share/metainfo/%{id}.metainfo.xml, where id is a unique
          identifier of this specific component.
      
          (>) Note
          Component metadata of type desktop-application as described in
          Section 2.2, "Desktop Applications" can be installed with an
          .appdata.xml extension as well for historical reasons.  AppStream
          implementations will read the XML files as long as they end up in
          the right location on the filesystem.
      
          (!) Important: Legacy Path
          AppStream tools scan the /usr/share/appdata/ path for legacy
          compatibility as well.  It should not be used anymore by new
          software though, even on older Linux distributions (like RHEL 7 and
          Ubuntu 16.04 LTS) the metainfo path is well supported.  Support for
          the legacy path will likely be dropped completely with a future
          AppStream 1.0 release.
          "
      [4] [GNOME System Monitor] Install appdata to the new location
          (bgo#790146)
          https://gitlab.gnome.org/GNOME/gnome-system-monitor/-/commit/43dc0577712a6cd0979e4d85ec5196d507bd6e80
      [5] [Evince] build: Install appstream metadata to non-deprecated
          location
          https://gitlab.gnome.org/GNOME/evince/-/commit/8cae24ea48deafc85265ce42adecb55aa2b57a6f
      
      Closes #241 - Move appstream metadata out of legacy path
      6da0d61f
  11. Feb 07, 2024
  12. Jan 30, 2024
  13. Jan 26, 2024
  14. Jan 20, 2024
  15. Dec 28, 2023
  16. Nov 30, 2023
  17. Oct 29, 2023
    • Mike Fleetwood's avatar
      Refactor xfs::set_used_sectors() into if fail return early pattern (!119) · 5a6b8afc
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Closes !119 -  Tidy-ups for file system interface classes
      5a6b8afc
    • Mike Fleetwood's avatar
      Refactor reiserfs::set_used_sectors() into if fail return early pattern (!119) · a6038282
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Closes !119 -  Tidy-ups for file system interface classes
      a6038282
    • Mike Fleetwood's avatar
      Refactor reiser4::set_used_sectors() into if fail return early pattern (!119) · 1f72c5f0
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Closes !119 -  Tidy-ups for file system interface classes
      1f72c5f0
    • Mike Fleetwood's avatar
      Refactor nilfs2::set_used_sectors() into if fail return early pattern (!119) · 9364923d
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Closes !119 -  Tidy-ups for file system interface classes
      9364923d
    • Mike Fleetwood's avatar
      Refactor ext2::set_used_sectors() into if fail return early (!119) · e565215a
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      ... code pattern.  This is to make the code easier to understand by not
      having to remember if condition context for indented code over longer
      distances.  This has been done before.  Here are just 2 examples:
      
      [1] 75bda733
          Refactor run_blkid_load_cache() into if fail return early (#131)
      [2] 407e0ac6
          Refactor fat16::read_label() into if fail return early pattern (!104)
      
      Closes !119 -  Tidy-ups for file system interface classes
      e565215a
    • Mike Fleetwood's avatar
      Remove now unused T, N & S FileSystem member variables (!119) · 5eef9049
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Now those member variables are unused remove them.
      
      Closes !119 -  Tidy-ups for file system interface classes
      5eef9049
    • Mike Fleetwood's avatar
      Stop using member variables T, N & S in xfs class (!119) · 9c6ea645
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Restructure the variable parsing code into "if leading text found then
      scan the number" pattern.
      
      Closes !119 -  Tidy-ups for file system interface classes
      9c6ea645
    • Mike Fleetwood's avatar
      Stop using member variables T, N & S in reiserfs class (!119) · 43a17ecd
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Restructure the variable parsing code into "if leading text found then
      scan the number" pattern.
      
      Anchor leading text matches to the start of a new line in the output.
      
      Closes !119 -  Tidy-ups for file system interface classes
      43a17ecd
    • Mike Fleetwood's avatar
      Stop using member variables T, N & S in reiser4 class (!119) · 334448d2
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Restructure the variable parsing code into "if leading text found then
      scan the number" pattern.
      
      Closes !119 -  Tidy-ups for file system interface classes
      334448d2
    • Mike Fleetwood's avatar
      Stop using member variables T, N & S in nilfs2 class (!119) · eadb18a9
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      And restructure the variable parsing code into "if leading text found
      then scan the number" pattern.
      
      Anchor leading text matches to the start of a new line in the output.
      
      Closes !119 -  Tidy-ups for file system interface classes
      eadb18a9
    • Mike Fleetwood's avatar
      Stop using member variables T & N in linux_swap, luks & lvm2_pv classes (!119) · c7faeeee
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Closes !119 -  Tidy-ups for file system interface classes
      c7faeeee
    • Mike Fleetwood's avatar
      Stop using member variables T, N & S in ext2 class (!119) · ef3e1d1c
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      FileSystem member variables T, N & S are being used like local variables
      in many of the file system specific set_used_sectors() methods.  They
      are only used within each set_used_sectors() call and not used to
      represent persistent information of a FileSystem interface class or to
      pass information between separate methods.  Therefore stop using them
      and replace them with local variables instead.
      
      This block of code finds a field in the output and scans the number:
          Glib::ustring::size_type index = output.find("Block count:");
          if (index >= output.length() ||
              sscanf(output.substr(index).c_str(), "Block count: %lld", &T) != 1)
                  T = -1;
      The if statement says "if leading text is not found or scanning the
      number fails then assign -1".  A sequence of two negatives leading to
      assigning an error value is hard to understand.  Instead this an
      equivalent block from btrfs::set_used_sectors():
          long long total_bytes = -1;
          Glib::ustring::size_type index = output.find("\ntotal_bytes");
          if (index < output.length())
                  sscanf(output.substr(index).c_str(), "\ntotal_bytes %lld", &total_bytes);
      This assigns a default error value and the if statement says "if leading
      text found then scan the number".  Much simpler to understand.
      Therefore change the code around to use this same pattern.
      
      Anchor the leading text matches to the start of a new line in the
      output where possible.  Just because it's what some of the other file
      system's set_used_sectors() methods do (btrfs, reiser4 and xfs) and it
      seems like more robust text matching.
      
      Closes !119 -  Tidy-ups for file system interface classes
      ef3e1d1c
    • Mike Fleetwood's avatar
      Stop using floating point calculation in most FS set_used_sectors() methods (!119) · 92dfbac0
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Replace floating point calculation to convert size and space figures
      from file system block sized units to sectors with an integer
      calculation.  Do this for the same reasons discussed in commit "Stop
      using floating point calculations in FS resize() methods" earlier in
      this patchset.  This will limit the largest file system that GParted can
      read the usage of to 8 EiB - 1 bytes.
      
      There is still a floating point calculation in btrfs::set_used_sectors()
      which is being left because that is apportioning used space figure
      between multiple devices.
      
      Closes !119 -  Tidy-ups for file system interface classes
      92dfbac0
    • Mike Fleetwood's avatar
      Reorder construction of ext2/3/4 resize command (!119) · 10e9f143
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      So that it is similar to other calls to execute_command() and for grep
      friendliness.
      
      Closes !119 -  Tidy-ups for file system interface classes
      10e9f143
    • Mike Fleetwood's avatar
      Reorder construction of nilfs2 resize command (!119) · 1d2a02b6
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      Pass string literal containing the nilfs2 resize command to
      execute_command() rather than a string variable containing the same
      command.  This makes it the same as how most of the other calls to
      execute_command() are written and it makes it more grep friendly.
      
      Before:
          $ grep execute_command src/nilfs2.cc
              if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
              if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
              return ! execute_command( "nilfs-tune -L " + Glib::shell_quote( partition.get_filesystem_label() ) +
              if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
              return ! execute_command( "nilfs-tune -U " + Glib::shell_quote( Utils::generate_uuid() ) +
              return ! execute_command( "mkfs.nilfs2 -L " + Glib::shell_quote( new_partition.get_filesystem_label() ) +
                  success &= ! execute_command( "mount -v -t nilfs2 " + Glib::shell_quote( partition_new.get_path() ) +
      >>          success &= ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS );
                      success &= ! execute_command( "umount -v " + Glib::shell_quote( mount_point ),
      
      After:
          $ grep execute_command src/nilfs2.cc
              if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
              if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
              return ! execute_command( "nilfs-tune -L " + Glib::shell_quote( partition.get_filesystem_label() ) +
              if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
              return ! execute_command( "nilfs-tune -U " + Glib::shell_quote( Utils::generate_uuid() ) +
              return ! execute_command( "mkfs.nilfs2 -L " + Glib::shell_quote( new_partition.get_filesystem_label() ) +
                  success &= ! execute_command( "mount -v -t nilfs2 " + Glib::shell_quote( partition_new.get_path() ) +
      >>          success &= ! execute_command("nilfs-resize -v -y " + Glib::shell_quote(partition_new.get_path()) + size,
                      success &= ! execute_command( "umount -v " + Glib::shell_quote( mount_point ),
      
      Closes !119 -  Tidy-ups for file system interface classes
      1d2a02b6
    • Mike Fleetwood's avatar
      Stop using floating point calculations in FS resize() methods (!119) · f098ba1e
      Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
      A number of the file system specific resize() methods use floating point
      calculations to convert from the new partition size in sectors to the
      new file system size to be passed to the resize command in bytes or
      kibibytes.  This is bad because there could be rounding errors
      converting from integer to floating point, performing the calculation
      and converting back.  Replace with integer only multiply and divide
      calculations.  Integer division always truncates [1] which is exactly
      what is needed.  The largest integer will be the size of the file system
      in bytes held in a signed 64-bit long long, or Sector or Byte_Value
      typedef of the same type.  This will limit the size that a file system
      can be shrunk to, to 8 EiB - 1 byte.
      
      [1] C++ Arithmetic operators
          https://en.cppreference.com/w/cpp/language/operator_arithmetic
              "the algebraic quotient of integer division is truncated towards
              zero (fractional part is discarded)"
      
      Closes !119 -  Tidy-ups for file system interface classes
      f098ba1e
  18. Oct 22, 2023
  19. Oct 21, 2023
  20. Oct 19, 2023