Skip to content

[SR-7559] Building swiftpm requires rsync, and crashes with an obscure message if not found #4820

@alblue

Description

@alblue
Previous ID SR-7559
Radar None
Original Reporter @alblue
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug, StarterBug
Assignee freak4pc (JIRA)
Priority Medium

md5: 72850b6a70529d6c4d42a430f3971fa8

Issue Description:

https://github.com/apple/swift-package-manager/blob/95d93df24e8237eaf2eb6425923680eec30f7149/Utilities/bootstrap#L658-L660

SwiftPM uses rsync here as part of its build process. If rsync is not found on the system (say, a minimal container without many dependencies) then it will fail with a terse/cryptic error message:

Compile Swift Module 'Commands' (14 sources)
Compile Swift Module 'swift_package' (1 sources)
Compile Swift Module 'swift_build' (1 sources)
Compile Swift Module 'swift_test' (1 sources)
Compile Swift Module 'swift_run' (1 sources)

      • bootstrap: note: building runtime v4_2 target: PackageDescription4:
        Compile Swift Module 'PackageDescription' (9 sources)

      • bootstrap: note: building runtime v3 target: PackageDescription:
        Compile Swift Module 'PackageDescription' (6 sources)

      • bootstrap: note: building runtime v4 target: PackageDescription4:
        Compile Swift Module 'PackageDescription' (9 sources)
        Traceback (most recent call last):
        File "/swift-source/swiftpm/Utilities/bootstrap", line 1276, in <module>
        main()
        File "/swift-source/swiftpm/Utilities/bootstrap", line 949, in main
        build, args, lib_path)
        File "/swift-source/swiftpm/Utilities/bootstrap", line 659, in process_runtime_libraries
        subprocess.check_call(cmd)
        File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
        retcode = call(*popenargs, **kwargs)
        File "/usr/lib/python2.7/subprocess.py", line 172, in call
        return Popen(*popenargs, **kwargs).wait()
        File "/usr/lib/python2.7/subprocess.py", line 394, in init
        errread, errwrite)
        File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
        raise child_exception
        OSError: [Errno 2] No such file or directory
        ./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
        ./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

It would be better if a fallback position determined that rsync was not available, and used a different mechanism (and/or failed with a sensible error message) instead of the above

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions