After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 754827 - Copy, reformat source and paste a logical partition thinks it's pasting the original file system
Copy, reformat source and paste a logical partition thinks it's pasting the o...
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
GIT HEAD
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2015-09-10 12:20 UTC by Mike Fleetwood
Modified: 2015-10-27 17:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Refresh copy source when it's a logical partition too (v1) (4.01 KB, patch)
2015-09-10 17:44 UTC, Mike Fleetwood
none Details | Review
Refresh copy source when it's a logical partition too (v2) (9.99 KB, patch)
2015-09-15 09:35 UTC, Mike Fleetwood
none Details | Review

Description Mike Fleetwood 2015-09-10 12:20:24 UTC
Start condition:
One partition with any file system type.

Steps:
1) Copy source partition;
2) Format source partition to a different file system type;
3) Paste the partition (into existing partition or unallocated space).

When the source partition is a primary partition GParted pastes the new
source file system type.  When the source partition is a logical
partition GParted shows pasting the original file system type.

This time apply each change, making the steps:
1) Copy source partition;
2) Format source partition to a different file system type and apply the
   operation;
3) Paste the partition (into existing partition or unallocated space)
   and apply the operation.

Now when the source partition is a logical partition and GParted applies
the paste operation it actually applies the original file system check
command file copy method (xfs dump restore, e2image vs block copy) to
the new source file system type.

This fault goes back at least as far as GParted 0.1.0.
Comment 1 Mike Fleetwood 2015-09-10 15:18:05 UTC
This same thing also applies if the source logical partition is resized,
re-labeled or re-UUIDed after being copied and before being pasted.
Reformatting is just the most obvious case.


Question:

Should modifying the copy partition source, before being pasted, stop it
being a copy source?  What is most obvious to the users; paste
reflecting changes made to the source or the source being deselected?


Investigation:

Nothing about this is mentioned in the GParted Manual.
It is an unusual case.

When deleting a partition which is a copy source the following
dialog is displayed:

  --- Delete /dev/sdb1 (ext4, 64.00 MiB) ------------------------------
  /?\ Are you sure you want to delete /dev/sdb1?
  \ / After deletion this partition is no longer available for copying.
                                                  [ Cancel ] [ Delete ]

Further, undoing the preview of the delete doesn't restore the partition
as a copy source.  It has to be selected again as the copy source.

Is there any other program which allows copy-paste and modification to
the source before the paste?
GNOME disks doesn't seem to have copy paste.
GNOME Files (formerly called Nautilus, official file manager for GNOME).

Testing GNOME Files:

Using CentOS 7 desktop with GNOME 3.8 desktop.

Test 1: Copy, modify, paste
    Create test file.  echo hello world > foo.txt
    Using GNOME Files ...
        Copy foo.txt
        Rename foo.txt to bar.txt
        Paste.
    Get file called "bar (copy).txt".
This is analogus to format, resize, relable or new UUID between copy
and paste in GParted.

Test 2: Copy, delete, paste
    Create test file again.  echo hello world > foo.txt
    Using GNOME Files ...
        Copy foo.txt
        Delete foo.txt
        Paste.
    Get error dialog: /!\ Error while copying, ... No such file or
    directory.
This is analogus to select for copy then delete partition in GParted.

There is precidence for modifying and deleting a copy selection before
pasting.


Decision:

Leave the GParted UI the same in terms of allowing copy, modify, paste
sequence to work as required.  Fix this to work as expected with logical
partitions as it does for primary partitions.
Comment 2 Mike Fleetwood 2015-09-10 17:44:28 UTC
Created attachment 311097 [details] [review]
Refresh copy source when it's a logical partition too (v1)

Hi Curtis,

Here's the patch for this.

Thanks,
Mike
Comment 3 Mike Fleetwood 2015-09-15 09:35:19 UTC
Created attachment 311339 [details] [review]
Refresh copy source when it's a logical partition too (v2)

Hi Curtis,

Here's patchset v2.  Differences from v1 are:
1) Minor update to the commit messages, correct bug number in the
   summary line;
2) Add two small tidyup patches.

Thanks,
Mike
Comment 4 Curtis Gedak 2015-09-22 17:31:26 UTC
Good work Mike finding this problem.  It is fairly obscure, but definitely showed different handling depending upon whether the source was a primary or a logical partition.

I tested and confirmed the problem with copy-reformat-paste when the source partition is a logical partition.

My testing using patch set v2 from comment #3 was successful and showed the same behaviour when the source partition was logical or primary.  I also tested the maximum number of primary partitions and this continued to work as expected (max of 4 with MSDOS partition table).

Patch set v2 from comment #3 has been committed to the git repository.

The relevant git commits can be viewed at the following links:

Refresh copy source when its a logical partition too (#754827)
https://git.gnome.org/browse/gparted/commit/?id=99e908f79b75cc69ad76c4db8548b3a3150cfc05

Localise counting of primary partitions into max_amount_prim_reached()
https://git.gnome.org/browse/gparted/commit/?id=3b5471516c569df865caf395f4da03b171817105

Localise checking for an extended partition into activate_new()
https://git.gnome.org/browse/gparted/commit/?id=26dc3dffa741fb3b8fc21620b6439bbaf7e16b67
Comment 5 Curtis Gedak 2015-10-27 17:03:17 UTC
This enhancement was included in the GParted 0.24.0 release on October 27, 2015.