[swift-corelibs-dev] Query on init methods in Data.swift

2016-08-02 Thread Simon Evans via swift-corelibs-dev
Hi

I was looking at Data.swift and noticed that 2 of the init methods
were different in corelibs-foundation v swift stdlib

https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/Data.swift
 has

public init?(capacity: Int)
public init?(count: Int)

https://github.com/apple/swift/blob/master/stdlib/public/SDK/Foundation/Data.swift
 has

public init(capacity: Int)
public init(count: Int)


Which are the correct method signatures? I was just doing a PR to fix
init?(count:) not zeroing the data and I wanted to make sure I had this
correct as well

Thanks
Simon
___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


Re: [swift-corelibs-dev] Query on init methods in Data.swift

2016-08-09 Thread Simon Evans via swift-corelibs-dev
Hi Tony,

Thats good to know, I have actually done a fix to convert them both to 
non-optional, I will create a PR once the jenkins CI is working again and my 
PR#501 is merged.

Simon


> On 8 Aug 2016, at 18:05, Tony Parker <anthony.par...@apple.com> wrote:
> 
> Hi Simon,
> 
> The correct one is the non-optional version. We changed it after some 
> discussion about if it made sense for Data to attempt to return nil here, 
> when there are so many ways for memory allocation to fail without returning 
> an optional.
> 
> We’re working on updating the swift-corelibs-foundation API to match the 
> overlay over the next few weeks.
> 
> - Tony
> 
>> On Aug 2, 2016, at 9:27 AM, Simon Evans via swift-corelibs-dev 
>> <swift-corelibs-dev@swift.org> wrote:
>> 
>> Hi
>> 
>> I was looking at Data.swift and noticed that 2 of the init methods
>> were different in corelibs-foundation v swift stdlib
>> 
>> https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/Data.swift
>>  has
>> 
>> public init?(capacity: Int)
>> public init?(count: Int)
>> 
>> https://github.com/apple/swift/blob/master/stdlib/public/SDK/Foundation/Data.swift
>>  has
>> 
>> public init(capacity: Int)
>> public init(count: Int)
>> 
>> 
>> Which are the correct method signatures? I was just doing a PR to fix
>> init?(count:) not zeroing the data and I wanted to make sure I had this
>> correct as well
>> 
>> Thanks
>> Simon
>> ___
>> swift-corelibs-dev mailing list
>> swift-corelibs-dev@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
> 

___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


Re: [swift-corelibs-dev] TimeZone database

2017-07-06 Thread Simon Evans via swift-corelibs-dev
Looks like timezone files are in the ‘tzdata’ package. Maybe it got uninstalled 
or was never installed as part of the base. An ‘apt-get install tzdata’ might 
fix it.

Simon

> On 6 Jul 2017, at 20:20, Youming Lin via swift-corelibs-dev 
>  wrote:
> 
> That's odd. Maybe my ubuntu:16.04 image is outdated or something, but here 
> are my outputs:
> 
> ylin@youming-mbpr:~/Swift/Kitura-Markdown$ docker run -it --rm ubuntu:16.04 
> find /usr -name zone.tab
> ylin@youming-mbpr:~/Swift/Kitura-Markdown$ docker run -it --rm ubuntu:14.04 
> find /usr -name zone.tab
> /usr/share/zoneinfo/zone.tab
> 
> The file is found in ubuntu:14.04 but not in ubuntu:16.04.
> 
> Here are my images:
> 
> ylin@youming-mbpr:~/Swift/Kitura-Markdown$ docker images
> REPOSITORY TAG IMAGE ID CREATED SIZE
> ubuntu 16.04 7b9b13f7b9c0 4 weeks ago 118MB
> ubuntu 14.04 132b7427a3b4 4 weeks ago 188MB
> 
> Thanks,
> 
> Youming Lin
> IBM Cloud, Swift@IBM, Kitura developer
> Austin, TX
> GitHub: @youming-lin
> 
> Alex Blewitt ---07/06/2017 01:42:22 PM---It looks like it's 
> /usr/share/zoneinfo on all Ubuntu versions: alblue.local[~]$ docker run -it 
> --rm
> 
> From: Alex Blewitt 
> To: Tony Parker 
> Cc: Youming Lin , Ian Partridge , 
> swift-corelibs-dev 
> Date: 07/06/2017 01:42 PM
> Subject: Re: [swift-corelibs-dev] TimeZone database
> Sent by: alb...@apple.com
> 
> 
> 
> 
> It looks like it's /usr/share/zoneinfo on all Ubuntu versions:
> 
> alblue.local[~]$ docker run -it --rm ubuntu:14.04 find /usr -name zone.tab
> /usr/share/zoneinfo/zone.tab
> alblue.local[~]$ docker run -it --rm ubuntu:16.04 find /usr -name zone.tab
> /usr/share/zoneinfo/zone.tab
> alblue.local[~]$ docker run -it --rm ubuntu:16.10 find /usr -name zone.tab
> /usr/share/zoneinfo/zone.tab
> 
> This is the same that's coming from CFTimeZone.c:
> 
> https://github.com/apple/swift-corelibs-foundation/blob/2611dcd0d9b91fecace537838294bd85f0220503/CoreFoundation/NumberDate.subproj/CFTimeZone.c#L36-L39
>  
> 
> 
> Is it possible that the MacOS header is being included and defining TZDIR 
> before the CFTimeZone.c file is compiled?
> 
> Alex
> On 6 Jul 2017, at 19:22, Tony Parker via swift-corelibs-dev 
> > wrote:
> 
> Is the path to zoneinfo different on the Ubuntu docker image?
> 
> - Tony
> On Jul 6, 2017, at 9:36 AM, Youming Lin  > wrote:
> We were seeing this on Travis too. Specifically, on a Travis matrix build 
> using Swift 3.1.1 on a Ubuntu 16.04 docker image running inside a Travis 
> 14.04 VM.
> 
> The issue was specific to the Ubuntu 16.04 docker image; when I tested in 
> Ubuntu 16.04 OS as a guest VM, the issue went away.
> 
> Thanks,
> 
> Youming Lin
> IBM Cloud, Swift@IBM, Kitura developer
> Austin, TX
> GitHub: @youming-lin
> 
> Tony Parker via swift-corelibs-dev ---07/06/2017 10:31:15 
> AM---Yes, we’re discussing this one internally too and trying to figure out 
> what the right answer is. May
> 
> From: Tony Parker via swift-corelibs-dev  >
> To: Ian Partridge >
> Cc: swift-corelibs-dev  >
> Date: 07/06/2017 10:31 AM
> Subject: Re: [swift-corelibs-dev] TimeZone database
> Sent by: swift-corelibs-dev-boun...@swift.org 
> 
> 
> 
> 
> 
> Yes, we’re discussing this one internally too and trying to figure out what 
> the right answer is. Maybe the best solution for now is to find a good 
> mechanism to check the underlying version of the OS and split it out into a 
> function as you suggest.
> 
> - Tony
> On Jul 6, 2017, at 7:37 AM, Ian Partridge via swift-corelibs-dev 
> > wrote:
> 
> Good shout Simon, you are right. I'm on Sierra. Compare and contrast:
> 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tzfile.h
> #define TZDIR "/usr/share/zoneinfo"
> 
> /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tzfile.h
> #define TZDIR "/var/db/timezone/zoneinfo"
> 
> so I guess if I installed the High Sierra beta it would work OK.
> 
> I hacked CF to force it to use /usr/share/zoneinfo and TestFoundation
> is much happier, but that's not a solution.
> 
> On 6 July 2017 at 15:20, Simon Evans > wrote:
> Ian
> 
> I also saw this error, I think its because the TZDIR is different in the 
> headers shipped with Xcode 9. Maybe the 

Re: [swift-corelibs-dev] TimeZone database

2017-07-06 Thread Simon Evans via swift-corelibs-dev
Ian

I also saw this error, I think its because the TZDIR is different in the 
headers shipped with Xcode 9. Maybe the location of the timezone directory was 
moved between Sierra and High Sierra. What version of macOS are you testing on?

If it has indeed moved between 10.12 and 10.13 it may require a runtime version 
check to dynamically return TZDIR.

Simon


> On 6 Jul 2017, at 15:09, Ian Partridge via swift-corelibs-dev 
>  wrote:
> 
> Hi,
> 
> I'm seeing quite a lot of tests failing when running the
> TestFoundation target in Xcode.  The failures are timezone related.
> Most simply, the code
> 
> let timeZone = TimeZone(abbreviation: "GMT")
> 
> is returning nil.
> 
> Walking through the CF code which sets things up, it seems to be
> trying to read the timezone database from
> /var/db/timezone/zoneinfo/zone.tab which doesn't exist on my macOS
> system.
> 
> /usr/share/zoneinfo/zone.tab is there and seems to be the right
> location (?), but CF is picking up TZDIR from tzfile.h which says:
> 
> #define TZDIR   "/var/db/timezone/zoneinfo"
> 
> Any thoughts?  I feel like I'm missing something obvious and have gone
> too far down the rabbit hole.
> 
> -- 
> Ian Partridge
> ___
> swift-corelibs-dev mailing list
> swift-corelibs-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


Re: [swift-corelibs-dev] Got some fatalErrors when running TestFoundation target

2017-06-19 Thread Simon Evans via swift-corelibs-dev
The issue looks to be the TZDIR (Time zoneinfo directory) has changed between 
10.12 and 10.13

On 10.12 (Sierra), /usr/include/tzfile.h defines:
$ grep TZDIR /usr/include/tzfile.h 
#ifndef TZDIR
#define TZDIR   "/usr/share/zoneinfo" /* Time zone object file directory */
#endif /* !defined TZDIR */

But when compiling with the beta its defined as:

$ grep TZDIR 
/Applications/Xcode-beta.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tzfile.h
#ifndef TZDIR
#define TZDIR   "/var/db/timezone/zoneinfo" /* Time zone object file directory 
*/
#endif /* !defined TZDIR */

Which fails to since its pointing in the wrong place. A quick workaround is to 
just hardcode the TZDIR in CoreFoundation//NumberDate.subproj/CFTimeZone.c. A 
better workaround is maybe find out which os version the test is running on and 
set it dynamically.




> On 20 Jun 2017, at 04:23, Zhu Shengqi via swift-corelibs-dev 
>  wrote:
> 
> Hi guys, I want to contribute to swift-corelibs-foundation, but I met some 
> problems when testing my code. I got some fatalErrors ( e.g. in 
> test_gettingDatesOnGregorianCalendar(), TimeZone(identifier: "UTC") returns a 
> nil before being unwrapped). Do you have the same problems?
> 
> I'm using Xcode 9 beta and have tried both 
> swift-DEVELOPMENT-SNAPSHOT-2017-06-19-a-osx and 
> swift-4.0-DEVELOPMENT-SNAPSHOT-2017-06-12-a-osx (which swift snapshot should 
> I use btw?).
>  
> ___
> swift-corelibs-dev mailing list
> swift-corelibs-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


Re: [swift-corelibs-dev] Unable to build swift-corelibs-foundation in XCode 8.3.2

2017-06-02 Thread Simon Evans via swift-corelibs-dev
Yes I was also seeing this issue, the Xcode project needs the swift-version 3 
set and some files were moved around during a URLSession change

See if these 2 PRs fix it for you, they worked for me

https://github.com/apple/swift-corelibs-foundation/pull/1017
https://github.com/apple/swift-corelibs-foundation/pull/1006


si

> On 2 Jun 2017, at 12:08, Sai Kanduri via swift-corelibs-dev 
>  wrote:
> 
> Hi All,
>  
> Latest Foundation code with XCode 8.3.2 does not compile successfully for me. 
> Is anyone else also seeing this ?
>  
> -Sai Hema
> 
> ___
> swift-corelibs-dev mailing list
> swift-corelibs-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev