Hello,
I and my associate came across an inconsistency in advisory name
generation rule while trying to cloning errata in rhn-satellite. And I
found that spacewalk also has this inconsistency between the following
codes.
a. ErrataFactory.createClone in
java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java
b. PublishErrataHelper.cloneErrataFast in
java/code/src/com/redhat/rhn/frontend/action/channel/manage/PublishErrataHelper.java
c. find_next_advisory in web/modules/rhn/RHN/DB/ErrataEditor.pm
The rule in a and b (both are in java) looks the same but c (perl) is
completely different from them.
a and b: CLSA-2008:0580 -> CLSA-2008:0580-1, CLSA-2008:0580-2, ...
c: CLSA-2008:0580 -> CMSA-2008:0580, CNSA-2008:0580, ...,
RISA-2008:0580, ... ZZSA-2008:0580, AAASA-2008:0580, ...
Here is an experimental fix for this issue to change c's rule, not
tested in actual. (i'm not a perl monger so that it even might have
errors and not work).
web/modules/rhn/RHN/DB/ErrataEditor.pm | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/web/modules/rhn/RHN/DB/ErrataEditor.pm
b/web/modules/rhn/RHN/DB/ErrataEditor.pm
index d19d2b0..9710557 100644
--- a/web/modules/rhn/RHN/DB/ErrataEditor.pm
+++ b/web/modules/rhn/RHN/DB/ErrataEditor.pm
@@ -307,13 +307,16 @@ sub find_next_advisory {
substr($adv, 0, 2) = 'CL';
substr($adv_name, 0, 2) = 'CL';
- while (advisory_exists($adv)) {
- substr($adv, 0, 2)++;
+ my $suffix = '';
+ my $i = 1;
+ while (advisory_exists($adv) || advisory_name_exists($adv_name)) {
+ $suffix = sprintf("-%u", $i++);
}
-
- while (advisory_name_exists($adv_name)) {
- substr($adv_name, 0, 2)++;
+ if ($suffix) {
+ $adv = $adv . $suffix;
+ $adv_name = $adv_name . $suffix;
}
+
return ($adv, $adv_name);
}
I've not opened a new bugzilla ticket for this yet but let me know
please if needed.
Thanks,
Satoru SATOH
_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel