chinhdo / txFileManager

.NET Transactional File Manager is a .NET Standard library that allows you to enlist file operations (file/folder copies, writes, deletes, appends, etc.) in distributed transactions.
MIT License
111 stars 13 forks source link

DeleteDirectoryOperation fails if temp directory is on a different device. #9

Closed chinhdo closed 4 years ago

chinhdo commented 4 years ago

Issue copied from CodePlex:

Firstly, thank you for TxFileMgr, it's amazing, and we're using it to do good things. Unfortunately, I managed to find a bit of a stumbling block recently when it comes to deleting directories.

The use of GetTmpFileName in DeleteDirectoryOperation.cs may end up with a path that's on a different device to the directory we're deleting. Consequently, the subsequent move operations fail, as directories cannot be moved across filesystem boundaries¹.

A good fix for this would be allowing a temp directory to be provided as an optional argument on TxFileMgr object creation, allowing the application to specify where temporary files should be housed. This should default to querying GetTmpFileName if no argument is provided.

Note that this bug only affects directories; as TxFileMgr copies rather than moves files, they are unaffected by filesystem boundaries.

Many thanks!

~ Paul

¹ At least on Linux. Hi Paul, Thanks!

Yes I think providing an option to set the Temp folder would work for this issue. I'll work on that... unless anyone else wants to take it. 2014-11-04 You are awesome. Thank you! :) 2014-11-04 Active

20 | Created 2014-11-03 | Updated 2017-12-14

chinhdo commented 4 years ago

Added support to specify your own temp path to get around this issue. Will be in 1.4.

binhphanduc commented 4 years ago

Hi a,

When will version 1.4 release, I'm really looking forward seeing that version on nuget ?

chinhdo commented 4 years ago

Hi @binhphanduc Just doing some more testing before I hit the button. Should take a few more days. Thanks

chinhdo commented 4 years ago

Hi @binhphanduc I just pushed 1.4 to NuGet. Thanks.

binhphanduc commented 4 years ago

thanks @chinhdo 💃