[Issue 14439] aa's keys, values, byKey, byValue not usable in @safe context

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14439

--- Comment #3 from Brad Roberts  ---
Not sure without looking at the implementation.  There's a lot of delicate
issues with lifetime of memory around the aa code.

--


[Issue 6138] Using dirEntries and chdir() can have unwanted results

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6138

Timothee Cour  changed:

   What|Removed |Added

 CC||timothee.co...@gmail.com

--- Comment #1 from Timothee Cour  ---
sounds like a bug (and one that could cause harm); 
why not have dirEntries call rel2abs ? the cost of this should be dwarfed by
system calls involved in dirEntries

--


[Issue 12391] DirEntries throws in foreach

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12391

--- Comment #5 from b2.t...@gmx.com ---
It seems to be by design. By hand it's possible to catch silently (e.g the
/srv/tftpboot folder on linux).

void scan(string root)
{
foreach(DirEntry entry; dirEntries(root, SpanMode.shallow))
{
try
{
writeln(entry.name);
if (entry.isDir) scan(entry.name);
}
catch (FileException fe) {continue;}
}
}

void main()
{
scan("/srv/");
}�

The error happens in "bool stepIn(string directory)�" (std.file) because the
folders are only put on a stack if they have a valid handle.

What could be done is to put them on the stack, always, and to test later, when
the stack is used if the handle of each item is valid, but then the control is
lost over when and why a problem happens. The iterator could even return a
DirEntry with a special flag (hasNoHandle) to denote that an error occured.

--


[Issue 12391] DirEntries throws in foreach

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12391

b2.t...@gmx.com changed:

   What|Removed |Added

 CC||chris...@schardt.info

--- Comment #4 from b2.t...@gmx.com ---
*** Issue 12513 has been marked as a duplicate of this issue. ***

--


[Issue 12513] std.file: dirEntries-range crashes, when hitting the system folder "System Volume Information"

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12513

b2.t...@gmx.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||b2.t...@gmx.com
 Resolution|--- |DUPLICATE
 OS|Windows |All

--- Comment #1 from b2.t...@gmx.com ---


*** This issue has been marked as a duplicate of issue 12391 ***

--


[Issue 14439] aa's keys, values, byKey, byValue not usable in @safe context

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14439

Chris Wright  changed:

   What|Removed |Added

 CC||dhase...@gmail.com

--- Comment #2 from Chris Wright  ---
I can simply make .keys and .values @trusted. Brad Roberts, is that acceptable?

These functions, being in druntime and applying to a widely used type, *should*
be reliably safe, and there shouldn't be anything special you need to do, no
precautions you need to take, to make them work safely.

--


[Issue 15179] Local imports cause outer imports to be excluded from overload set

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15179

Jesse Phillips  changed:

   What|Removed |Added

 CC||jesse.k.phillip...@gmail.co
   ||m

--- Comment #4 from Jesse Phillips  ---
(In reply to Walter Bright from comment #3)
> Probably not going to change the import lookup rules for this case.

Consider:

Module bar provides a function, foobar, that takes an int.

--
module bar;

bool foobar(int i) {
return true;
}
--

Module foo defines foobar to take a string.

--
module foo;

bool foobar(string m) {
return false;
}
--

Main calls bar.foobar and the assertion passes.

--
import bar;

void main() {
import foo;
assert(7.foobar);
}
--


Module foo is modified, it now defines a function, foobar, that takes an int.

--
module foo;

bool foobar(string m) {
return false;
}

/// Highjack call to bar.foobar
bool foobar(int m) {
return false;
}
--

The assertion will now fail in main due to function highjacking (no compiler
error):

$  rdmd test.d .\foo.d .\bar.d

core.exception.AssertError@test.d(5): Assertion failure

--


[Issue 11791] std.file.write failed to write huge files

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11791

b2.t...@gmx.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||b2.t...@gmx.com
 Resolution|--- |INVALID

--- Comment #6 from b2.t...@gmx.com ---
This is a known limitation of the write function.

see http://man7.org/linux/man-pages/man2/write.2.html

> on Linux, write() (and similar system calls) will transfer at most
> 0x7000 (2,147,479,552) bytes, returning the number of bytes
> actually transferred.  (This is true on both 32-bit and 64-bit
> systems.)

If you want to write more you must use a stream and write several buffers or
use append
--


[Issue 4166] Remove/deprecate std.string.chop

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4166

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |WONTFIX

--- Comment #4 from Andrei Alexandrescu  ---
chop and chomp are borrowed from Perl. If I'd do it over again, probably I
wouldn't add chop. At the same time, it's not terribly bad to have it there, so
deprecating it (and breaking code that occasionally uses it) seems unnecessary.
I'll close this, please reopen if I'm missing somtehing.

--


[Issue 14251] synchronized (mtx) doesn't check attributes (pure, const)

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14251

--- Comment #3 from Johan Engelen  ---
https://github.com/D-Programming-Language/dmd/pull/5564

--


[Issue 15809] Putting std.stdio.File.ByLine in a class causes Invalid memory operation upon exit

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15809

--- Comment #2 from ag0ae...@gmail.com ---
It boils down to this:


alias T = void*;
struct RefCounted
{
T* _store;

this(int dummy)
{
import core.memory : GC;
import core.stdc.stdlib : malloc;
_store = cast(T*)malloc(T.sizeof);
GC.addRange(&_store, T.sizeof);
}

~this()
{
assert(_store !is null);
import core.memory : GC;
GC.removeRange(&_store);
}
}

void main()
{
auto a = new RefCounted(0);
}


I don't know if there's anything wrong with this usage of
GC.addRange/GC.removeRange. If there is, this is a bug in
std.typecons.RefCounted. If there's not, it's a druntime/dmd issue.

--


[Issue 12897] std.json.toJSON doesn't translate unicode chars(>=0x80) to "\uXXXX"

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12897

b2.t...@gmx.com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||b2.t...@gmx.com
   Assignee|nob...@puremagic.com|b2.t...@gmx.com

--- Comment #3 from b2.t...@gmx.com ---
(In reply to egustc from comment #2)
> OK... I used Python but didn't decode first and got a problem. 
> 
> (In reply to Justin Whear from comment #1)
> > Looking at the spec
> > (http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf)
> > it appears that while strings _may_ encode characters using the escape
> > sequence, they are not _required_ to for any range of characters.  On the
> > face of it it seems that std.json is conformant and other languages are not.
> > Which parsers are unable to handle the raw UTF-8?

I propose a PR for this
(https://github.com/D-Programming-Language/phobos/pull/4106), but it was not
clear if you considered the problem as fixed or not.

Maybe it can even be closed without any modification. Let's see what people
say.

--


[Issue 14251] synchronized (mtx) doesn't check attributes (pure, const)

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14251

--- Comment #2 from Johan Engelen  ---
Synchronizing inside a const method is done in a deprecated method in
std.concurrency:

// @@@DEPRECATED_2016-03@@@
/++
$(RED Deprecated. isClosed can't be used with a const MessageBox.
  It will be removed in March 2016).
  +/
deprecated("isClosed can't be used with a const MessageBox")
final @property bool isClosed() const
{
synchronized( m_lock )
{
return m_closed;
}
}

--


[Issue 14251] synchronized (mtx) doesn't check attributes (pure, const)

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14251

Johan Engelen  changed:

   What|Removed |Added

 CC||jbc.enge...@gmail.com

--- Comment #1 from Johan Engelen  ---
Another effect of the missing semantic on _d_monitorenter/exit is that this
code compiles while I think it shouldn't (_d_monitorenter/exit will write to
klass.__monitor):

void foo() {
immutable Klass klass = new Klass;
synchronized (klass)
{
// do smth
}
}

--


[Issue 8682] Can't install DMD 2.060 on OS X 10.6.8

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8682

b2.t...@gmx.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||b2.t...@gmx.com
 Resolution|--- |FIXED

--


[Issue 15809] Putting std.stdio.File.ByLine in a class causes Invalid memory operation upon exit

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15809

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com

--- Comment #1 from ag0ae...@gmail.com ---
See also issue 15821. It's very similar which suggests that there's a
dmd/druntime bug beneath.

--


[Issue 15821] std.container.array.Array on the heap leads to InvalidMemoryOperationError

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15821

--- Comment #1 from ag0ae...@gmail.com ---
Issue 15809 looks very similar. This suggests that there's a dmd/druntime bug
beneath.

--


[Issue 15821] New: std.container.array.Array on the heap leads to InvalidMemoryOperationError

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15821

  Issue ID: 15821
   Summary: std.container.array.Array on the heap leads to
InvalidMemoryOperationError
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: regression
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: ag0ae...@gmail.com

Found by stunaep who posted to D.learn:
http://forum.dlang.org/post/tbaooqjjjsvgnlchj...@forum.dlang.org

Following code works with 2.070.2, but with git head dmd (ec7c6a9) it throws
"core.exception.InvalidMemoryOperationError@src/core/exception.d(693): Invalid
memory operation".


import std.container.array: Array;
void main()
{
new Array!int([1]);
}


--


[Issue 14318] Shared library stdio not loaded

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14318

--- Comment #3 from t...@mt2015.com ---
(In reply to toop from comment #2)
> I get error: privileged instruction at windowsHandleOpen line because there
> is no console. 
> 
> if (!AttachConsole(ATTACH_PARENT_PROCESS))
> {
> AllocConsole();
> }
> 
> After this there is still no output from writeln, writefln and printf in my
> app calling DLL and in DLL itself but writefln no longer fails with
> std.exception.ErrnoException (Bad file descriptor). flush() doesn't do
> anything but writeln/fln works after you call stdout.setvbuf(1, _IONBF);
> with any value above 0. printf doesn't work at all.

Sorry, it turned out to be my fault. dll_process_attach( hInstance, true );
call was missing in the dll and it caused all sorts of problems.

--


[Issue 8197] phobos\win32.mak missing -Idruntime\import

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8197

Dmitry Olshansky  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||dmitry.o...@gmail.com
 Resolution|--- |WONTFIX

--- Comment #4 from Dmitry Olshansky  ---
Loots of time passed with no clear test case. Won't fix?

--


[Issue 9045] Feature request for std.asscii => function isNewline

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9045

--- Comment #13 from Dmitry Olshansky  ---
(In reply to Nick Sabalausky from comment #10)
> While an 'isNewline(dchar)' func wouldn't work for reasons already
> discussed, what *would* work and be very helpful IMO, is something similar
> to the 'std.conv.parse(...)' functions. Ie, just like this, but properly
> templated, range-ified and UTF8/16-ified:

skipNewLine taking string by ref that would return a bool indicating if there
was a new line would indeed be useful.

--


[Issue 9045] Feature request for std.asscii => function isNewline

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9045

--- Comment #12 from Dmitry Olshansky  ---
(In reply to Nick Sabalausky from comment #10)
> While an 'isNewline(dchar)' func wouldn't work for reasons already
> discussed, what *would* work and be very helpful IMO, is something similar
> to the 'std.conv.parse(...)' functions. Ie, just like this, but properly
> templated, range-ified and UTF8/16-ified:

skipNewLine taking string by ref that would return a bool indicating if there
was a new line would indeed be useful.

--


[Issue 4532] std.string.format, std.stream methods, etc. still use the old doFormat instead of formattedWrite

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4532

Dmitry Olshansky  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||dmitry.o...@gmail.com
 Resolution|--- |WORKSFORME

--- Comment #19 from Dmitry Olshansky  ---
Was fixed quite sometime ago.

--


[Issue 4166] Remove/deprecate std.string.chop

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4166

Dmitry Olshansky  changed:

   What|Removed |Added

 CC||dmitry.o...@gmail.com

--- Comment #3 from Dmitry Olshansky  ---
5 years later I think it makes sense to just deprecate chop.

--


[Issue 15820] inconsistent error msg on assert between runtime and CT

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15820

Timothee Cour  changed:

   What|Removed |Added

 CC||timothee.co...@gmail.com

--- Comment #1 from Timothee Cour  ---
in other cases i got:

Error: ['b', 'a', 'r'][0..3]

--


[Issue 15820] New: inconsistent error msg on assert between runtime and CT

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15820

  Issue ID: 15820
   Summary: inconsistent error msg on assert between runtime and
CT
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: timothee.co...@gmail.com

//dmd -unittest -main -run bug_D20160322T000349.d
unittest{
  enum temp="bar";
  enum b=fun(temp); // err msg:Error: "bar"[0..3]
  //auto b=fun(temp);// err msg:bar
}

int fun(string a){
  assert(a=="foo", a);
  return 0;
}

--


[Issue 15819] private import std.array inside class prevents calling instance.array(), giving contradicting error

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15819

Timothee Cour  changed:

   What|Removed |Added

Summary|array(x) is ok but not  |private import std.array
   |x.array, giving |inside class prevents
   |contradicting error |calling instance.array(),
   ||giving contradicting error

--


[Issue 15819] array(x) is ok but not x.array, giving contradicting error

2016-03-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15819

--- Comment #2 from Timothee Cour  ---
reduced case:

the issue goes away if we comment "private import std.array;"

module bugs.bug_D20160321T233851;
/+
dmd -unittest -main -run bugs/bug_D20160321T233851.d
+/

import std.traits : isIterable, isNarrowString;
import std.range : isInfinite,isInputRange;
import std.array;

unittest {
  EmitResult temp;
  alias Range = typeof(temp);
  static assert(isInputRange!Range);
  static assert(isIterable!Range && !isNarrowString!Range &&
!isInfinite!Range);
  // BUG:error: cannot resolve type for temp.array(Range)(Range r) if
(isIterable!Range && !isNarrowString!Range && !isInfinite!Range)
  static assert(!is(typeof(temp.array)));
  static assert(is(typeof(array(temp;
}

private struct EmitResult {
  // comment this make things "normal"
  private import std.array;

  @property bool empty() {
return true;
  }

  void popFront() {
  }

  @property int front() {
return 0;
  }

}

--