rejetto forum
February 12, 2012, 01:11:24 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: delete on mount points  (Read 2267 times)
0 Members and 1 Guest are viewing this topic.
SamePaul
Experienced poster
***
Offline Offline

Posts: 70


View Profile
« on: April 22, 2009, 10:42:06 AM »

Deletion still doesn't work for me Sad
Do you want to publish sources and I will try to find solution? I looked at SF but CVS here is empty and sources are outdated.
Logged
SilentPliz
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1023


....... chut ! shh!


View Profile WWW
« Reply #1 on: April 22, 2009, 10:52:10 AM »


http://www.rejetto.com/forum/index.php?topic=5127.0
www.dovedove.it/hfs/hfs-last-beta-src.zip

 Wink
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #2 on: April 22, 2009, 10:54:56 AM »

Deletion still doesn't work for me Sad
Do you want to publish sources and I will try to find solution? I looked at SF but CVS here is empty and sources are outdated.

tell me how to reproduce the problem.

in this forum there's a single sticky topic, linking the current sources.
Logged
SamePaul
Experienced poster
***
Offline Offline

Posts: 70


View Profile
« Reply #3 on: April 22, 2009, 10:55:08 AM »

Yeah, I found it... Blond moment Smiley
but thank you anyway
Logged
SamePaul
Experienced poster
***
Offline Offline

Posts: 70


View Profile
« Reply #4 on: April 22, 2009, 11:10:20 AM »

Deletion still doesn't work for me Sad
Do you want to publish sources and I will try to find solution? I looked at SF but CVS here is empty and sources are outdated.

tell me how to reproduce the problem.
Exactly the same way as I described early
Lets say you have 2 volumes C: and D:
1. On C: make directory Store: md C:\Store
2. Find full volume name for D:. Just type "mountvol" at command line and it will list you all you have. Lets say you see something like
   \\?\Volume{761956c6-24d3-11dc-9f54-000102132ad0}\
    D:\
3. Mount D: at C:\Store "mountvol C:\Store \\?\Volume{761956c6-24d3-11dc-9f54-000102132ad0}\"
(this can be done via gui as well, but long to describe)
4. Now under C:\Store\ you have contents of D:\ . Create D:\TestUP\4del and put there some files.
5. Add C:\Store\TestUP\4del to HFS (important to add via C:\Store and not via D:)
6. Assign delete permission and put "No Download" flag. [upd: "No Download" flag is irrelevant]
7. In web browser navigate to folder /TestUP put checkmark on folder 4del and press "Delete selected". See that folder remains intact wih all the files inside.
8. Navigate inside this folder, select all files and press "Delete selected". All files are deleted. But folder cannot be deleted nevertheless.

Does this reproduce at your side?
« Last Edit: April 22, 2009, 11:42:43 AM by SamePaul » Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #5 on: April 22, 2009, 02:18:01 PM »

from step7 i understand that at step5 i had to add C:\store\testup and no C:\store\testup\4del, right?

anyway, i tested, and actually i saw the problem.
current junction support is limited to junctions that point to drive letters.
i see that mountvol cannot do this, but other utilities can (i use junction.exe by sysinternals).

the problem is that my functions moveToBin() and deleteFile() don't work with file paths like \\?\Volume...
do you have a solution to this?
Logged
rejetto forum
« Reply #5 on: April 22, 2009, 02:18:01 PM »

Do you like this software? Consider even $2
 Logged
SamePaul
Experienced poster
***
Offline Offline

Posts: 70


View Profile
« Reply #6 on: April 22, 2009, 03:14:33 PM »

Yes, that correct. "C:\store\testup"  should be added to HFS.

I see you try in code to dereference files, but it won't work in normal use case. On my machine all volumes are mounted under C:\ and no other letters are available.
Don't really understand why you need NtfsDeleteJunctionPoint or NtfsDeleteHardlinks. Didn't find them in sources so don't know what exactly the do.

Yes, I understood what was the problem. HFS tries to use SHFileOperation in order to "delete to Recycle bin" instead of plain deletion. But this function has a bug, because it uses internally file renaming instead of file moving. This bug exists in 2K and XP. On Vista I never tried, but on Win7 it was fixed.

Also I guess that "deleteFile" function doesn't really work on folders. That's why I can freely delete files (no matter  via mountmoint or via drive letter), but not folders. 

So my solution - recursive deleteFolder function which can delete non-empty folders. And option in HFS to not use Recycle Bin Smiley
Then moveFile would check this option and either fail with appropriate message to user (in case delete-to-bin was chosen) or wipe them out.  And this behavior would be "Known issue" that HFS can't handle because of OS limitations.


UPD:
Or even better - dont use moveToBin directly. Instead write function like smartDelete(filename) which will check "use Recycle Bin" option and perform moveFile or deleteFile/removeDir accordingly. And return True/False on success or failure.

And this way your procedure will look
Code:
    fs:=NIL;
    for i:=0 to data.postvars.count-1 do
      if sameText('selection', data.postvars.names[i]) then
        begin
        s:=decodeURL(getTill('#', data.postvars.valueFromIndex[i])); // omit #anchors
        s:=urlToPath(s, f);
        if s = '' then continue;

        if not smartDelete(s) then
            continue;
//            begin // this code can be used alternatively
//            reportErrorToUser();
//            continue;
//           end
        smartDelete(s+'.md5');
        smartDelete(s+COMMENT_FILE_EXT);
        addString(s, fs);
        end;
« Last Edit: April 22, 2009, 05:38:56 PM by SamePaul » Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #7 on: April 24, 2009, 06:14:52 AM »

Don't really understand why you need NtfsDeleteJunctionPoint or NtfsDeleteHardlinks. Didn't find them in sources so don't know what exactly the do.

you are right, i don't need them. by using the moveToBin() i never noticed that deleteFile() was not working for folders Smiley
you didn't find them because it's a 3rd party lib, called JCL.

i noticed that moveToBin() spends a lot of time on mounted things, and then fails, leaving action to other functions.
i guess i should try to know when moveToBin() is going to waste time, and skip it.

Quote
So my solution - recursive deleteFolder function which can delete non-empty folders. And option in HFS to not use Recycle Bin Smiley

the bin is used only for files deleted via web.
do we really need an option like that? what's the gain?
Logged
SamePaul
Experienced poster
***
Offline Offline

Posts: 70


View Profile
« Reply #8 on: April 24, 2009, 05:48:23 PM »


Quote
So my solution - recursive deleteFolder function which can delete non-empty folders. And option in HFS to not use Recycle Bin Smiley

the bin is used only for files deleted via web.
do we really need an option like that? what's the gain?

That's the point -  I talk only about files deleted via web.
The gain is because moveFile fails on folders via mountpoints. And deleteFile works only with files. That's why you need smartDelete which will optionally try SHFileOperation; then if it fails try check if it file or folder and then use deleteFile or removeDir. But I guess that removeDir is going to fail on non-empty folders, so you need recursively make it empty and then removeDir it.
Again, maybe removeDir can deal with non-empty folders on its own, so you don't need invent wheel. But in case it fails you have to implement recursive algorithm.

Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #9 on: April 25, 2009, 06:43:35 AM »

ah, i thought you suggested that function mainly to act according to the user option.
i already solved the way you said.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page January 28, 2012, 07:25:05 AM