Results 1 to 8 of 8

Thread: cut & copy directories to usb without writing permissions will cause loosing data

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Location
    Italy
    Beans
    177
    Distro
    Lubuntu 12.04 Precise Pangolin

    cut & copy directories to usb without writing permissions will cause loosing data

    Hello,

    I'm using lubuntu maverick

    Code:
    l:~$ cat /etc/lsb-release
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=10.10
    DISTRIB_CODENAME=maverick
    DISTRIB_DESCRIPTION="Ubuntu 10.10"
    I created a folder on my Desktop and wanted to move it on an external usb drive.
    To do so I simply used the mouse, right clicked on it and selected "cut" and then I moved to the usb drive, right clicked on it and chose "paste"
    Unluckily I hadn't checked the permissions before doing this, and I received the alert of Permission denied because I hadn't write permissions.
    There wouldn't be any problem if my folder hasn't disappeared from my Desktop! and there's no way to found it! It's not on my trash and plus I changed rm in the past in order to trash files!
    So my folder has simply disappeared!
    cut&past hasn't trashed it nor removed it using rm.

    I did some tests:
    1. only folders disappear while using cut & paste to a usb folder without write permissions. Files are kept.

    2. folders disappear on cut & paste to a folder without write permission only if using an external usb destination folder. If you try to cut & paste them to a local folder without write permission (e.g /bin) they are correctly kept after the "permission denied" alert

    3. it doesn't matter what kind of usb drive you choose nor what kind of destination filesystem you are using: I tried on a usb drive with a reiserfs partition, and then I tried on a second drive with an ext4 partition. Same result! Folders are gone.

    Is this a (known) bug?
    Is there any way to prevent this behaviour in the future?
    Is there any chance to recover data lost in this way?

    Thanks
    Last edited by tanoloco; August 3rd, 2011 at 11:30 PM.

  2. #2
    Join Date
    Apr 2008
    Beans
    11,707

    Re: cut & copy directories to usb without writing permissions will cause loosing data

    You confuse me a bit. You said:

    I created a folder on my Desktop and wanted to move it on an external usb drive.
    To do so I simply used the mouse, right clicked on it and selected "cut" and then I moved to the usb drive, right clicked on it and chose "paste"


    But "cut" = delete

    I haven't used Lubuntu Maverick but I'm now playing with Lubuntu Oneiric testing and copy-n-paste seems to work fine (although it does seem slower than nautilus at times).

    But cut means CUT, it's not the same as copy!

    And nothing in your home folder should normally have special permissions.

  3. #3
    Join Date
    Feb 2010
    Location
    Italy
    Beans
    177
    Distro
    Lubuntu 12.04 Precise Pangolin

    Re: cut & copy directories to usb without writing permissions will cause loosing data

    sorry if I confused you, English is not my mother tongue, as you may notice.

    I know the difference between cut and copy .. and you are completely right: cut will delete the original item once pasted somewhere else! it just moves the item.

    My point is when you cut&paste a folder to a place on a usb drive on which you don't have write permission.

    I'm using pcmanfm on lubuntu 10.10, but I think there's no difference between ubuntu flavours for that: if you try to cut&paste an item to a folder on which you don't have write permissions (e.g /usr or wherever you can't write) you normally receive an alert with a message saying "permission denied" .. then everything is left as before, I mean the item is left on its original place.
    Cut will delete the original item only if moving ends successfully!

    What I'm saying is that I noticed that if I cut&paste a folder from whenever (for example my Desktop) to a folder on an external usb drive (for example /media/extusb/jack) on which I don't have write permission this will cause to get the usual message of "permission denied" but then the original folder is not kept as normally! it just disappears.

    It's not trashed not removed with rm .. it's simply gone.

    So I don't have the moved copy on the targer folder because I don't have write permission on it and of course lubuntu couldn't move it on there.
    But I don't have the original copy either because it's been deleted as it has been moved!

    This happens only with folders (files work fine) versus an external usb folder (local target folders work fine).
    When I say "it works fine" I mean that on cut&pasting I receive the message "permission denied" and the original copy is just kept because it couldn't be moved on a folder without write permission.

    Hope it's better explained.
    Last edited by tanoloco; August 4th, 2011 at 02:22 AM.

  4. #4
    Join Date
    May 2009
    Location
    North West England
    Beans
    2,676
    Distro
    Ubuntu Development Release

    Re: cut & copy directories to usb without writing permissions will cause loosing data

    Quote Originally Posted by tanoloco View Post
    .....
    My point is when you cut&paste a folder to a place on a usb drive on which you don't have write permission.....
    AFAIK, You are relying on the mv command, which is extremely unforgiving. I would really caution about using mv.

    Your file 'may' still be there but with prefix ~ so it would be worth doing a find for it.

    I can ask the author if he can trap such an error and put the backup switch in which should create a ~file. Such a thing would, realistically, be on the 'wish list' of functionality. Using cp and rm is a safer bet (always have a backup). It would be unlikely to hit before 12.04.

    Regards,

    Phill.

  5. #5
    Join Date
    Feb 2010
    Location
    Italy
    Beans
    177
    Distro
    Lubuntu 12.04 Precise Pangolin

    Re: cut & copy directories to usb without writing permissions will cause loosing data

    you're right: cp and rm is safer (same as copy&paste and then delete from the gui) than mv (same as cut&paste).
    But sometimes I prefer to use mv directly because it's quicker, in particular on large files or folder with huge content.

    Thanks for the advice anyway

    The file is not there with ~ because it wasn't a file, it was a folder.
    This strange behaviour only apply on folders.

    Anyhow I tried a find on the whole system with the folder name looking on hidden folders too, and nothing went out.

    The original folder is just removed.

    The strange fact is that this happens only on folders and only while cut&pasting on a usb destination folder without write permission.

    I don't think the author can solve it doing a ~ duplicate, BTW is it possible to create ~ copies of folders too? I think I never seen them.

    It looks like the operation over a usb folder return true as the item was correctly moved and so the program continues removing the original item, while it wasn't moved at all.

  6. #6
    Join Date
    Feb 2010
    Location
    Italy
    Beans
    177
    Distro
    Lubuntu 12.04 Precise Pangolin

    Re: cut & copy directories to usb without writing permissions will cause loosing data

    same beahaviour in lubuntu natty:

    Code:
    ~$ cat /etc/lsb-release
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=11.04
    DISTRIB_CODENAME=natty
    DISTRIB_DESCRIPTION="Ubuntu 11.04"
    1. create a folder on your desktop
    for example ~/Desktop/test/

    2. mount an external usb on which there's a folder on which you don't have write permission
    for example /media/usbdisk/nowrite/ root:root 755

    3. cut your folder on the desktop & paste it on the usb folder using the gui,
    which simply means:
    - right-click on the folder "test" on your desktop and choose "cut"
    - use your filemanager to go to the usb folder and right-click on it and choose "past"

    4. A window with the progress bar will open with an error on it saying "test: Error creating directory: permission denied"

    After that the original folder "test" on the desktop disappears, and of course there's no copy on the target folder.
    As a consequence you loose your original folder and all data in it!
    The original folder is removed while the error window is shown, the removing process doesn't wait for the user to press the close button on that window.
    So you don't have time enough the create a copy on the fly either while receiving this error, you just loose your data if you do this error.


    Using mv from the command line keeps the original:
    Code:
    $ cd ~/Desktop
    $ mv "test" "/media/usbdisk/nowrite/"
    mv: cannot create folder "/media/usbdisk/nowrite/test": Permission denied
    and the original folder "test" on your desktop is correctly kept.

    Thus it's not something about the mv command, but it's something about the gui interaction.
    This happens only with cutting folders and pasting them on a usb destination folder on which you don't have write permission.

    Is it a bug?
    Last edited by tanoloco; August 4th, 2011 at 10:46 AM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •