Bug 809421 - VIP ID interpretation
Summary: VIP ID interpretation
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: ucarp
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Gwyn Ciesla
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-03 10:29 UTC by Alexander Boström
Modified: 2012-12-27 20:06 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-12-27 20:06:24 UTC


Attachments (Terms of Use)

Description Alexander Boström 2012-04-03 10:29:19 UTC
Description of problem:
Some VIP IDs fails to work.

Version-Release number of selected component (if applicable):
ucarp-1.5.2-1.el6.x86_64 (I'm testing the EPEL version but reporting to the Fedora product since it most likely applies to both.)

How reproducible:
Always.

Steps to Reproduce:
1. Install ucarp
2. Add a vip-008.conf
3. Start ucarp
  
Actual results:
Syslog report: [ERROR] You must supply a valid virtual host id

Expected results:
Working ucarp

Additional info:

It works with vip-007.conf, so I'm assuming the leading zeroes causes the number to be interpreted as octal. The easy fix would be to change the sed in the old sysv script and the new unit file helper script to "sed 's/^vip-0*\(.*\).conf/\1/'". This would be an incompatible change so it might not be possible to apply it current releases.

I suppose the reason why the sample vip-001.conf.example has the leading zeroes in the name is to suggest using those to make the directory listing sorting order match a numeric sort.

Comment 1 Gwyn Ciesla 2012-04-03 14:31:39 UTC
Incompatible how, as in will change behaviour with existing conf files?

Comment 2 Alexander Boström 2012-04-03 15:08:34 UTC
Yeah, (if my guess about octal is right then) if you have a file vip-010.conf currently that's actually VIP 8 (in decimal), but if the sed is changed to remove the leading zeroes it'll be VIP 10.

It's likely that the admin would update or upgrade one machine at a time, so this could cause some problems, but the current state is very confusing too.

Comment 3 Gwyn Ciesla 2012-04-03 15:25:26 UTC
Are you able to test?

Comment 4 Alexander Boström 2012-12-11 12:28:09 UTC
I can easily test on el6, but I could test on rawhide too if needed.

You could replace the line:

[ ${ID} ] || ID=`echo ${FILE} | sed 's/^vip-\(.*\).conf/\1/'`

with something like

if [[ -z "$ID" ]]; then
    ID="${FILE#vip-}"; ID="${ID%.conf}"
    IDnozero="${ID#0}"; IDnozero="${IDnozero#0}"
    if [[ "$ID" != "$IDnozero" ]]; then
	if [[ "${ID}" != "${ID/8}" || "${ID}" != "${ID/9}" ]]; then
	    # Has leading zeroes, is not a valid octal number.
	    # Remove leading zeroes, interpret it as decimal.
	    ID="$IDnozero"
	else
	    # Has leading zeroes, will be interpreted as octal.
	    ${LOGGER} "$FILE uses VIP ID" $(($ID)) "(octal $ID). To use $ID, add the line 'ID=$IDnozero' to $FILE or rename it to vip-$IDnozero.conf"
	fi
    fi
fi

It makes "008" mean decimal 8 instead of failing to start ucarp and warns on "010" (decimal 8) but lets it keep working.

Or do the incompatible change, which is simpler:

if [[ -z "$ID" ]]; then
    ID="${FILE#vip-}"; ID="${ID%.conf}"
    IDnozero="${ID#0}"; IDnozero="${IDnozero#0}"
    if [[ "$ID" != "$IDnozero" ]]; then
	if [[ "${ID}" = "${ID/8}" && "${ID}" = "${ID/9}" ]]; then
	    # Only warn if it is a valid octal number.
	    ${LOGGER} "$FILE uses VIP ID $IDnozero, in previous releases it may have been using" $(($ID)) "(octal $ID). Add the line 'ID=$((ID))' or 'ID=$IDnozero' to $FILE to avoid this warning."
	fi
	ID="$IDnozero"
    fi
fi

Comment 5 Gwyn Ciesla 2012-12-11 15:07:10 UTC
It doesn't apply to rawhide, I'll get an update out and it'll post a link here so you can test.

Comment 6 Fedora Update System 2012-12-11 15:46:20 UTC
ucarp-1.5.2-6.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/ucarp-1.5.2-6.el6

Comment 7 Fedora Update System 2012-12-11 20:28:29 UTC
Package ucarp-1.5.2-6.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing ucarp-1.5.2-6.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2012-13735/ucarp-1.5.2-6.el6
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2012-12-27 20:06:25 UTC
ucarp-1.5.2-6.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.