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
[SR-2783] REPL crashes due to bad permissions CoreFoundation header files (Ubuntu) #4585
Comments
'help' and ':help' are different but that shouldn't be the problem here. |
Comment by Alex (JIRA) Actually, it crashes no matter the input, 1 + 1 results in a crash as well. Anyway I can get a core dump? Not sure if useful, but just in case tail output.txt |
Comment by Alex (JIRA) :help actually does work though... so are commands preceded by ':'... Welcome to Swift version 3.0 (swift-3.0-RELEASE). Type :help for assistance.
1> :help
The REPL (Read-Eval-Print-Loop) acts like an interpreter. Valid statements, expressions, and declarations are immediately compiled and executed.
The complete set of LLDB debugging commands are also available as described below. Commands must be prefixed with a colon at the REPL prompt (:quit for example.) Typing just a colon
followed by return will switch to the LLDB prompt.
Debugger commands:
apropos -- List debugger commands related to a word or subject. |
Comment by Alex (JIRA) Hi Jordan, I've tried on my own machine, seems to be working fine... but it's a 16.04. I know, it's not the right one, but can't really wait to get my stuff running on AWS Ubuntu 14.04. I think I'm going to switch to the Swift-PREVIEW on 16.04 - and wait until it's released - so everything is clean. I think there's a problem with 3.0 GA on AWS- ubuntu, not sure which one though. |
Comment by Eric Sheppard (JIRA) I got this crash in the REPL too, but with a stock Ubuntu 16.04 AWS EC2 instance. It basically would crash on any Swift code at all such as "1+1". Then later after trying the 'swift build' command and getting an error about a header file in .../usr/lib/swift/CoreFoundation, i discovered the permissions of the header files in that directory were not readable by the world (only root), so i fixed the permissions with 'chmod -R a+r *' in the top-level usr directory and that fixed both the 'swift build' and the REPL no longer crashed after that! So it looks like it was due to a file permissions issue. Some of the files in the Ubuntu 16.04 Swift 3.0.2 tarball don't have proper world read permissions. Also the REPL should probably handle this condition more gracefully. |
Comment by Mason Mark (JIRA) I just noticed this same issue (with latest Swift 3.1 snapshot for Ubuntu 16.04), and verified that it is just the CoreFoundation headers in the tarball that cause the crashes. Once identified, it is easy to fix, but should be fixed in the tarball itself. (Note that this issue probably manifests for many users, but not others, depending on how their UNIX users and groups are set up.) SYMPTOM: Swift REPL (and other tools) crash when run by regular non-root user: ubuntu@mason-linux-2017:~$ ls -l /swift
lrwxrwxrwx 1 root root 55 Feb 3 10:34 /swift -> swift-3.1-DEVELOPMENT-SNAPSHOT-2017-01-31-a-ubuntu16.04
ubuntu@mason-linux-2017:~$
ubuntu@mason-linux-2017:~$ swift
Welcome to Swift version 3.1-dev (LLVM a568eff4bf, Clang a27f59ecee, Swift 228feb1ee0). Type :help for assistance.
1> print("oh no, it doesn't work for non-root user like me! :-( ")
error: Couldn't IRGen expression, no additional error
1> ^D
ubuntu@mason-linux-2017:~$
ubuntu@mason-linux-2017:~$ sudo bash
root@mason-linux-2017:~#
root@mason-linux-2017:~# swift
Welcome to Swift version 3.1-dev (LLVM a568eff4bf, Clang a27f59ecee, Swift 228feb1ee0). Type :help for assistance.
1> print("IT WORKS FOR ROOT, BRO! >:-D ")
IT WORKS FOR ROOT, BRO! >:-D
2> ^D
root@mason-linux-2017:~# REASON: The CoreFoundation headers are not readable by all users: root@mason-linux-2017:/swift# find . ! -perm -a+r
./usr/lib/swift/CoreFoundation/CFNumber.h
./usr/lib/swift/CoreFoundation/CFLogUtilities.h
./usr/lib/swift/CoreFoundation/CFXMLInterface.h
./usr/lib/swift/CoreFoundation/CFBundle_Internal.h
./usr/lib/swift/CoreFoundation/CFURL.h
./usr/lib/swift/CoreFoundation/CFMessagePort.h
./usr/lib/swift/CoreFoundation/CFXMLInputStream.h
./usr/lib/swift/CoreFoundation/CFBinaryHeap.h
./usr/lib/swift/CoreFoundation/CFAvailability.h
./usr/lib/swift/CoreFoundation/CoreFoundation_Prefix.h
./usr/lib/swift/CoreFoundation/CFStream.h
./usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h
./usr/lib/swift/CoreFoundation/CFDateFormatter.h
./usr/lib/swift/CoreFoundation/CFUUID.h
./usr/lib/swift/CoreFoundation/CFRunLoop.h
./usr/lib/swift/CoreFoundation/CFPriv.h
./usr/lib/swift/CoreFoundation/CFString.h
./usr/lib/swift/CoreFoundation/CFStringEncodingDatabase.h
./usr/lib/swift/CoreFoundation/CFBag.h
./usr/lib/swift/CoreFoundation/CFUtilities.h
./usr/lib/swift/CoreFoundation/CFBundlePriv.h
./usr/lib/swift/CoreFoundation/CFArray.h
./usr/lib/swift/CoreFoundation/CFUniChar.h
./usr/lib/swift/CoreFoundation/CFStreamInternal.h
./usr/lib/swift/CoreFoundation/CFError.h
./usr/lib/swift/CoreFoundation/CFStringEncodingExt.h
./usr/lib/swift/CoreFoundation/CFCharacterSetPriv.h
./usr/lib/swift/CoreFoundation/CFCharacterSet.h
./usr/lib/swift/CoreFoundation/CFDateFormatter_Private.h
./usr/lib/swift/CoreFoundation/CFURLComponents.h
./usr/lib/swift/CoreFoundation/CFNumberFormatter.h
./usr/lib/swift/CoreFoundation/CFURLAccess.h
./usr/lib/swift/CoreFoundation/CFStringEncodingConverter.h
./usr/lib/swift/CoreFoundation/CFPreferences.h
./usr/lib/swift/CoreFoundation/CFStringEncodingConverterExt.h
./usr/lib/swift/CoreFoundation/CFStringDefaultEncoding.h
./usr/lib/swift/CoreFoundation/CFAttributedString.h
./usr/lib/swift/CoreFoundation/CFXMLNode.h
./usr/lib/swift/CoreFoundation/CFXMLParser.h
./usr/lib/swift/CoreFoundation/CFLocale.h
./usr/lib/swift/CoreFoundation/CFDictionary.h
./usr/lib/swift/CoreFoundation/CFURLSessionInterface.h
./usr/lib/swift/CoreFoundation/CFSocket.h
./usr/lib/swift/CoreFoundation/CFData.h
./usr/lib/swift/CoreFoundation/CFICUConverters.h
./usr/lib/swift/CoreFoundation/CFSet.h
./usr/lib/swift/CoreFoundation/CFUnicodeDecomposition.h
./usr/lib/swift/CoreFoundation/CFPlugIn.h
./usr/lib/swift/CoreFoundation/CFTimeZone.h
./usr/lib/swift/CoreFoundation/CFUnicodePrecomposition.h
./usr/lib/swift/CoreFoundation/CFStorage.h
./usr/lib/swift/CoreFoundation/CFMachPort.h
./usr/lib/swift/CoreFoundation/CFICULogging.h
./usr/lib/swift/CoreFoundation/CFBundle.h
./usr/lib/swift/CoreFoundation/CFURL.inc.h
./usr/lib/swift/CoreFoundation/CFLocale_Private.h
./usr/lib/swift/CoreFoundation/CFStringLocalizedFormattingInternal.h
./usr/lib/swift/CoreFoundation/CFUniCharPriv.h
./usr/lib/swift/CoreFoundation/CFUserNotification.h
./usr/lib/swift/CoreFoundation/CFBundle_BinaryTypes.h
./usr/lib/swift/CoreFoundation/CFPlugInCOM.h
./usr/lib/swift/CoreFoundation/CFCalendar.h
./usr/lib/swift/CoreFoundation/CFPropertyList.h
./usr/lib/swift/CoreFoundation/CFTree.h
./usr/lib/swift/CoreFoundation/CFStreamAbstract.h
./usr/lib/swift/CoreFoundation/module.modulemap
./usr/lib/swift/CoreFoundation/CFLocaleInternal.h
./usr/lib/swift/CoreFoundation/CFStringEncodingConverterPriv.h
./usr/lib/swift/CoreFoundation/CFURLPriv.h
./usr/lib/swift/CoreFoundation/CFRuntime.h
./usr/lib/swift/CoreFoundation/CFError_Private.h
./usr/lib/swift/CoreFoundation/CFBase.h
./usr/lib/swift/CoreFoundation/CFByteOrder.h
./usr/lib/swift/CoreFoundation/CFBigNumber.h
./usr/lib/swift/CoreFoundation/CFBurstTrie.h
./usr/lib/swift/CoreFoundation/CFBitVector.h
./usr/lib/swift/CoreFoundation/CFDate.h
./usr/lib/swift/CoreFoundation/CFRegularExpression.h
./usr/lib/swift/CoreFoundation/CFNotificationCenter.h
./usr/lib/swift/CoreFoundation/CFAsmMacros.h
./usr/lib/swift/CoreFoundation/CFBasicHash.h
./usr/lib/swift/CoreFoundation/ForFoundationOnly.h
./usr/lib/swift/CoreFoundation/CoreFoundation.h
./usr/lib/swift/CoreFoundation/CFPlugIn_Factory.h
./usr/lib/swift/CoreFoundation/CFRunArray.h
./usr/lib/swift/CoreFoundation/CFStreamPriv.h
./usr/lib/swift/CoreFoundation/TargetConditionals.h
./usr/lib/swift/CoreFoundation/CFInternal.h
root@mason-linux-2017:/swift# WORKAROUND: Fix permissions on CoreFoundation headers: root@mason-linux-2017:/swift# chmod a+r /swift/usr/lib/swift/CoreFoundation/*
root@mason-linux-2017:/swift#
root@mason-linux-2017:/swift# find . ! -perm -a+r
root@mason-linux-2017:/swift# CONFIRM: It works as expected after doing that, even for regular user: root@mason-linux-2017:/swift# exit
exit
ubuntu@mason-linux-2017:~$ swift
Welcome to Swift version 3.1-dev (LLVM a568eff4bf, Clang a27f59ecee, Swift 228feb1ee0). Type :help for assistance.
1> print("now it works for even lowly users like me :D ")
now it works for even lowly users like me :D
2> ^D
ubuntu@mason-linux-2017:~$ |
@shahmishal, any ideas why the permissions would get messed up like this? |
Comment by Søren Mortensen (JIRA) mason (JIRA User), I had the same problem on 16.04 (Swift version 4.0.3) and this workaround fixed it for me. |
This issue should be resolved with latest development toolchain. |
Comment by Dmitriy Borovikov (JIRA) The same problem exist on 16.04 (Swift version 4.2). |
Attachment: Download
Environment
plateform: Amazon 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty
libghc-llvm-base-dev/trusty 3.2.0.0-3ubuntu1 amd64
libghc-llvm-base-doc/trusty 3.2.0.0-3ubuntu1 all
libghc-llvm-base-prof/trusty 3.2.0.0-3ubuntu1 amd64
libghc-llvm-dev/trusty 3.2.0.0-1build1 amd64
libghc-llvm-doc/trusty 3.2.0.0-1build1 all
libghc-llvm-prof/trusty 3.2.0.0-1build1 amd64
libllvm-3.3-ocaml-dev/trusty 1:3.3-16ubuntu1 amd64
libllvm-3.4-ocaml-dev/trusty 1:3.4-1ubuntu3 amd64
libllvm-3.5-ocaml-dev/trusty-updates,trusty-security 1:3.5-4ubuntu2~trusty2 amd64
libllvm-3.6-ocaml-dev/trusty-updates 1:3.6-2ubuntu1~trusty1 amd64
libllvm-3.8-ocaml-dev/trusty-updates 1:3.8-2ubuntu3~trusty4 amd64
libllvm-ocaml-dev/trusty 1:3.4-0ubuntu1 amd64
libllvm3.3/trusty 1:3.3-16ubuntu1 amd64
libllvm3.3-dbg/trusty 1:3.3-16ubuntu1 amd64
libllvm3.4/trusty,now 1:3.4-1ubuntu3 amd64 [installed,automatic]
libllvm3.4-dbg/trusty 1:3.4-1ubuntu3 amd64
libllvm3.5/trusty-updates,trusty-security 1:3.5-4ubuntu2~trusty2 amd64
libllvm3.5-dbg/trusty-updates,trusty-security 1:3.5-4ubuntu2~trusty2 amd64
libllvm3.6/trusty-updates 1:3.6-2ubuntu1~trusty1 amd64
libllvm3.6-dbg/trusty-updates 1:3.6-2ubuntu1~trusty1 amd64
libllvm3.8v4/trusty-updates 1:3.8-2ubuntu3~trusty4 amd64
libllvm3.8v4-dbg/trusty-updates 1:3.8-2ubuntu3~trusty4 amd64
llvm/trusty 1:3.4-0ubuntu1 amd64
llvm-3.3/trusty 1:3.3-16ubuntu1 amd64
llvm-3.3-dev/trusty 1:3.3-16ubuntu1 amd64
llvm-3.3-doc/trusty 1:3.3-16ubuntu1 all
llvm-3.3-examples/trusty 1:3.3-16ubuntu1 all
llvm-3.3-runtime/trusty 1:3.3-16ubuntu1 amd64
llvm-3.4/trusty,now 1:3.4-1ubuntu3 amd64 [installed,automatic]
llvm-3.4-dev/trusty,now 1:3.4-1ubuntu3 amd64 [installed,automatic]
llvm-3.4-doc/trusty 1:3.4-1ubuntu3 all
llvm-3.4-examples/trusty 1:3.4-1ubuntu3 all
llvm-3.4-runtime/trusty,now 1:3.4-1ubuntu3 amd64 [installed,automatic]
llvm-3.5/trusty-updates,trusty-security 1:3.5-4ubuntu2~trusty2 amd64
llvm-3.5-dev/trusty-updates,trusty-security 1:3.5-4ubuntu2~trusty2 amd64
llvm-3.5-doc/trusty-updates,trusty-security 1:3.5-4ubuntu2~trusty2 all
llvm-3.5-examples/trusty-updates,trusty-security 1:3.5-4ubuntu2~trusty2 all
llvm-3.5-runtime/trusty-updates,trusty-security 1:3.5-4ubuntu2~trusty2 amd64
llvm-3.5-tools/trusty-updates,trusty-security 1:3.5-4ubuntu2~trusty2 amd64
llvm-3.6/trusty-updates 1:3.6-2ubuntu1~trusty1 amd64
llvm-3.6-dev/trusty-updates 1:3.6-2ubuntu1~trusty1 amd64
llvm-3.6-doc/trusty-updates 1:3.6-2ubuntu1~trusty1 all
llvm-3.6-examples/trusty-updates 1:3.6-2ubuntu1~trusty1 all
llvm-3.6-runtime/trusty-updates 1:3.6-2ubuntu1~trusty1 amd64
llvm-3.6-tools/trusty-updates 1:3.6-2ubuntu1~trusty1 amd64
llvm-3.8/trusty-updates 1:3.8-2ubuntu3~trusty4 amd64
llvm-3.8-dev/trusty-updates 1:3.8-2ubuntu3~trusty4 amd64
llvm-3.8-doc/trusty-updates 1:3.8-2ubuntu3~trusty4 all
llvm-3.8-examples/trusty-updates 1:3.8-2ubuntu3~trusty4 all
llvm-3.8-runtime/trusty-updates 1:3.8-2ubuntu3~trusty4 amd64
llvm-dev/trusty 1:3.4-0ubuntu1 amd64
llvm-gcc-4.7/trusty 3.3-2 amd64
llvm-gcc-4.8/trusty 3.3-2 amd64
llvm-runtime/trusty 1:3.4-0ubuntu1 amd64
apt list clang
Listing... Done
clang/trusty,now 1:3.4-0ubuntu1 amd64 [installed]
Additional Detail from JIRA
Watchers: @shahmishal
md5: 9c53f82acf612e733b7f2dd8ea44b1d8
relates to:
Issue Description:
software: swift-3.0-RELEASE-ubuntu14.04.tar.gz
plateform: 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Problem:
note: no core found... seg fault on all commands.
What am I missing?
The text was updated successfully, but these errors were encountered: