Ubuntu Website Product

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

Reported by Robert on 2007-04-25
10
Affects Status Importance Assigned to Milestone
Ubuntu Website
Undecided
Unassigned
Nominated for Trunk by Robert
bash (Ubuntu)
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.

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
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.

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.

Confirming

Changed in bash:
status: Needs Info → Confirmed
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
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.

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.)

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
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.

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) on 2008-02-23
Changed in ubuntu-website:
assignee: robrwo → ubuntu-website
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.

Johnathon (kirrus) wrote :

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

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  Edit
Everyone can see this information.

Other bug subscribers