Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora Development (http://www.linux-archive.org/fedora-development/)
-   -   Update =~ regexps in linuxrc.s390 for bash-4.1 (#558537). (http://www.linux-archive.org/fedora-development/315921-update-regexps-linuxrc-s390-bash-4-1-558537-a.html)

David Cantrell 01-27-2010 04:46 PM

Update =~ regexps in linuxrc.s390 for bash-4.1 (#558537).
 
GNU bash 4.1 changes the behavior of the =~ operator in the [[ command.
>From the bash FAQ:

E14) Why does quoting the pattern argument to the regular expression
matching conditional operator (=~) cause regexp matching to stop
working?

In versions of bash prior to bash-3.2, the effect of quoting the regular
expression argument to the [[ command's =~ operator was not specified.
The practical effect was that double-quoting the pattern argument
required backslashes to quote special pattern characters, which
interfered with the backslash processing performed by double-quoted word
expansion and was inconsistent with how the == shell pattern matching
operator treated quoted characters.

In bash-3.2, the shell was changed to internally quote characters in
single- and double-quoted string arguments to the =~ operator, which
suppresses the special meaning of the characters special to regular
expression processing (`.', `[', `', `(', `), `*', `+', `?', `{', `|',
`^', and `$') and forces them to be matched literally. This is
consistent with how the `==' pattern matching operator treats quoted
portions of its pattern argument.

Since the treatment of quoted string arguments was changed, several
issues have arisen, chief among them the problem of white space in
pattern arguments and the differing treatment of quoted strings between
bash-3.1 and bash-3.2. Both problems may be solved by using a shell
variable to hold the pattern. Since word splitting is not performed
when expanding shell variables in all operands of the [[ command, this
allows users to quote patterns as they wish when assigning the variable,
then expand the values to a single string that may contain whitespace.
The first problem may be solved by using backslashes or any other
quoting mechanism to escape the white space in the patterns.

Bash-4.0 introduces the concept of a `compatibility level', controlled
by several options to the `shopt' builtin. If the `compat31' option is
enabled, bash reverts to the bash-3.1 behavior with respect to quoting
the rhs of the =~ operator.
---
loader/linuxrc.s390 | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
index 7a6be69..9d04b9d 100644
--- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -688,7 +688,7 @@ function syntax_check_domainname() {
# - match against regex adopted from RFC1035,sec.2.3.1 or RFC1034,sec.3.5
# (Internationalized Domain Names in Applications (IDNA) [RFC4690]
# have to be entered after encoding by punycode [RFC3492])
- [[ "$1" =~ ^[[:alpha:]]([[:alnum:]-]{0,61}[[:alnum:]])?(.[[:alpha:]]([[:alnum:]-]{0,61}[[:alnum:]])?)*$ ]]
+ [[ "$1" =~ ^[[:alpha:]]([[:alnum:]-]{0,61}[[:alnum:]])?(.[[:alpha:]]([[:alnum:]-]{0,61}[[:alnum:]])?)*$ ]]
case $? in
0)
# string matched the pattern
@@ -1091,10 +1091,10 @@ function syntax_check_subchannels() {
# - make subchannel question dependent on NETTYPE (2 vs. 3 subchannels)
if [ "$NETTYPE" = "qeth" ]; then
# - match against regex, depending on qeth
- [[ "$SUBCHANNELS" =~ ^[[:xdigit:]]+.[0-3].[[:xdigit:]]{4},[[:xdigit:]]+.[0-3].[[:xdigit:]]{4},[[:xdigit:]]+.[0-3].[[:xdigit:]]{4}$ ]]
+ [[ "$SUBCHANNELS" =~ ^[[:xdigit:]]+.[0-3].[[:xdigit:]]{4},[[:xdigit:]]+.[0-3].[[:xdigit:]]{4},[[:xdigit:]]+.[0-3].[[:xdigit:]]{4}$ ]]
else
# - match against regex, depending on lcs/ctc
- [[ "$SUBCHANNELS" =~ ^[[:xdigit:]]+.[0-3].[[:xdigit:]]{4},[[:xdigit:]]+.[0-3].[[:xdigit:]]{4}$ ]]
+ [[ "$SUBCHANNELS" =~ ^[[:xdigit:]]+.[0-3].[[:xdigit:]]{4},[[:xdigit:]]+.[0-3].[[:xdigit:]]{4}$ ]]
fi
case $? in
0)
@@ -2418,7 +2418,7 @@ function parse_dasd() {
unset IFS
# parse: dev OR dev'-'dev
local lo=${range%%-*}
- [[ "$lo" =~ (^[[:xdigit:]]+.[0-3].[[:xdigit:]]{4}$)|(^[[:xdigit:]]{3,4}$) ]]
+ [[ "$lo" =~ (^[[:xdigit:]]+.[0-3].[[:xdigit:]]{4}$)|(^[[:xdigit:]]{3,4}$) ]]
case $? in
0) # string matched the pattern
lo=$(canonicalize_devno $lo) ;;
@@ -2434,7 +2434,7 @@ function parse_dasd() {
esac
if [ "${range//*-*/}" = "" ]; then
local hi=${range##*-}
- [[ "$hi" =~ (^[[:xdigit:]]+.[0-3].[[:xdigit:]]{4}$)|(^[[:xdigit:]]{3,4}$) ]]
+ [[ "$hi" =~ (^[[:xdigit:]]+.[0-3].[[:xdigit:]]{4}$)|(^[[:xdigit:]]{3,4}$) ]]
case $? in
0) # string matched the pattern
hi=$(canonicalize_devno $hi)
@@ -2595,7 +2595,7 @@ function syntax_check_fcp() {
continue
;;
esac
- [[ "$devno" =~ (^[[:xdigit:]]+.[0-3].[[:xdigit:]]{4}$)|(^[[:xdigit:]]{3,4}$) ]]
+ [[ "$devno" =~ (^[[:xdigit:]]+.[0-3].[[:xdigit:]]{4}$)|(^[[:xdigit:]]{3,4}$) ]]
case $? in
0) ;; # string matched the pattern
1) # string did not match the pattern
--
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 03:41 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.