Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 355435 - app-shells/bash-4.2 breaks eselect (empty quotes in pattern with replacements)
Summary: app-shells/bash-4.2 breaks eselect (empty quotes in pattern with replacements)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo's Team for Core System packages
URL: http://lists.gnu.org/archive/html/bug...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-18 13:35 UTC by Philipp
Modified: 2011-02-19 17:20 UTC (History)
1 user (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 Philipp 2011-02-18 13:35:52 UTC
When I run "eselect opengl set 1" the script hangs.
The reason is that the function relative_name() in /usr/share/eselect/libs/path-manipulation.bash goes into an endless loop. The variable "c" is always empty and the variable "dir" never changes, thus the loop never terminates. With bash-4.1_p9 everything is fine.
Comment 1 Ulrich Müller gentoo-dev 2011-02-18 17:31:54 UTC
@base-system: Is the following an intended change of bash's behaviour, or is it a bug in bash-4.2?

With bash-4.1_p9:
   $ foo=abcdef
   $ bar=ab; echo ${foo##"${bar}"cd}
   ef
   $ bar=; echo ${foo##"${bar}"abcd}
   ef

With bash-4.2:
   $ foo=abcdef
   $ bar=ab; echo ${foo##"${bar}"cd}
   ef
   $ bar=; echo ${foo##"${bar}"abcd}
   abcdef

I.e., an empty string in double quotes doesn't match any more within parameter expansion. The following is strange, too:
   $ echo ${foo##""abcd}
   abcdef
   $ echo ${foo##''abcd}
   ef
Comment 2 SpanKY gentoo-dev 2011-02-18 17:43:28 UTC
i'll have to ask upstream, but it seems to me that double quotes make no sense.  there is no word splitting done in the middle of parameters like that which would require double quotes in any way.

so while i can pursue the issue upstream, i'd suggest you drop the useless quotes from eselect.
Comment 3 Ulrich Müller gentoo-dev 2011-02-18 17:49:39 UTC
(In reply to comment #2)
> so while i can pursue the issue upstream, i'd suggest you drop the useless
> quotes from eselect.

Sorry, but the quotes are not useless. They prevent globbing:
   $ foo=abcdef
   $ bar="a*c"
   $ echo ${foo##"${bar}"}
   abcdef
   $ echo ${foo##${bar}}
   def

If I remove the quotes, the relative_path function will break on filenames containing strange characters like *.
Comment 4 SpanKY gentoo-dev 2011-02-18 19:30:37 UTC
lies !  i didnt think of that thus it must not be true !

clearly the new behavior is wrong.  i'll follow up with upstream.
Comment 5 SpanKY gentoo-dev 2011-02-19 04:56:39 UTC
Chet posted a patch that seems to work for me.  but cvs.g.o is down so i cant commit it.  if you want to verify now, that'd be cool.
Comment 6 Ulrich Müller gentoo-dev 2011-02-19 07:18:52 UTC
(In reply to comment #5)
> Chet posted a patch that seems to work for me.  but cvs.g.o is down so i cant
> commit it.  if you want to verify now, that'd be cool.

Yes, that patch fixes the original problem.
Comment 7 SpanKY gentoo-dev 2011-02-19 17:20:32 UTC
thanks ... ive added that patch (among others) to cvs now