bugGNUstep - Bugs: bug #52011, Remove incorrect init from...

Group
 
 

bug #52011: Remove incorrect init from NSDateFormatter, and fix call to udat_open

Submitter:  David Lobron <dlobron>
Submitted:  Wed 13 Sep 2017 04:54:48 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  stefanbidi
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 24 Oct 2017 10:21:13 PM UTC, comment #4: 

I just committed a patch for this bug. I did not add another test, however, because after looking at the tests we currently have, this bug should have been caught.

Stef <stefanbidi>
Group Member
Sat 21 Oct 2017 04:47:48 PM UTC, comment #3: 

Stefan, could you please comment on the state of this patch?

Fred Kiefer <FredKiefer>
Group Member
Wed 13 Sep 2017 05:14:28 PM UTC, comment #2: 

I've attached a test program that tests both bugs.  The first test passes when the extra code is removed from [NSDateFormatter init].  The second passes when the call to udat_open is fixed.

David Lobron <dlobron>
Wed 13 Sep 2017 04:57:54 PM UTC, comment #1: 

A few more data points:

- This bug revealed itself on my system only when I switched from libicu version 52 to version 55.

- The test cases I used that triggered the bug work correctly on Mac OSX.

- The proposed patch does not break the existing NSDateFormatter test in the gnustep-base test suite.

David Lobron <dlobron>
Wed 13 Sep 2017 04:54:48 PM UTC, original submission:  

In NSDateFormatter.m, the [NSDateFormatter init] method has code that is called when GS_USE_ICU is enabled.  When run on GNU/Linux (Ubuntu 3.13.0-113-generic), I found that it causes NSDateFormatter to have an invalid initial dateFormat.  On an Apple system, the initial dateFormat is nil, and that seems correct for Linux also.  I propose removing this code, which is at NSDateFormatter.m:113-148 in my source.

Also, the call to udat_open should pass UDAT_PATTERN for the first two arguments, if the pattern argument is unused.  That is the usage described in the doc, and I verified that this change fixes another bug I observed.  The doc is here:

http://www.icu-project.org/apiref/icu4c/udat_8h.html#a4261e9fd5382197c3d86a00211c48079

I've attached a diff with both changes.

David Lobron <dlobron>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #41797:  icutest.m added by dlobron (1KiB - application/octet-stream - Test program that passes with the proposed changes and libicu v55)
file #41796:  NSDateFormatter.m.patch added by dlobron (2KiB - application/octet-stream - Suggested patch file, based on 1.24.9)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by FredKiefer (Posted a comment)
  • -email is unavailable- added by stefanbidi (Updated the item)
  • -email is unavailable- added by dlobron (Submitted the item)
  • -email is unavailable- added by dlobron
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-10-24 stefanbidi StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2017-09-16 stefanbidi StatusNone Confirmed
        Assigned toNone stefanbidi
    2017-09-13 dlobron Attached File- Added icutest.m, #41797
    2017-09-13 dlobron Attached File- Added NSDateFormatter.m.patch, #41796
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code