[PATCH]change posix test for symlinks

Matt Mackall mpm at selenic.com
Mon Jul 29 15:13:41 CDT 2013


On Mon, 2013-07-29 at 06:05 +0000, DeathGorePain wrote:
> You go off attacking my code calling it "voodoo", critising me for a
> lack of explanation. Did you even read the stackoverflow post and my
> commit message?
> 
> >hg-checklink:change posix test for symlinks
> >
> >old:link to currentdir(hg root), if fail: leave artefacts
> >new:link to temporary file and clean up when method exits

Let me try again:

You're saying something like "my face swelled up when I ate M&Ms, when I
eat some tree bark it's better". It's great that you found a fix and
brought it to our attention, but unfortunately it's way too mysterious
to be useful to us without more work.

What we need to see is something like "my face swelled up when I ate
_peanut_ M&Ms _because I'm allergic to peanuts_, when I eat this tree
bark _that contains a chemical that counteracts allergic reactions_ it's
better".

Here, the fix is the same, only the explanation has changed. Voodoo vs
engineering is all about the specificity and testability of the
explanations.

Here, "sshfs" is not a sufficient explanation in the same way "M&Ms" are
not a sufficient explanation. In fact, sshfs works just fine with
symlinks with its built-in defaults[1], which I tested right after I got
your message. And the existing code is of course perfectly correct for
real POSIX filesystems.

Sshfs (a) with -o follow_symlinks (b) lying about creating symlinks and
(c) refusing to delete the kind of otherwise perfectly reasonable link
we were creating is the explanation. That's something we can understand,
document, diagnose, test, improve, and avoid regressing in the future.

None of the key facts (a) through (c) is on Stackoverflow or in your
commit message or in your comments, which is crucial for avoiding this
bug coming back when future hackers are tempted to cleanup this
mysterious code that's trying to delete symlinks that were never
created. In fact, your commit message and comments neglect to mention
'sshfs' at all(!).

(Normally, we walk people through the steps needed to fix up the various
problems in their submissions, but instead I got deep enough into
researching the underlying problem that it was easier to just show you
what the end result ought to look like.)


[1] But at least Macfusion screws up the defaults:
https://code.google.com/p/macfusion/issues/detail?id=284

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list