<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi!<br>
<br>
Thanks for reporting this! The following patch[1] should solve the
problem. I'll let it run through our tests and then merge it to
maint.<br>
<br>
Thanks,<br>
Lukas<br>
<br>
[1] diff --git a/lib/stdlib/src/filelib.erl
b/lib/stdlib/src/filelib.erl<br>
index d532cea..b098d4c 100644<br>
--- a/lib/stdlib/src/filelib.erl<br>
+++ b/lib/stdlib/src/filelib.erl<br>
@@ -264,6 +264,9 @@ ensure_dir(F) -><br>
case do_is_dir(Dir, file) of<br>
true -><br>
ok;<br>
+ false when Dir =:= F -><br>
+ %% Protect against infinite loop<br>
+ {error,einval};<br>
false -><br>
ensure_dir(Dir),<br>
case <a class="moz-txt-link-freetext" href="file:make_dir(Dir)">file:make_dir(Dir)</a> of<br>
<br>
<br>
On 23/05/12 06:07, <a class="moz-txt-link-abbreviated" href="mailto:luc.tanguay@bell.ca">luc.tanguay@bell.ca</a> wrote:
<blockquote
cite="mid:462990D3EDDFE5458F928506D32D40C95CD297A783@MBX05.bell.corp.bce.ca"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 11 (filtered
medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Trebuchet MS";
panose-1:2 11 6 3 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
h1
{margin-top:12.0pt;
margin-right:0in;
margin-bottom:3.0pt;
margin-left:.55in;
text-indent:-.3in;
page-break-after:avoid;
mso-list:l0 level1 lfo2;
font-size:16.0pt;
font-family:Arial;}
h2
{mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:.65in;
text-indent:-.4in;
mso-list:l0 level2 lfo2;
font-size:14.0pt;
font-family:Arial;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:#606420;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Arial;
color:windowtext;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:948437265;
mso-list-template-ids:2050801324;}
@list l0:level1
{mso-level-style-link:"Heading 1";
mso-level-text:%1;
mso-level-tab-stop:.55in;
mso-level-number-position:left;
margin-left:.55in;
text-indent:-.3in;}
@list l0:level2
{mso-level-style-link:"Heading 2";
mso-level-text:"%1\.%2";
mso-level-tab-stop:.65in;
mso-level-number-position:left;
margin-left:.65in;
text-indent:-.4in;}
@list l0:level3
{mso-level-text:"%1\.%2\.%3";
mso-level-tab-stop:.75in;
mso-level-number-position:left;
margin-left:.75in;
text-indent:-.5in;}
@list l0:level4
{mso-level-text:"%1\.%2\.%3\.%4";
mso-level-tab-stop:.85in;
mso-level-number-position:left;
margin-left:.85in;
text-indent:-.6in;}
@list l0:level5
{mso-level-text:"%1\.%2\.%3\.%4\.%5";
mso-level-tab-stop:.95in;
mso-level-number-position:left;
margin-left:.95in;
text-indent:-.7in;}
@list l0:level6
{mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6";
mso-level-tab-stop:1.05in;
mso-level-number-position:left;
margin-left:1.05in;
text-indent:-.8in;}
@list l0:level7
{mso-level-number-format:alpha-upper;
mso-level-text:"Appendix %7 ";
mso-level-tab-stop:.25in;
mso-level-number-position:left;
margin-left:.25in;
text-indent:0in;}
@list l0:level8
{mso-level-text:"%7\.%8";
mso-level-tab-stop:.5in;
mso-level-number-position:left;
margin-left:.25in;
text-indent:0in;
mso-ansi-font-size:14.0pt;
font-family:Arial;
mso-bidi-font-family:"Times New Roman";
mso-ansi-font-weight:bold;
mso-ansi-font-style:italic;}
@list l0:level9
{mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7\.%8\.%9";
mso-level-tab-stop:1.35in;
mso-level-number-position:left;
margin-left:1.35in;
text-indent:-1.1in;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
<div class="Section1">
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial">Hi.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial">I run R14B02 on Windows 2K8 64-bit
server (but Erlang is
32-bit). But looking at the latest code from GitHub, the
problem is still
there.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial">When I try
filelib:ensure_dir("Y:/toto.txt") and
the drive "Y:" does not exist, the VM crashes after a few
minutes
with eheap_alloc cannot allocate 1425410620 bytes of
memory (of type
"heap").<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial">Looking at the Erlang source code for
ensure_dir/1, and if
I'm reading it right, the endless loop is caused because
the dirname in
"Y:/toto.txt" is "Y:/" but "Y:/" is not
considered a directory by do_is_dir/2. So a recursive call
to ensure_dir/1 is
done, and.....<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial">Is it really a bug?<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial">Luc<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="3"><span
style="font-size:12.0pt;
font-family:Arial"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Trebuchet MS" size="2"><span
style="font-size:10.0pt;font-family:"Trebuchet
MS"" lang="FR-CA">---</span></font><span lang="FR-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><em><i><font face="Arial" size="1"><span
style="font-size:7.5pt;font-family:Arial" lang="FR-CA">Le
cri du nourrisson est le résultat
de plusieurs années de recherche dans le domaine du
signal d'alarme.</span></font></i></em><span
lang="FR-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><em><i><font face="Trebuchet MS" size="1"><span
style="font-size:7.5pt;font-family:"Trebuchet
MS"" lang="FR-CA">(Serge Bouchard)</span></font></i></em><span
lang="FR-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><font face="Trebuchet MS" size="2"><span
style="font-size:10.0pt;font-family:"Trebuchet
MS"" lang="FR-CA">---</span></font><span lang="FR-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:
10.0pt;font-family:Arial" lang="FR-CA">Luc Tanguay,
ing./P.Eng.<br>
</span></font><font face="Trebuchet MS" size="2"><span
style="font-size:10.0pt;font-family:"Trebuchet
MS"" lang="FR-CA">Bell Canada<br>
671 De La Gauchetière 4e étage,</span></font><span
lang="FR-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><font face="Trebuchet MS" size="2"><span
style="font-size:10.0pt;font-family:"Trebuchet
MS"" lang="FR-CA">Montréal H3B 2M8<br>
514-786-6440<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Trebuchet MS" size="2"><span
style="font-size:10.0pt;font-family:"Trebuchet
MS"" lang="FR-CA">cell: 514-229-7585</span></font><o:p></o:p></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span
style="font-size:
12.0pt"><o:p> </o:p></span></font></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-bugs mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-bugs">http://erlang.org/mailman/listinfo/erlang-bugs</a>
</pre>
</blockquote>
</body>
</html>