www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 313] New: Fully qualified names bypass private imports

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313

           Summary: Fully qualified names bypass private imports
           Product: D
           Version: 0.165
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: deewiant gmail.com


In file a.d:
--
// explicit private no longer needed but added for clarity
private import std.stdio;
--
In file b.d:
--
import a;

void main() {
        // compiler correctly reports "undefined identifier writefln"
        writefln("foo");
        // works fine!
        std.stdio.writefln("foo");
}


-- 
Aug 27 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-08-27:
 http://d.puremagic.com/issues/show_bug.cgi?id=313
 In file a.d:
 --
 // explicit private no longer needed but added for clarity
 private import std.stdio;
 --
 In file b.d:
 --
 import a;

 void main() {
         // compiler correctly reports "undefined identifier writefln"
         writefln("foo");
         // works fine!
         std.stdio.writefln("foo");
 }
Added to DStress as ( http://dstress.kuehne.cn/addon/import_16_A.d ) ( http://dstress.kuehne.cn/addon/import_16_B.d ) http://dstress.kuehne.cn/nocompile/i/import_16_C.d http://dstress.kuehne.cn/nocompile/i/import_16_D.d http://dstress.kuehne.cn/nocompile/i/import_16_E.d http://dstress.kuehne.cn/nocompile/i/import_16_F.d http://dstress.kuehne.cn/nocompile/i/import_16_G.d http://dstress.kuehne.cn/nocompile/i/import_16_H.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFCI/kLK5blCcjpWoRAr2vAJ9kMpOBRbvfc+shCaY5sUmJ2A0mHgCgiqwL gXiXz3j5CfhZNxSD/od/FP4= =t6HB -----END PGP SIGNATURE-----
Sep 13 2006
prev sibling next sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


davidl 126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





d 1.0 does correctly report the error message


-- 
Jan 23 2007
parent Derek Parnell <derek psych.ward> writes:
On Tue, 23 Jan 2007 10:25:56 +0000 (UTC), d-bugmail puremagic.com wrote:

 http://d.puremagic.com/issues/show_bug.cgi?id=313
 
 
 davidl 126.com changed:
 
            What    |Removed                     |Added
 ----------------------------------------------------------------------------
              Status|NEW                         |RESOLVED
          Resolution|                            |FIXED
 
 
 
 

 d 1.0 does correctly report the error message
But is it correct? If the 'std.stdio' is private to "a.d" and not explicitly imported in to "b.d", then a statement in "b.d" should not be able to use anything in std.stdio, fully qualified or not. As far as I'm concerned, D is still broken in this regard as it allows one to get access to private identifiers just by fully qualifying them. I believe that private identifies are *private* and thus should not be be able to be accessed by another module. -- Derek Parnell
Jan 23 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |





David, did you test on Windows?

import_16_C, D, F - H still fail on Linux.


-- 
Jan 23 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tomas famolsen.dk





*** Bug 880 has been marked as a duplicate of this bug. ***


-- 
Jan 24 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313






Although this particular bug is fixed as of dmd 1.037 and 2.021, there are
other cases that fail.


-- 
Dec 07 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


Jesse Phillips <Jesse.K.Phillips+D gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Jesse.K.Phillips+D gmail.co
                   |                            |m
   Target Milestone|---                         |2.059


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


dawg dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dawg dawgfoto.de



---- a.d ----
import b;

void main()
{
    std.stdio.writefln("Hello");
}
---- b.d ----
public import std.ascii;
private import std.stdio;
-------------
dmd -c a

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 24 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


dawg dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |shro8822 vandals.uidaho.edu



*** Issue 1504 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


dawg dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ellery-newcomer utulsa.edu



*** Issue 5411 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


dawg dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kamm-removethis incasoftwar
                   |                            |e.de



*** Issue 6307 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313




*** Issue 7496 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313




The issue is that all imports are inserted into a global package tree.
Whenever you have access to a root package, e.g. by importing std.stdio,
one can access all 'std' children that were imported with a qualified name.

A possible fix would be to create one package tree (or a view of it) for each
module.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313




Commit pushed to master at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/efe7e94030d75780b16a4eaf45c8dfb789c899aa


Issue 313 & 314 - Add package access to rt.lifetime.BlkInfo

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/03a32d6fa4635543eed17b874fbf7a0330572ac3
Fix issue 313 & 314

https://github.com/D-Programming-Language/phobos/commit/b7216eae2e9ec73e186a713c59839fd91c9347b7


Fix issue 313 & 314 - Add necessary imports and fix FQN accesses

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



---
https://github.com/D-Programming-Language/dmd/pull/2256

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/2f21ff0c74cda26b4a5c039b358b8451c450fbde
More fix for issue 313 & 314

https://github.com/D-Programming-Language/phobos/commit/92e279a9733b0b4af53f141649368976652d9ce2


More fix for issue 313 & 314

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 25 2013