Bug 809421 - VIP ID interpretation
VIP ID interpretation
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: ucarp (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Gwyn Ciesla
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-03 06:29 EDT by Alexander Boström
Modified: 2012-12-27 15:06 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-27 15:06:24 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alexander Boström 2012-04-03 06:29:19 EDT
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 10:31:39 EDT
Incompatible how, as in will change behaviour with existing conf files?
Comment 2 Alexander Boström 2012-04-03 11:08:34 EDT
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 11:25:26 EDT
Are you able to test?
Comment 4 Alexander Boström 2012-12-11 07:28:09 EST
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 10:07:10 EST
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 10:46:20 EST
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 15:28:29 EST
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 15:06:25 EST
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.