Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find public domain/LLVM code to replace current third-party code #3

Closed
zhuowei opened this issue Dec 13, 2015 · 10 comments
Closed

find public domain/LLVM code to replace current third-party code #3

zhuowei opened this issue Dec 13, 2015 · 10 comments
Labels

Comments

@zhuowei
Copy link
Member

zhuowei commented Dec 13, 2015

Hopefully I can get around to doing this before someone tries to use this for crypto...

@zhuowei
Copy link
Member Author

zhuowei commented Dec 18, 2015

A Posix_spawn implementation from FreeBSD (modified to use fork instead of vfork (which is too sketchy)) worked fine.

Looks like the lack of random number generation is being caught in the unit test: test/1_stdlib/ReflectionHashing.swift aborts probably because of missing random.

@zhuowei zhuowei changed the title Implement arc4_random, posix_spawn replacements Implement arc4_random replacement Dec 18, 2015
@zhuowei zhuowei added the bug label Dec 18, 2015
@zhuowei zhuowei changed the title Implement arc4_random replacement Implement arc4_random replacement, find public domain/LLVM code to replace current third-party code Dec 22, 2015
@zhuowei
Copy link
Member Author

zhuowei commented Dec 22, 2015

Need to replace the existing getline, posix_spawn, and SunSoft libm stuff with either public domain or LLVM code - https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151221/000547.html

@zhuowei zhuowei changed the title Implement arc4_random replacement, find public domain/LLVM code to replace current third-party code find public domain/LLVM code to replace current third-party code Jan 7, 2016
@modocache
Copy link
Member

I'd like to work on documenting a list of SwiftAndroid's dependencies, and which of those use incompatible licenses. I'd also like to consider sacrificing some dependencies/Swift features (see 1dde6bd for an example) in favor of merging this fork upstream. What do you all think?

@modocache
Copy link
Member

  • getline from Android source 4a39bc6
  • posix_spawn from FreeBSD libc
  • The SubSoft libm floating point routines in stdlib/public/stubs/android_support/ 4a39bc6
  • execinfo.h 1dde6bd

Is that right?

@modocache
Copy link
Member

Is it possible to just tear out the FreeBSD posix_spawn implementation, and instead simply have that functionality unavailable on Android? I guess it isn't, since stdlib/private/SwiftPrivateDarwinExtras/Subprocess.swift and the test suite rely on it so heavily. Hmm...

@zhuowei
Copy link
Member Author

zhuowei commented Feb 20, 2016

That should be it. The test suite doesn't require a whole lot of functionality from posix_spawn - just redirect file descriptors, if I recall; it might be possible to just rewrite it

@modocache
Copy link
Member

I'm looking at https://github.com/apple/swift/blob/e094e9f10ca4a63e195295e74dc852e5dd5a3234/lib/Basic/Unix/TaskQueue.inc#L133, and I bet we could do something similar for the unit tests--using posix_spawn if available, and fork if not.

modocache referenced this issue Feb 20, 2016
Android NDK version 21 includes log2 and getline, two dependencies
whose licences prevented us from upstreaming the Android fork.
Update to 21 in order to resolve these dependency issues.
@jckarter
Copy link

posix_spawn is more efficient on Darwin and Win32 (and fork doesn't exist at all in mobile Darwin variants), so we'd prefer that posix_spawn still be used when available.

@modocache
Copy link
Member

@jckarter Absolutely. This will just be a fallback for platforms for which posix_spawn is unavailable. 👍

By the way, I notice swift/lib/Basic/Unix/TaskQueue.inc uses a macro HAVE_POSIX_SPAWN. I don't suppose you know of anything similar I can use in the Swift file swift/stdlib/private/SwiftPrivateDarwinExtras/Subprocess.swift? For the time being I'm using #if os(Android).

@modocache
Copy link
Member

This has mostly been taken care of upstream, through a combination of raising the minimum API level and implementing custom workarounds for StdlibUnittest. Still some room for improvement, though: https://bugs.swift.org/browse/SR-1746

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants