[PATCH] Purge crash on junction point

Mathieu Cantin mcantin at coveo.com
Wed Feb 19 16:43:13 CST 2014


>Does this issue only exist with purge?
Yes, I think. Our company has been using the fix for 1 or 2 weeks and I don't have others problems with junction points, but I always purge all repositories before pulling or updating (in the context of continuous integration).

>Is this really the only way os.listdir can get an OSError?
Yes, the only one other solution would be to call the win32api in order to know if the directory is a junction.

Mathieu


________________________________________
De : Matt Mackall <mpm at selenic.com>
Envoyé : 19 février 2014 17:16
À : Mathieu Cantin
Cc : mercurial-devel at selenic.com
Objet : Re: [PATCH] Purge crash on junction point

On Tue, 2014-02-18 at 23:08 +0000, Mathieu Cantin wrote:
> # HG changeset patch
> # User Mathieu Cantin <mcantin at coveo.com>
> # Date 1392764497 18000
> #      Tue Feb 18 18:01:37 2014 -0500
> # Node ID bf485635a586a487a732ba27e122531235062da7
> # Parent  0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd
> purge: delete invalid junction point
>
> When you have 2 folders linked to each other by a junction point. For exemple
> "A" is a folder and "B" is a junction point to "A". "A" is deleted, then
> os.listdir throws an error on "B" because the target of "B" doesn't exist
> anymore.

Does this issue only exist with purge?

> +    def hasfilesindir(path):
> +        try:
> +            return len(os.listdir(path)) > 0
> +        except OSError:
> +            # It's a junction point with an invalid target

Is this really the only way os.listdir can get an OSError?

--
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list