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

[SR-3275] Lack of command 'git' causes swift-build crash. #5165

Closed
swift-ci opened this issue Nov 26, 2016 · 4 comments
Closed

[SR-3275] Lack of command 'git' causes swift-build crash. #5165

swift-ci opened this issue Nov 26, 2016 · 4 comments
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-3275
Radar None
Original Reporter scoot (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Swift version 3.0 (swift-3.0-RELEASE)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 695fa998c110daea59a7f5c65a9ca3e6

is duplicated by:

  • SR-3302 Crash when git not installed

Issue Description:

I noticed following crash when there is no 'git' command in the system.

$ swift build
(...)
Cloning https://github.com/.............
git clone --recursive --depth 10 https://github.com/.......... 

fatal error: unexpectedly found nil while unwrapping an Optional value
Current stack trace:
0    libswiftCore.so                    0x00007fa1d0787690 swift_reportError + 117
1    libswiftCore.so                    0x00007fa1d0798b00 _swift_stdlib_reportFatalError + 61
2    libswiftCore.so                    0x00007fa1d05aa063 <unavailable> + 0
3    libswiftCore.so                    0x00007fa1d070512d <unavailable> + 0
4    libswiftCore.so                    0x00007fa1d05aa063 <unavailable> + 0
5    libswiftCore.so                    0x00007fa1d06c9130 specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never + 96
6    swift-build                        0x00000000005b3575 <unavailable> + 0
7    swift-build                        0x00000000005ff4b7 <unavailable> + 0
8    swift-build                        0x000000000060ab22 <unavailable> + 0
9    swift-build                        0x000000000060c822 <unavailable> + 0
10   swift-build                        0x0000000000601cf1 <unavailable> + 0
11   swift-build                        0x0000000000603c6e <unavailable> + 0
12   swift-build                        0x000000000060338d <unavailable> + 0
13   swift-build                        0x0000000000603d3c <unavailable> + 0
14   libswiftCore.so                    0x00007fa1d064c360 Sequence.flatMap<A where ...> ((A.Iterator.Element) throws -> A1) throws -> [A1.Iterator.Element] + 576
15   swift-build                        0x00000000005fff8c <unavailable> + 0
16   swift-build                        0x00000000005ff964 <unavailable> + 0
17   swift-build                        0x00000000006080b2 <unavailable> + 0
18   swift-build                        0x000000000062f400 <unavailable> + 0
19   swift-build                        0x000000000069befa <unavailable> + 0
20   swift-build                        0x0000000000692327 <unavailable> + 0
21   swift-build                        0x0000000000414748 <unavailable> + 0
22   libc.so.6                          0x00007fa1ce812a50 __libc_start_main + 245
23   swift-build                        0x0000000000414619 <unavailable> + 0
Illegal instruction

$ git
-bash: git: command not found
@Bouke
Copy link
Contributor

Bouke commented Dec 27, 2016

Using the development snapshot of 15 december on Ubuntu 16.04;

bouke@ubuntu-imac:~/Developer/HAP$ which git
bouke@ubuntu-imac:~/Developer/HAP$ git
The program 'git' is currently not installed. You can install it by typing:
sudo apt install git
bouke@ubuntu-imac:~/Developer/HAP$ swift build
Fetching https://github.com/Bouke/CLibSodium.git
git clone --bare https://github.com/Bouke/CLibSodium.git /media/sf_Developer/HAP/.build/repositories/CLibSodium.git--9212624310367625262

error: Failed to clone https://github.com/Bouke/CLibSodium.git to <AbsolutePath:"/media/sf_Developer/HAP/.build/repositories/CLibSodium.git--9212624310367625262">

So, no longer a crash, but improved diagnostics would be welcome.

@heckj
Copy link
Contributor

heckj commented Jan 26, 2017

Hey scoot (JIRA User), I was looking for some relatively self-contained bugs to get into the swiftpm code base. Saw that it no longer crashed and verified with the 3.1 and master branch what it was doing - but wasn't sure what "improved diagnostics" you were thinking about.

I thought "If git doesn't exist on the local system, fail out early and report that..." as a first order cut of something useful, but did you have something else in mind?

@ankitspd
Copy link
Member

Right now we don't report what error actually occurred when we fail to clone, I think fixing that problem will fix this issue.
See: https://github.com/apple/swift-package-manager/blob/master/Sources/SourceControl/GitRepository.swift#L62

@ankitspd
Copy link
Member

#921

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
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

4 participants