Hardy Release Notes should note upgrade to Bash 3.2 changes regex syntax

Bug #109931 reported by Robert
10
Affects Status Importance Assigned to Milestone
Ubuntu Website - OBSOLETE
Invalid
Undecided
Unassigned
bash (Ubuntu)
Invalid
Undecided
Unassigned
Nominated for Feisty by Robert
Nominated for Gutsy by Robert

Bug Description

Binary package hint: bash

The following regular expression should work in bash (and used to work in Edgy), but no longer does:

  if [[ "foo.tex" =~ '^(.*)\.tex$' ]]
  then
    file=${BASH_REMATCH[1]}
    echo "File is: $file"
  else
    echo "Not a TeX file"
  fi

It appears that regular expressions using the dot, star, carat and dollar-sign metacharacters no longer work.

Revision history for this message
Johnathon (kirrus) wrote :

The feisty move upgraded bash from Bash 3.1 to 3.2. Would this have had an effect on your script? (i.e. has the regex stuff been changed in the newer bash?)

Changed in bash:
status: Unconfirmed → Needs Info
Revision history for this message
Robert (robrwo) wrote :

Well, it looks like that did affect it, according to a
  http://en.wikipedia.org/wiki/Bash#In-process_regular_expressions

Basically, the single quotes surrounding the regex become part of the regex. So the above code becomes:

  if [[ "foo.tex" =~ ^(.*)\.tex$ ]]
    then
      file=${BASH_REMATCH[1]}
      echo "File is: $file"
    else
      echo "Not a TeX file"
  fi

That's a pretty significant change. A lot of scripts will be broken. More warning should have been given to users about this.

Revision history for this message
Robert (robrwo) wrote :

The release notes at http://www.ubuntu.com/getubuntu/releasenotes/704 do not mention anything about an upgrade to Bash 3.2. They should be amended to note this.

Revision history for this message
Johnathon (kirrus) wrote : Re: Feisty Release Notes should note upgrade to Bash 3.2 changes regex syntax

Confirming

Changed in bash:
status: Needs Info → Confirmed
Revision history for this message
Johnathon (kirrus) wrote :

Not needed on the bash lists, site issue only.

Changed in ubuntu-website:
status: Unconfirmed → Confirmed
Changed in bash:
status: Confirmed → Rejected
Revision history for this message
Robert (robrwo) wrote :

I do wonder if a version of Bash 3.1 should be included as an option in the distro. The change was unexpected and enough to hurt me at least one script that I wrote, and may be the cause of problems I've hard with an install script from a third party which kept insisting that I did not have prereqs installed which I did (it was paring the output of --version calls).

I suspect this is affecting a few people who run Ubuntu server. There should at least be an option for them to downgrade to an earlier version of bash to lessen the burden.

Revision history for this message
Johnathon (kirrus) wrote : Re: Feisty Release Notes should note upgrade to Bash 3.2 changes regex syntax

I would recommend adding a new bug. Mail me the number, and I'll confirm
it, we have been affected by a problem with the bash upgrade as well.
(Firehol is not able to work with bash 3.2. There is a sneaky
workaround, but it's not good.)

Revision history for this message
Robert (robrwo) wrote : Re: Feisty Release Notes should note upgrade to Bash 3.2 changes regex syntax

I've just added Bug #110407

Revision history for this message
Robert (robrwo) wrote :

This needs to be documented for the LTS release of Hardy. If Bus #110407 is acted on, then users will have an alternative.

Changed in ubuntu-website:
assignee: nobody → ubuntu-websites
Revision history for this message
Jamie (ubuntu-websites) wrote :

This should not have been assigned to me. I am not part of the programming project. It should be assigned to someone else.

Revision history for this message
Jamie (ubuntu-websites) wrote :

This shouldn't have been assigned to me. I am not related to this project.

Changed in ubuntu-website:
assignee: ubuntu-websites → robrwo
Johnathon (kirrus)
Changed in ubuntu-website:
assignee: robrwo → ubuntu-website
Revision history for this message
Robert (robrwo) wrote :

Is someone going to act on this? It shouldn't be too difficult to add a note to the website and release notes warning users about potential problems.

Revision history for this message
Johnathon (kirrus) wrote :

try emailing <email address hidden>, and point them at this bug.

Revision history for this message
Johnathon (kirrus) wrote :

Not a problem anymore - bashrc patched.

Changed in ubuntu-website:
assignee: ubuntu-website → nobody
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.