Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 362753 - app-eselect/eselect-gnat: removal (was: gnat.eselect contains code in global scope)
Summary: app-eselect/eselect-gnat: removal (was: gnat.eselect contains code in global ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Deadline: 2019-04-12
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL: http://www.gentoo.org/proj/en/eselect...
Whiteboard:
Keywords: NeedPatch, PMASKED
Depends on:
Blocks:
 
Reported: 2011-04-09 18:02 UTC by Ulrich Müller
Modified: 2019-04-13 06:57 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Müller gentoo-dev 2011-04-09 18:02:38 UTC
gnat.eselect contains global scope code:

   . /usr/share/gnat/lib/gnat-common.bash

This is not a good idea because it will slow down commands like "eselect help" (which will source your module). See eselect's dev-guide at URL for details.

Please remove the global scope code from the module, e.g., move it into the appropriate do_* actions functions.
Comment 1 George Shapovalov (RETIRED) gentoo-dev 2011-05-23 14:43:32 UTC
gnat-common.bash provides bunch of function definitions, so nothing is really executed (and eselect gnat help is as fast as any other help - I checked).

Removing this external reference is not feasible, as gnat-common keeps functions shared between the eselect module and eclass governing Ada libs. Putting this "somewhere inside" will cause code duplication and will (not just "may", but definitely "will", in time) lead to bugs which even I may have hard time to trace and somebody who might inherit this down the road will have no chance of understanding at all. 

If you are interested, please see
http://www.gentoo.org/proj/en/prog_lang/ada/dev_reference.xml
for details. Unfortunately incomplete, but should give an idea of organization of the thing. And no, it is not possible to refactor the code to "keep it in one place" as this requires cooperation of eselect tool - switching the libs, and eclasses - governing the compiler and lib installation. I did try to minimizse the overlap, but, for the moment, this is as tidy as it gets..
Comment 2 George Shapovalov (RETIRED) gentoo-dev 2011-05-23 14:44:36 UTC
gnat-common.bash provides bunch of function definitions, so nothing is really executed (and eselect gnat help is as fast as any other help - I checked).

Removing this external reference is not feasible, as gnat-common keeps functions shared between the eselect module and eclass governing Ada libs. Putting this "somewhere inside" will cause code duplication and will (not just "may", but definitely "will", in time) lead to bugs which even I may have hard time to trace and somebody who might inherit this down the road will have no chance of understanding at all. 

If you are interested, please see
http://www.gentoo.org/proj/en/prog_lang/ada/dev_reference.xml
for details. Unfortunately incomplete, but should give an idea of organization of the thing. And no, it is not possible to refactor the code to "keep it in one place" as this requires cooperation of eselect tool - switching the libs, and eclasses - governing the compiler and lib installation. I did try to minimizse the overlap, but, for the moment, this is as tidy as it gets..
Comment 3 George Shapovalov (RETIRED) gentoo-dev 2011-05-23 14:46:03 UTC
Argh, sorry for the dupe. New interface somehow posts twice if I comment and change status of the bug at the same time?
Comment 4 George Shapovalov (RETIRED) gentoo-dev 2011-05-23 14:46:12 UTC
Argh, sorry for the dupe. New interface somehow posts twice if I comment and change status of the bug at the same time?
Comment 5 Ulrich Müller gentoo-dev 2011-05-23 15:09:38 UTC
(In reply to comment #1)
> gnat-common.bash provides bunch of function definitions, so nothing is really
> executed (and eselect gnat help is as fast as any other help - I checked).

That's not the point. The problem is that your module will also be sourced for global commands like "eselect help" or "eselect modules list".

> Removing this external reference is not feasible, as gnat-common keeps
> functions shared between the eselect module and eclass governing Ada libs.
> Putting this "somewhere inside" will cause code duplication and will (not just
> "may", but definitely "will", in time) lead to bugs which even I may have hard
> time to trace and somebody who might inherit this down the road will have no
> chance of understanding at all. 

Sorry, but I can't follow. The external file can be kept of course. I'm only asking not to source it in global scope, but to move that line to the beginning of each do_* function. (Yes, technically it is code duplication, but it's a single line only.) How could this possibly lead to bugs?
Comment 6 George Shapovalov (RETIRED) gentoo-dev 2011-05-23 15:25:07 UTC
> Sorry, but I can't follow. The external file can be kept of course. I'm only
> asking not to source it in global scope, but to move that line to the beginning
> of each do_* function. 
Ah, sorry, I misread you. I'll take a look into this.
Comment 7 Pacho Ramos gentoo-dev 2019-01-27 09:40:57 UTC
it seems we wouldn't need this now that we only have gnat-gpl I think
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-03-13 09:37:32 UTC
@ada, is this package good to go or does it have any use nowadays?
Comment 9 Tupone Alfredo gentoo-dev 2019-03-13 14:06:49 UTC
(In reply to Michał Górny from comment #8)
> @ada, is this package good to go or does it have any use nowadays?

No use
Comment 10 Larry the Git Cow gentoo-dev 2019-03-13 17:00:22 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eddee69d9b345f9dc2f0e935f67aec35b07645b2

commit eddee69d9b345f9dc2f0e935f67aec35b07645b2
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2019-03-13 16:59:20 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2019-03-13 16:59:37 +0000

    package.mask: Last rite app-eselect/eselect-gnat
    
    Bug: https://bugs.gentoo.org/362753
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 profiles/package.mask | 7 +++++++
 1 file changed, 7 insertions(+)
Comment 11 Larry the Git Cow gentoo-dev 2019-04-13 06:57:44 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6dedf439f0e24e69024fd23ee20450e5184b7696

commit 6dedf439f0e24e69024fd23ee20450e5184b7696
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2019-04-13 06:53:33 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2019-04-13 06:57:38 +0000

    app-eselect/eselect-gnat: Remove last-rited pkg
    
    Closes: https://bugs.gentoo.org/362753
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 .../eselect-gnat/eselect-gnat-1.3-r1.ebuild        |  35 ----
 .../eselect-gnat/eselect-gnat-1.4-r1.ebuild        |  38 ----
 app-eselect/eselect-gnat/eselect-gnat-1.4.ebuild   |  38 ----
 .../eselect-gnat/eselect-gnat-1.5-r1.ebuild        |  38 ----
 app-eselect/eselect-gnat/eselect-gnat-1.5.ebuild   |  38 ----
 .../eselect-gnat/files/gnat-common-1.3-r1.bash     | 222 --------------------
 .../eselect-gnat/files/gnat-common-1.4-r1.bash     | 225 --------------------
 .../eselect-gnat/files/gnat-common-1.5.bash        | 225 --------------------
 app-eselect/eselect-gnat/files/gnat.eselect-1.3    | 206 ------------------
 app-eselect/eselect-gnat/files/gnat.eselect-1.4    | 229 ---------------------
 app-eselect/eselect-gnat/files/gnat.eselect-1.5    | 225 --------------------
 app-eselect/eselect-gnat/metadata.xml              |   6 -
 profiles/package.mask                              |   7 -
 profiles/updates/1Q-2015                           |   1 -
 14 files changed, 1533 deletions(-)