Thread overview | ||||||
---|---|---|---|---|---|---|
|
January 24, 2013 [Issue 9381] New: package access can be abused and worked around | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9381 Summary: package access can be abused and worked around Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: andrej.mitrovich@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-23 18:05:26 PST --- /a/m.d: module a.m; package void foo() { } /user/a/workaround.d: module a.workaround; import a.m; auto foo() { return a.m.foo(); // free access! } /user/main.d: module main; import a.workaround; void main() { foo(); } $ rdmd user/main.d No compile errors! Even though user/a/workaround is *not* part of the library defined in the 'a' folder, it has free access to all package 'a' modules. Package should probably be checked on a folder level and not just on a module declaration level to make it useful. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 24, 2013 [Issue 9381] package access can be abused and worked around | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=9381 --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-23 18:07:47 PST --- (In reply to comment #0) > Package should probably be checked on a folder level and not just on a module declaration level to make it useful. Although if a library writer has e.g. 'foo/bar' package split around multiple directories and is using import switches, then this would break his code. So this could end up being a stale-mate, unless we re-design access modifiers altogether (a DIP was already called for by Walter). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 24, 2013 [Issue 9381] package access can be abused and worked around | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=9381 Oleg Kuporosov <Oleg.Kuporosov@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Oleg.Kuporosov@gmail.com --- Comment #2 from Oleg Kuporosov <Oleg.Kuporosov@gmail.com> 2013-01-24 03:47:44 PST --- Isn't a dup of http://d.puremagic.com/issues/show_bug.cgi?id=143 ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 24, 2013 [Issue 9381] package access can be abused and worked around | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=9381 --- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-24 06:39:03 PST --- (In reply to comment #2) > Isn't a dup of http://d.puremagic.com/issues/show_bug.cgi?id=143 ? No, that's related to package not working on variables. It works on functions, but as the sample shows it can be easily worked around. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation