digitalmars.D.bugs - [Issue 7659] New: Reopen a file
- d-bugmail puremagic.com (37/37) Mar 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7659
- d-bugmail puremagic.com (12/12) Apr 21 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7659
- d-bugmail puremagic.com (34/34) Jun 21 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7659
- d-bugmail puremagic.com (30/30) Jun 21 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7659
- d-bugmail puremagic.com (30/30) Jun 21 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7659
- d-bugmail puremagic.com (9/9) Oct 04 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7659
- d-bugmail puremagic.com (10/10) Jan 07 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7659
http://d.puremagic.com/issues/show_bug.cgi?id=7659
Summary: Reopen a file
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody puremagic.com
ReportedBy: bioinfornatics gmail.com
09:09:05 PST ---
Dear,
when you want to reopen a closed file from a File instance the programm
segfault, i.e above code
_________________________________
import std.stdio;
import std.string;
void main(){
File f = File("text.txt", "w");
f.writeln( "blah" );
f.close();
if( ! f.isOpen )
f = File( f.name, "a+" );
f.writeln( "blah" );
f.close();
}
_________________________________
this tniny code segfault because when you close a file you can't after get the
filer name closed by using f.name
it will really helpfull to know at any moment the name from a File instance.
And method isOpen will get more sense to use. Because currently it said if
isopen or not but can't do many thing in more.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7659
SomeDude <lovelydear mailmetrash.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lovelydear mailmetrash.com
Depends on| |7022
PDT ---
The issue here is f.close() erases f.name, making it impossible to reopen f by
name; unless it's stored in a separate variable.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 21 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7659
1100110 <10equals2 gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |10equals2 gmail.com
I encountered this bug, or a similar variant.
I can't decide if I just won the lottery, or if it's reproducable...
I couldn't reproduce it, but I might be missing something important.
All of my attempts simply segfaulted.
This code immediately exits the function with no errors.
It returns the correct value even though I assume the return statement is never
reached since nothing around the return statement will execute.
try
{
auto f = File(fileName, "w");
f.write("success");
f.detach;
if(true)
{
f = File(fileName, "w");
if(f.readln() == "success")
success = true;
}
f.close;
///All of these cause it to immediately exit the current func.
f.name;
writeln(f.name);
f.name.remove;
}
The catch statement also catches no Exceptions.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 21 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7659
I encountered this bug, or a similar variant.
I can't decide if I just won the lottery, or if it's reproducable...
I couldn't reproduce it, but I might be missing something important.
All of my attempts simply segfaulted.
This code immediately exits the function with no errors.
It returns the correct value even though I assume the return statement is never
reached since nothing around the return statement will execute.
try
{
auto f = File(fileName, "w");
f.write("success");
f.detach;
if(true)
{
f = File(fileName, "r");
if(startsWith(f.readln(), "success"))
success = true;
}
f.close;
///All of these cause it to immediately exit the current func.
f.name;
writeln(f.name);
f.name.remove;
}
The catch statement also catches no Exceptions.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 21 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7659
I encountered this bug, or a similar variant.
I can't decide if I just won the lottery, or if it's reproducable...
I couldn't reproduce it, but I might be missing something important.
All of my attempts simply segfaulted.
This code immediately exits the function with no errors.
It returns the correct value even though I assume the return statement is never
reached since nothing around the return statement will execute.
try
{
auto f = File(fileName, "w");
f.write("success");
f.detach;
if(true)
{
f = File(fileName, "r");
if(startsWith(f.readln(), "success"))
success = true;
}
f.close;
///All of these cause it to immediately exit the current func.
f.name;
writeln(f.name);
f.name.remove;
}
The catch statement also catches no Exceptions.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 21 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7659 Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/84a6468ef86ebdb94d1430d95ea8d9964f8e85bf Fix Issue 7659 - std.stdio.File.close() erases file.name * also improve documentation a bit -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 04 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7659
Mike Wey <mike-wey planet.nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |mike-wey planet.nl
Resolution| |FIXED
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 07 2013









d-bugmail puremagic.com 