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


You are not allowed to post comments on this tracker with your current authentication level.

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

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

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>
Project MemberIn charge of this item.
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>
Project 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:


I've attached a diff with both changes.

David Lobron <dlobron>


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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 7 latest changes.

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

    Back to the top

    Powered by Savane 3.3