https://bugzilla.wikimedia.org/show_bug.cgi?id=34475

       Web browser: ---
             Bug #: 34475
           Summary: Incorrect sorting columns in IP/CIDR format
           Product: MediaWiki
           Version: 1.18.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: General/Unknown
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


Colums in the IP/CIDR format to not sort properly in class="wikitable sortable"
tables.

IPs sort correctly, (apparently using numeric sort, which is nice.)
{| class="wikitable sortable"
! A !! IP 
|-
| errata-prod || 25.71.30.0 
|-
| errata-test || 25.71.31.0 
|-
| Satellite || 25.71.32.0 
|-
| foobar || 25.23.33.0
|-
| AD3 || 25.71.33.0
|-
| AD3 FOO || 25.71.34.0
|-
| zfs || 192.168.151.0
|}

Upon sorting by IP, we get a table like this (Text Rendered here)
+-------------+---------------
! A           ! IP         ^
+-------------+---------------
| foobar      | 25.23.33.0
| errata-prod | 25.71.30.0
| errata-test | 25.71.31.0
| Satellite   | 25.71.32.0
| AD3         | 25.71.33.0
| AD3 FOO     | 25.71.34.0
| zfs         | 192.168.151.0


However when we add the CIDR mask to the IPs, the table does not sort
correctly.
{| class="wikitable sortable"
! A !! IP 
|-
| errata-prod || 25.71.30.0/24
|-
| errata-test || 25.71.31.0/24
|-
| Satellite || 25.71.32.0/24
|-
| foobar || 25.23.33.0/24
|-
| AD3 || 25.71.33.0/24
|-
| AD3 FOO || 25.71.34.0/24
|-
| zfs || 192.168.151.0/24
|}

Sorting by IP gives
+-------------+---------------
! A           ! IP          ^
+-------------+---------------
| errata-prod | 25.71.30.0/24
| errata-test | 25.71.31.0/24
| Satellite   | 25.71.32.0/24
| foobar      | 25.23.33.0/24
| AD3         | 25.71.33.0/24
| AD3 FOO     | 25.71.34.0/24
| zfs         | 192.168.151.0/24

Which is incorrect, 'foobar' is not where is should be. It appears to be sorted
by the third decimal octet which is confirmed by changing the foobar value to
'25.23.47.0/24'
Which gives the 'sorted' table
+-------------+-----------------
! A           ! IP            ^
+-------------+-----------------
| errata-prod | 25.71.30.0/24
| errata-test | 25.71.31.0/24
| Satellite   | 25.71.32.0/24
| AD3         | 25.71.33.0/24
| AD3 FOO     | 25.71.34.0/24
| foobar      | 25.23.47.0/24
| zfs         | 192.168.151.0/24

Changing the CIDR mask doesn't change the outcome

+-------------+-----------------
! A           ! IP            ^
+-------------+-----------------
| errata-prod | 25.71.30.0/16
| errata-test | 25.71.31.0/16
| Satellite   | 25.71.32.0/16
| AD3         | 25.71.33.0/16
| AD3 FOO     | 25.71.34.0/24
| foobar      | 25.23.47.0/16
| zfs         | 192.168.151.0/24


EXPECTED OUTCOME:
Table Sorted by IP/CIDR should output the rows in the same order as IP alone.
+-------------+-----------------
! A           ! IP            ^
+-------------+-----------------
| foobar      | 25.23.47.0/16
| errata-prod | 25.71.30.0/16
| errata-test | 25.71.31.0/16
| Satellite   | 25.71.32.0/16
| AD3         | 25.71.33.0/16
| AD3 FOO     | 25.71.34.0/24
| zfs         | 192.168.151.0/24

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to