Thread (11 messages) flat view 11 messages, 4 authors, 2016-06-15

Re: [PATCH] Add an option not to use link(src, dest) && unlink(src) when that is unreliable

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:46:39

On Donnerstag, 23. April 2009, Johannes Schindelin wrote:
It seems that accessing NTFS partitions with ufsd (at least on my EeePC)
has an unnerving bug: if you link() a file and unlink() it right away,
the target of the link() will have the correct size, but consist of NULs.

It seems as if the calls are simply not serialized correctly, as
single-stepping through the function move_temp_to_file() works flawlessly.

As ufsd is "Commertial software", I cannot fix it, and have to work
"commercial software"
around it in Git.

At the same time, it seems that this fixes msysGit issues 222 and 229 to
assume that Windows cannot handle link() && unlink().

Signed-off-by: Johannes Schindelin <redacted>
...
quoted hunk ↗ jump to hunk
@@ -2225,7 +2225,9 @@ int move_temp_to_file(const char *tmpfile, const char
*filename) {
 	int ret = 0;

-	if (link(tmpfile, filename))
+	if (unreliable_hardlinks)
+		ret = ~EEXIST;
It took me a while to see why we need a tilde here, but it's ok. Perhaps this 
helps others:

+		ret = ~EEXIST;	/* anything but EEXIST */

Nevertheless:

Acked-by: Johannes Sixt <redacted>
+	else if (link(tmpfile, filename))
 		ret = errno;
-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help