Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 224507 - eselect core.bash should not tamper with bash builtin functions
Summary: eselect core.bash should not tamper with bash builtin functions
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: eselect (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo eselect Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-01 17:46 UTC by Ulrich Müller
Modified: 2016-11-01 06:33 UTC (History)
2 users (show)

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


Attachments
Patch for eselect trunk (eselect.diff,968 bytes, patch)
2008-06-01 17:47 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Müller gentoo-dev 2008-06-01 17:46:05 UTC
core.bash redefines eval, which is a) unexpected and b) not its business (and it can be trivially circumvented so it is not effective).

If at all, such things belong into a style guide.
Comment 1 Ulrich Müller gentoo-dev 2008-06-01 17:47:51 UTC
Created attachment 155135 [details, diff]
Patch for eselect trunk

Trivial patch to fix this.
Comment 2 Ciaran McCreesh 2008-06-01 18:20:37 UTC
That was intentional. You can get eval back easily enough if you really need it, but you have to explicitly state that you know enough about bash to do so.
Comment 3 Ulrich Müller gentoo-dev 2008-06-01 18:32:18 UTC
> That was intentional.

Of course.

> You can get eval back easily enough if you really need it, but you have to
> explicitly state that you know enough about bash to do so.

It is bad style if an application needlessly redefines standard functions of the underlying language.

As said above, put it into a style guide in blinking red letters. But please leave the bash builtin functions alone.
Comment 4 Ciaran McCreesh 2008-06-01 18:36:14 UTC
eselect modules aren't bash. They're a domain specific language consisting of a large subset of bash plus various extras.
Comment 5 Sebastian Günther 2009-04-19 19:53:53 UTC
This behaviour has the price that, you can't simply source /etc/init.d/functions.sh, which would be the proper way to deal with all rc stuff: see the blocker.

Or should we ask openrc maintainers to change the eval statement?
Comment 6 Ulrich Müller gentoo-dev 2009-04-26 21:05:24 UTC
(In reply to comment #5)
> Or should we ask openrc maintainers to change the eval statement?

Not sure if that would be possible. OpenRC uses POSIX shell syntax only, and there are (for example) no arrays and no variable indirection. So "eval" comes in handy more often than with bash.
Comment 7 Ulrich Müller gentoo-dev 2009-04-29 13:56:01 UTC
(In reply to comment #2)
> You can get eval back easily enough if you really need it, but you have to
> explicitly state that you know enough about bash to do so.

I'm still not entirely convinced by this argument, but the example of bug 180966 shows that we can indeed live with things as they are.

Closing this bug for now.
Comment 8 Ulrich Müller gentoo-dev 2009-11-26 14:20:09 UTC
This was fixed some time ago, in eselect-1.2.5.
Comment 9 Ulrich Müller gentoo-dev 2016-11-01 06:33:52 UTC
commit 1b4e2608f7463d98270c0b709cffe09d1b5d2d86
Author: Ulrich Müller <ulm@gentoo.org>
Date:   Mon Oct 31 09:30:55 2016 +0100

    Disable eval again.
    
    * libs/core.bash.in (eval): Disable eval again, because the
    workaround for the rc module (sourcing functions.sh) is no longer
    needed. See also 2005-05-15 change by ciaranm.
    
    This partially reverts commit 76867bf1a47570cd9548100caed519252b5ced5a.