Commit graph

570 commits

Author SHA1 Message Date
Bastiaan Veelo
a2aa3d3590 Special case enforce against issue 19797, documentation. 2019-04-14 01:04:17 +02:00
The Dlang Bot
28fc0f4ef6
Merge pull request #6913 from CyberShadow/pull-20190318-181608
Fix Issue 19751 - std.stdio.File should not retry fclose after error
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-03-19 02:17:29 +01:00
Vladimir Panteleev
272b933748
Fix Issue 19751 - std.stdio.File should not retry fclose after error
C fclose is allowed to fail, and some libc implementations do cause it
to fail.

For example, reading on a file opened only for writing, or (in Wine's
MSVCRT implementation) writing on a file opened only for reading sets
an error flag, which then causes fclose to return EOF to signal an
error.

However, all descriptions of the function specify that "whether or not
the call succeeds, the stream shall be disassociated from the file"
and "after the call to fclose(), any use of stream results in
undefined behavior" (POSIX) or similar.

Currently, if File.close throws and is called again (e.g. in a
destructor), it will retry the fclose call. This is undefined behavior
as described above, and may potentially affect an unrelated file.

It also makes it overly difficult to "get rid" of a File instance
associated with a FILE with its error flag set - all attempts at
destroying it will fail and only be eventually retried.
2019-03-18 18:24:56 +00:00
Nathan Sashihara
6ffd4e7f28 Replace imports of core.sys.windows.windows to speed up compilation 2018-12-17 21:03:31 -05:00
The Dlang Bot
656798f2b3
Merge pull request #6717 from ibuclaw/bshedversion
[refactor] posix.mak: Enforce whitespace before opening parenthesis for version …
merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
2018-09-26 15:39:36 +02:00
Iain Buclaw
10847bcf1d std.stdio: Remove redundant enum declarations 2018-09-22 23:35:10 +02:00
Iain Buclaw
fd5facfe04 posix.mak: Enforce whitespace before opening parenthesis for version conditions 2018-09-22 16:57:24 +02:00
Walter Bright
33cceac7ac switch Digital Mars copyright to D Language Foundation 2018-09-05 13:49:46 -07:00
Basile Burg
db819575f1 Fix issue 11959 - Set private symbols declared in version(unittest) blocks 2018-08-26 10:22:11 +02:00
Jonathan M Davis
7e9a2615f2 Remove unnecessary conflicts in std.stdio.
fopen and popen wrap C functions that exist in druntime, and it's not
uncommon for folks to end up accidentally trying to use the private
functions in std.stdio instead of the ones from druntime - which then
tends to result in questions on D.Learn. There's no reason that either
of these private functions needs to be named the same as the C function
that it wraps. It just causes confusion when folks accidentally try to
use them instead of the C functions.

So, this changes them to _fopen and _popen so that there will be no such
conflict, and the error messages when folks try to call the C functions
but do so incorrectly will not mention std.stdio's internals.
2018-06-28 20:57:59 -06:00
Walter Bright
827dbbb6b1 stdio: add scope 2018-06-09 01:07:56 -07:00
Walter Bright
433d3182c8 all put() functions should have 'scope' parameters 2018-06-08 16:23:37 -07:00
Walter Bright
e8290737e3 LockingTextWriter() should leak its parameter 2018-06-08 02:38:31 -07:00
Sebastian Wilzbach
c324714fde Remove a few cases of underscore escaping 2018-06-04 13:05:01 +02:00
Bastiaan Veelo
e38fa7ddc9
Adapt to description of writef. 2018-05-21 11:57:20 +02:00
Bastiaan Veelo
cf246e1992
Correct documentation for std.stdio.write.
Remove errors in the description: It writes to stdout, not args[0] and it does not use std.conv.to.
Use similar description as std.stdio.File.write.
2018-05-21 11:37:19 +02:00
Martin Nowak
2d4fa13f30 Merge remote-tracking branch 'upstream/stable' into merge_stable 2018-05-02 01:06:55 +02:00
Diederik de Groot
7aa7a2d34e
Fix stdio File.open / resetFile / detach / refcount 2018-04-30 15:31:19 +02:00
aG0aep6G
b771e175d0 only decode when there's a highSurrogate 2018-04-24 07:45:21 +02:00
aG0aep6G
5fa8ba12e2 merge imports 2018-04-23 23:39:23 +02:00
aG0aep6G
bf1b4db8a3 only store the high surrogate, and use \0 to indicate its empty 2018-04-23 23:11:53 +02:00
aG0aep6G
2ab81bcbe7 add comment about the final throw 2018-04-23 23:03:02 +02:00
aG0aep6G
8611e450d8 destroy file_ before possibly throwing 2018-04-23 23:02:21 +02:00
aG0aep6G
d5cc4c5087 fix conversion from wchar to char in LockingTextWriter.put
Fixes the easier part of issue 18789.
2018-04-23 13:43:57 +02:00
Jack Stouffer
e14f89e170 Make references to input ranges a link to isInputRange 2018-04-08 16:19:57 -04:00
Jack Stouffer
db11ea1d25 Added note about thread safety 2018-04-06 08:49:59 -04:00
Jack Stouffer
9410ed02d3 Fix Issue 15768 - std.stdio.trustedStdout accesses __gshared data without synchronization 2018-04-03 09:01:47 -04:00
Sebastian Wilzbach
42894784dd Markdownify Phobos
$(D word) -> `word`
2018-04-02 22:32:47 +02:00
Jonathan Marler
2dd14c6445 Accomodate Enum init deprecation 2018-03-28 04:27:46 -06:00
Sebastian Wilzbach
87301eb1b5 Merge remote-tracking branch 'upstream/stable' into merge_stable 2018-03-25 18:23:14 +02:00
Sebastian Wilzbach
e8d7ec51d3 Fix brace style + typos 2018-03-24 11:31:17 +01:00
MetaLang
9660b9ad88
Fix typos for stderr and stdout doc 2018-03-24 04:06:55 -03:00
Sebastian Wilzbach
a502a4731f Fix Issue 18648 - Document the type of std.stdio.stdin and friends 2018-03-22 21:36:41 +01:00
Martin Nowak
03e2c4947f Merge remote-tracking branch 'upstream/stable' into merge_stable
# Conflicts:
#	changelog/std-file-readText.dd
#	changelog/std-parallelism-fold.dd
2018-03-02 21:32:43 +01:00
Steven Schveighoffer
f3ab08db0f
Fix minor ambiguity 2018-03-02 08:31:19 -05:00
Jack Stouffer
7a26c9505f Update lockingTextWriter docs 2018-03-02 08:18:28 -05:00
Radu Racariu
0641553468
Add uClibc definitions 2018-02-25 18:59:47 +02:00
Martin Nowak
09926f9837 Merge remote-tracking branch 'upstream/stable' into merge_stable 2018-02-23 21:37:12 +01:00
Jack Stouffer
663b5b9278 Revert addition of StdUnittest 2018-02-20 13:32:32 -05:00
Joakim
034988a0db Add needed changes to get all tests passing with Musl 2018-02-17 14:25:07 +05:30
Jack Stouffer
18cbb29b04 Replaced version(unittest) blocks with version(StdUnittest) 2018-02-01 19:56:59 -05:00
Jack Stouffer
88c1e4fb42 Modified the behavior of std.stdio.LockingTextWriter.put
* Removed code that caused wstrings to decode to dchars, and then encoded to chars
* Made the wchar path throw a UTF exception on bad data
* Improved the docs for LockingTextWriter
2018-01-30 13:08:37 -05:00
Sebastian Wilzbach
b9eaa3b1bd Fix Issue 18278 - writef documentation 404 error 2018-01-26 10:17:47 +01:00
Sebastian Wilzbach
7de3787876 Use static foreach in Phobos 2018-01-03 17:30:11 +01:00
Sebastian Wilzbach
d33e7df1ca Fix Issue 18153 - deprecate public symbols ByLine, ByRecord, ByChunk 2018-01-03 01:18:14 +01:00
Diederik de Groot
31ca73d58d
Port of phobos to DragonFlyBSD
Notes:
- FIXME message related to dragonfly malloc issue (issue reported on upstream dragonfly issue database)
2017-12-20 08:05:49 +01:00
Sebastian Wilzbach
df6365092a Replace body keyword with its replacement: do
Automatic replacement with

    sed -i "s/^\([ ]*\)body/\1do/" -i **/*.d
2017-11-20 15:33:52 +01:00
The Dlang Bot
99002c366b
Merge pull request #5792 from jercaianu/lockingtextwriter
Fix Issue 9661 - LockingTextWriter should increment file handle reference count
merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
2017-11-14 18:14:07 +01:00
Alexandru Jercaianu
0802e6adef Refactored if blocks 2017-11-14 17:55:37 +02:00
Alexandru Jercaianu
3910abb31b Renamed 'file' to 'file_' 2017-11-10 19:43:55 +02:00