On 9/29/13 2:15 PM, Ivan Zhakov wrote: > Brane, do you remember reasons for creating temporary files in > .svn/tmp instead of target directory? Is it pre-wcng decision?
I haven't looked at how WCNG processes things in this respect but the old WC code would create temp files and then a log of things to do in order to allow it to do things in an atomic and recoverable way. One of the problems with putting temp files in the same directory is you have to make sure that your temp file names don't conflict with not only the existing files but also the files you're going to make later. Especially the user named files that have to exist in that directory. For example let's say a user has a file named svn-foobar in their checkout. Before processing that file we decide to write a temp file named svn-foobar. If you try to write that user defined filename before removing that temp file then you've got a problem. Another problem is putting the temp files in the same directory you're creating an intermediary state where content is available at filenames that don't match. There are a lot of people using WCs to manage files on web servers. They normally restrict .svn to prevent leakage. However, if we put the temp files in the same directory then they need to know to block the pattern of the temp file names otherwise their content might leak during that intermediate state. It also could be a script that would be run by the web server on the normal name but not on our temp name, thus leaking the source. By putting the files in a separate directory you don't have to worry about any of those issues. If there's another way to fix this I'd go that route since writing temp files in place opens presents additional problems. If we do decide to write temp files in place, it's not something I'd be inclined to change in a patch release, since we would need to educate users about this change.