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




------- Comment #2 from davidl 126.com  2007-01-23 04:25 -------
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
 
 
 
 
 ------- Comment #2 from davidl 126.com  2007-01-23 04:25 -------
 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                       |




------- Comment #3 from thomas-dloop kuehne.cn  2007-01-23 07:44 -------
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




------- Comment #4 from thomas-dloop kuehne.cn  2007-01-24 02:09 -------
*** 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





------- Comment #5 from bugzilla digitalmars.com  2008-12-08 00:52 -------
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


--- Comment #6 from dawg dawgfoto.de 2012-01-24 04:16:25 PST ---
---- 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


--- Comment #7 from dawg dawgfoto.de 2012-02-16 18:46:11 PST ---
*** 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


--- Comment #8 from dawg dawgfoto.de 2012-02-16 19:09:37 PST ---
*** 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


--- Comment #9 from dawg dawgfoto.de 2012-02-16 19:28:48 PST ---
*** 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



--- Comment #10 from dawg dawgfoto.de 2012-02-16 19:34:55 PST ---
*** 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



--- Comment #11 from dawg dawgfoto.de 2012-02-16 19:39:43 PST ---
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



--- Comment #12 from github-bugzilla puremagic.com 2013-06-24 09:43:47 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/efe7e94030d75780b16a4eaf45c8dfb789c899aa
Merge pull request #532 from 9rnsr/fix_imports

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



--- Comment #13 from github-bugzilla puremagic.com 2013-06-24 18:48:40 PDT ---
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
Merge pull request #1368 from 9rnsr/fix_imports

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


--- Comment #14 from Kenji Hara <k.hara.pg gmail.com> 2013-06-24 23:04:14 PDT
---
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



--- Comment #15 from github-bugzilla puremagic.com 2013-06-25 01:52:36 PDT ---
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
Merge pull request #1372 from 9rnsr/fix_imports

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