Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 662468 - sys-apps/portage: Improve detection of array variables using ${param@a}
Summary: sys-apps/portage: Improve detection of array variables using ${param@a}
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 683434
  Show dependency tree
 
Reported: 2018-07-30 13:02 UTC by konsolebox
Modified: 2019-07-28 21:40 UTC (History)
0 users

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


Attachments
patch for c352c8742ae24e09b2b513aa4f168b44e4eabeb9 (diff.txt,1.70 KB, text/plain)
2018-07-30 13:02 UTC, konsolebox
Details
Move and rename function as requested (diff2.txt,1.83 KB, text/plain)
2018-08-01 14:40 UTC, konsolebox
Details

Note You need to log in before you can comment on or make changes to this bug.
Description konsolebox 2018-07-30 13:02:15 UTC
Created attachment 541722 [details]
patch for c352c8742ae24e09b2b513aa4f168b44e4eabeb9

If current version of bash is >= 4.4, portage can use ${param@a} to get a variable's attributes, and then test the expansion directly. This avoids the subshell, unnecessary printing of values, and temporary internal IO.  See attachment.
Comment 1 Zac Medico gentoo-dev 2018-07-31 17:14:30 UTC
(In reply to konsolebox from comment #0)
> Created attachment 541722 [details]
> patch for c352c8742ae24e09b2b513aa4f168b44e4eabeb9

This is great, thanks!

I'd like to make a couple minor changes:

1) Move the function declaration to bin/isolated-functions.sh, which is where all the general purpose functions are.

2) Make the function start with triple underscore, since this namespace is reserved and automatically filtered from the saved environment as shown here:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=29f3837382babcac38d4c0e6498620b0dbc6df67
Comment 2 konsolebox 2018-08-01 14:40:59 UTC
Created attachment 541942 [details]
Move and rename function as requested
Comment 3 konsolebox 2019-05-19 12:04:39 UTC
@Zed Are you still gonna merge this?
Comment 4 Larry the Git Cow gentoo-dev 2019-05-20 00:35:21 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=5473a2695aa3fb3a7cdee889fe8c861fcb274277

commit 5473a2695aa3fb3a7cdee889fe8c861fcb274277
Author:     Ross Konsolebox <konsolebox@gmail.com>
AuthorDate: 2018-08-01 14:40:59 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-05-20 00:04:12 +0000

    Add bash ___is_indexed_array_var function (bug 662468)
    
    Closes: https://bugs.gentoo.org/662468
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 bin/isolated-functions.sh | 10 ++++++++++
 bin/phase-helpers.sh      |  8 ++++----
 2 files changed, 14 insertions(+), 4 deletions(-)
Comment 5 Zac Medico gentoo-dev 2019-05-20 00:36:48 UTC
Thanks!