Tags:
create new tag
view all tags

Question

Not quite sure where to post this because it's a bug, but there's no bug reporting area in Plugins.

TablePlugin has a bug in the getTypes() routine that causes columns with negative numbers to be sorted using cmp instead of <=>.

Where should I post this bug to? BugReport didn't seem to have an appropriate way to report this and SamHasler on irc noted that, while ProposedBugReports can deal with this, that people might prefer to have bugs for plugins kept in Plugins.

Environment

TWiki version: TWikiRelease01Sep2004
TWiki plugins: TablePlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Plugins

-- TravisCampbell - 10 Jan 2005

Answer

Here's a unified diff that fixes the sorting issue. It changes the regex used for finding a number so that if the number is immediately preceeded by a minus, then getTypes() returns the correct value.


--- /tmp/TablePlugin.pm Mon Jan 10 16:42:20 2005
+++ TablePlugin.pm      Mon Jan 10 16:13:46 2005
@@ -275,7 +275,7 @@
         $year += 1900 if( length( $year ) == 2 && $year > 80 );
         $year += 2000 if( length( $year ) == 2 );
         $date = timegm( 0, 0, 0, $1, $mon2num{$2}, $year - 1900 );
-    } elsif ( $text =~ /^\s*[0-9]+(\.[0-9]+)?\s*$/ ) {
+    } elsif ( $text =~ /^\s*-?[0-9]+(\.[0-9]+)?\s*$/ ) {
         $num = $text;
     }
 

Original table:

header
1
0
5
-2
-500
-499
-501
-10
100

Example of the table without the patch:

header
-10
-2
-499
-500
-501
0
1
100
5

Example of the table with the patch:

header
-501
-500
-499
-10
-2
0
1
5
100

-- TravisCampbell - 10 Jan 2005

Thanks Travis. We do not yet have a bug tracking app in the Plugins web. Defects are currently reported in the Dev topic. I added a link to this topic in TablePluginDev.

-- PeterThoeny - 11 Jan 2005

Ok, I'll keep this in mind. Thanks!

-- TravisCampbell - 18 Jan 2005

Thanks for providing this patch, Travis.

-- WillNorris - 18 Jan 2005

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2005-01-18 - WillNorris
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.