GithubHelp home page GithubHelp logo

Comments (8)

dfirsht avatar dfirsht commented on May 1, 2024

Comment by rfdickerson
Monday Jan 25, 2016 at 21:48 GMT


I have finished implementing the following. It attempts to find the types.json in "Sources/router/contentType/types.json", "Packages/Phoenix/Sources/router/contentType/types.json", then "./types.json". Notice the problem when Phoenix is pulled in, the tag will change based on the version. Perhaps we should have a way to find a directory that matches any string Phoenix-xxx where xxx is the tag version.

from kitura.

dfirsht avatar dfirsht commented on May 1, 2024

Comment by rfdickerson
Monday Jan 25, 2016 at 21:49 GMT


I used Foundation's JSONObjectWithData, however it returns an Any in Linux and AnyObject in Darwin. I would like to investigate if this breaks anything in Linux.

Create a Foundation object from JSON data. Set the NSJSONReadingAllowFragments option if the parser should allow top-level objects that are not an NSArray or NSDictionary. Setting the NSJSONReadingMutableContainers option will make the parser generate mutable NSArrays and NSDictionaries. Setting the NSJSONReadingMutableLeaves option will make the parser generate mutable NSString objects. If an error occurs during the parse, then the error parameter will be set and the result will be nil.

The data must be in one of the 5 supported encodings listed in the JSON specification: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE. The data may or may not have a BOM. The most efficient encoding to use for parsing is UTF-8, so if you have a choice in encoding the data passed to this method, use UTF-8.

Experiment: Note that the return type of this function is different than on Darwin Foundation (Any instead of AnyObject). This is likely to change once we have a more complete story for bridging in place.

from kitura.

dfirsht avatar dfirsht commented on May 1, 2024

Comment by rfdickerson
Monday Jan 25, 2016 at 22:44 GMT


@KALLNER This appears to work using Darwin's Foundation, however it Core dumps in Linux's Foundation- the error:
fatal error: unexpectedly found nil while unwrapping an Optional value

I believe this might be caused by the Any object inconsistency across platforms.

from kitura.

dfirsht avatar dfirsht commented on May 1, 2024

Comment by babt
Monday Jan 25, 2016 at 23:03 GMT


I've seen this with the "stock" compiler that ships with the latest Xcode. I was able to work around it so if you give me a bit more context I might be able figure out a workaround. It appears to be a bug in the compiler itself and to be cross platform since the fix I put in also worked when I tested the same module on Linux. I was testing on Linux as well as iOS so I narrow it down to reproducible scenario before open a bug with Apple.

Regards,
Bill Abt
[email protected]

Sent from my iPhone 6s

On Jan 25, 2016, at 5:47 PM, ROBERT F. DICKERSON [email protected] wrote:

@KALLNER This appears to work using Darwin's Foundation, however it Core dumps in Linux's Foundation- the error:
fatal error: unexpectedly found nil while unwrapping an Optional value

I believe this might be caused by the Any object inconsistency across platforms.


Reply to this email directly or view it on GitHub Enterprise.

from kitura.

dfirsht avatar dfirsht commented on May 1, 2024

Comment by rfdickerson
Monday Jan 25, 2016 at 23:07 GMT


Hi Bill, the problem is probably happening in

ContentType.swift in the initialize function. This isn't an issue with your ETSocket integration. That worked great, I think!

a run in lldb on Linux resulted in

Process 7845 launched: './.build/debug/sample' (x86_64)
fatal error: unexpectedly found nil while unwrapping an Optional value
Process 7845 stopped
* thread #1: tid = 7845, 0x00007ffff787ea88 libswiftCore.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () + 40, name = 'sample', stop reason = signal SIGILL: illegal instruction operand
    frame #0: 0x00007ffff787ea88 libswiftCore.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () + 40
libswiftCore.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> ():
->  0x7ffff787ea88 <+40>: ud2    
    0x7ffff787ea8a <+42>: movq   $0x0, -0x10(%rbp)
    0x7ffff787ea92 <+50>: movl   %edi, %eax
    0x7ffff787ea94 <+52>: cmpq   %rax, %rdi

again, it is working in Darwin's Foundation. I made it toggleable so that I don't cause problems for those working in Linux.

from kitura.

dfirsht avatar dfirsht commented on May 1, 2024

Comment by babt
Monday Jan 25, 2016 at 23:37 GMT


Ok, cool. I'll take a closer look tomorrow and see if it's the thing I ran into and let you know.

Regards,
Bill Abt
[email protected]

Sent from my iPhone 6s

On Jan 25, 2016, at 6:07 PM, ROBERT F. DICKERSON [email protected] wrote:

Hi Bill, the problem is probably happening in

ContentType.swift in the initialize function.

however, a run in lldb on Linux resulted in

Process 7845 launched: './.build/debug/sample' (x86_64)
fatal error: unexpectedly found nil while unwrapping an Optional value
Process 7845 stopped

  • thread #1: tid = 7845, 0x00007ffff787ea88 libswiftCore.sofunction signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () + 40, name = 'sample', stop reason = signal SIGILL: illegal instruction operand frame #0: 0x00007ffff787ea88 libswiftCore.sofunction signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () + 40
    libswiftCore.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> ():
    -> 0x7ffff787ea88 <+40>: ud2
    0x7ffff787ea8a <+42>: movq $0x0, -0x10(%rbp)
    0x7ffff787ea92 <+50>: movl %edi, %eax
    0x7ffff787ea94 <+52>: cmpq %rax, %rdi


Reply to this email directly or view it on GitHub Enterprise.

from kitura.

dfirsht avatar dfirsht commented on May 1, 2024

Comment by rfdickerson
Wednesday Jan 27, 2016 at 14:54 GMT


Still blocked until the issues with using JSONSerializer in Linux are resolved. Should we look to create a custom JSON parser until that gets resolved in corelibs-foundation?

from kitura.

dfirsht avatar dfirsht commented on May 1, 2024

All types added in content.json. We need to make a new issue to convert into swift source code.

from kitura.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.