Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 444832 - grep -q `^declare -a` should use ' instead of `
Summary: grep -q `^declare -a` should use ' instead of `
Status: RESOLVED FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Devmanual (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Devmanual Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-26 18:55 UTC by Pacho Ramos
Modified: 2013-01-19 11:41 UTC (History)
2 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 Pacho Ramos gentoo-dev 2012-11-26 18:55:32 UTC
As seen in:
https://bugs.gentoo.org/show_bug.cgi?id=444740#c2

Looks like:
	# TODO: wrong "declare -a" command...
	elif declare -p DOCS | grep -q `^declare -a` ; then

should use " instead of `:
http://devmanual.gentoo.org/ebuild-writing/eapi/index.html

Reproducible: Always
Comment 1 Markos Chandras (RETIRED) gentoo-dev 2012-11-27 10:29:26 UTC
Hmm I am not sure what you're suggesting here. Could you elaborate a bit more please?
Comment 3 Ben de Groot (RETIRED) gentoo-dev 2012-11-28 08:25:32 UTC
in other words: single quotes instead of backticks
Comment 4 Ulrich Müller gentoo-dev 2012-11-28 08:49:56 UTC
Also there needs to be a blank after the -a, i.e.: grep -q ’^declare -a ’

That how PMS defines it, (see <http://dev.gentoo.org/~ulm/pms/5/pms.html#x1-1030009.1.9>) and how it's implemented in Portage.

(In reply to comment #2)
> And, after that, Arfrever reported another problem:
> https://bugs.gentoo.org/show_bug.cgi?id=444740#c4
> 
> that was solved with:
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/gnome2.eclass?r1=1.113&r2=1.114&view=patch

Hm, that makes the behaviour different from the EAPI 4 default. Is this intentional?
Comment 5 Arfrever Frehtes Taifersar Arahesis 2012-11-28 09:38:25 UTC
(In reply to comment #4)
> that makes the behaviour different from the EAPI 4 default. Is this
> intentional?

PMS clearly has a bug. It should be retroactively fixed.
Comment 6 Ulrich Müller gentoo-dev 2012-11-28 10:03:31 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > that makes the behaviour different from the EAPI 4 default. Is this
> > intentional?
> 
> PMS clearly has a bug.

That's not so clear.

Exporting arrays doesn't work, so why should an ebuild do this, in the first place? I'd say that any such code is buggy and should be fixed.

> It should be retroactively fixed.

If it's a bug in PMS (which I doubt) then we can fix it in EAPI 6.
Comment 7 Arfrever Frehtes Taifersar Arahesis 2012-11-28 10:11:50 UTC
(In reply to comment #6)

Other attributes can be set.

Example 1:

$ readonly DOCS=(a b c)
$ declare -p DOCS
declare -ar DOCS='([0]="a" [1]="b" [2]="c")'

Example 2:

$ declare -al DOCS
$ DOCS=(A B C)
$ declare -p DOCS
declare -al DOCS='([0]="a" [1]="b" [2]="c")'
Comment 8 Ulrich Müller gentoo-dev 2012-11-28 10:40:22 UTC
(In reply to comment #7)
> Other attributes can be set.
> 
> Example 1:
> 
> $ readonly DOCS=(a b c)
> $ declare -p DOCS
> declare -ar DOCS='([0]="a" [1]="b" [2]="c")'
> 
> Example 2:
> 
> $ declare -al DOCS
> $ DOCS=(A B C)
> $ declare -p DOCS
> declare -al DOCS='([0]="a" [1]="b" [2]="c")'

That's not allowed in ebuilds, because bash 3.2 didn't support it.
Comment 9 Pacho Ramos gentoo-dev 2012-11-28 19:07:54 UTC
Per previous comments looks like gnome team needs to be aware of this
Comment 10 Markos Chandras (RETIRED) gentoo-dev 2013-01-19 10:22:24 UTC
(In reply to comment #9)
> Per previous comments looks like gnome team needs to be aware of this

What's left to be done here?
Comment 11 Ulrich Müller gentoo-dev 2013-01-19 10:44:18 UTC
(In reply to comment #10)
> What's left to be done here?

PMS was updated to use double quotes for better readability:
<http://git.overlays.gentoo.org/gitweb/?p=proj/pms.git;a=commit;h=6cc58a14e8f8d9d7b98bc58c115cd58c2d898544>

I'd say that the devmanual should follow, i.e. in both ebuild-writing/eapi/text.xml and ebuild-writing/functions/src_install/text.xml:

-       # TODO: wrong "declare -a" command...
-       elif declare -p DOCS | grep -q `^declare -a` ; then
+       elif declare -p DOCS | grep -q "^declare -a " ; then
Comment 12 Markos Chandras (RETIRED) gentoo-dev 2013-01-19 10:53:18 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > What's left to be done here?
> 
> PMS was updated to use double quotes for better readability:
> <http://git.overlays.gentoo.org/gitweb/?p=proj/pms.git;a=commit;
> h=6cc58a14e8f8d9d7b98bc58c115cd58c2d898544>
> 
> I'd say that the devmanual should follow, i.e. in both
> ebuild-writing/eapi/text.xml and
> ebuild-writing/functions/src_install/text.xml:
> 
> -       # TODO: wrong "declare -a" command...
> -       elif declare -p DOCS | grep -q `^declare -a` ; then
> +       elif declare -p DOCS | grep -q "^declare -a " ; then

Thanks

done

http://git.overlays.gentoo.org/gitweb/?p=proj/devmanual.git;a=commit;h=078b93a501f114fc62d243460dd3235dfaa1f741
Comment 13 Markos Chandras (RETIRED) gentoo-dev 2013-01-19 10:54:54 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > (In reply to comment #10)
> > > What's left to be done here?
> > 
> > PMS was updated to use double quotes for better readability:
> > <http://git.overlays.gentoo.org/gitweb/?p=proj/pms.git;a=commit;
> > h=6cc58a14e8f8d9d7b98bc58c115cd58c2d898544>
> > 
> > I'd say that the devmanual should follow, i.e. in both
> > ebuild-writing/eapi/text.xml and
> > ebuild-writing/functions/src_install/text.xml:
> > 
> > -       # TODO: wrong "declare -a" command...
> > -       elif declare -p DOCS | grep -q `^declare -a` ; then
> > +       elif declare -p DOCS | grep -q "^declare -a " ; then
> 
> Thanks
> 
> done
> 
> http://git.overlays.gentoo.org/gitweb/?p=proj/devmanual.git;a=commit;
> h=078b93a501f114fc62d243460dd3235dfaa1f741

And this
http://git.overlays.gentoo.org/gitweb/?p=proj/devmanual.git;a=commit;h=5ea62b9c5ea777279301f799f08670634fd6c3cf

fixes the comment that I forgot to remove
Comment 14 Ulrich Müller gentoo-dev 2013-01-19 11:27:55 UTC
(In reply to comment #12)
> > -       # TODO: wrong "declare -a" command...
> > -       elif declare -p DOCS | grep -q `^declare -a` ; then
> > +       elif declare -p DOCS | grep -q "^declare -a " ; then
> 
> Thanks
> 
> done
> 
> http://git.overlays.gentoo.org/gitweb/?p=proj/devmanual.git;a=commit;
> h=078b93a501f114fc62d243460dd3235dfaa1f741

Still doesn't match PMS. Note the blank after the -a.
Comment 15 Markos Chandras (RETIRED) gentoo-dev 2013-01-19 11:41:32 UTC
(In reply to comment #14)
> (In reply to comment #12)
> > > -       # TODO: wrong "declare -a" command...
> > > -       elif declare -p DOCS | grep -q `^declare -a` ; then
> > > +       elif declare -p DOCS | grep -q "^declare -a " ; then
> > 
> > Thanks
> > 
> > done
> > 
> > http://git.overlays.gentoo.org/gitweb/?p=proj/devmanual.git;a=commit;
> > h=078b93a501f114fc62d243460dd3235dfaa1f741
> 
> Still doesn't match PMS. Note the blank after the -a.

Hopefully fixed now