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-12391] Inconsistent behavior of Progress between Linux and macOS #3263

Open
SlaunchaMan opened this issue Mar 21, 2020 · 0 comments
Open
Assignees

Comments

@SlaunchaMan
Copy link

Previous ID SR-12391
Radar None
Original Reporter @SlaunchaMan
Type Bug
Environment

macOS 10.15.3
Xcode 11.3
Swift Nightly Docker image

Additional Detail from JIRA
Votes 1
Component/s Foundation
Labels Bug
Assignee @spevans
Priority Medium

md5: c166a39c004c8bd14ff541a19dab7908

Issue Description:

If you create an executable project using Swift Package Manager and write the following:

import Foundation

let progress = Progress(totalUnitCount: 42)

progress.completedUnitCount = 16

print(progress.debugDescription)

progress.totalUnitCount = 0
progress.completedUnitCount = 0

print(progress.debugDescription)

let progress2 = Progress(totalUnitCount: 42)

progress2.completedUnitCount = 16

print(progress2.debugDescription)

progress2.completedUnitCount = 0
progress2.totalUnitCount = 0

print(progress2.debugDescription)

on macOS, this will run successfully. On Linux, this crashes:

Precondition failed: Attempt to add or subtract invalid fraction: file /home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/swift-corelibs-foundation/Sources/Foundation/ProgressFraction.swift, line 59
Current stack trace:
0    libswiftCore.so                    0x00007f8ca4e2ebe0 swift_reportError + 50
1    libswiftCore.so                    0x00007f8ca4ea06b0 _swift_stdlib_reportFatalErrorInFile + 115
2    libswiftCore.so                    0x00007f8ca4b7e481 <unavailable> + 1389697
3    libswiftCore.so                    0x00007f8ca4b7e0c7 <unavailable> + 1388743
4    libswiftCore.so                    0x00007f8ca4b7e662 <unavailable> + 1390178
5    libswiftCore.so                    0x00007f8ca4b7ca90 _assertionFailure(_:_:file:line:flags:) + 523
6    libFoundation.so                   0x00007f8ca578d818 <unavailable> + 8267800
7    libFoundation.so                   0x00007f8ca578ecf0 static _ProgressFraction.+ infix(_:_:) + 183
8    libFoundation.so                   0x00007f8ca5787090 Progress._overallFraction.getter + 231
9    libFoundation.so                   0x00007f8ca5783f80 Progress.totalUnitCount.setter + 944
10   NoProgress                         0x000055fa0341bebc <unavailable> + 3772
11   libc.so.6                          0x00007f8ca3834ab0 __libc_start_main + 231
12   NoProgress                         0x000055fa0341bb2a <unavailable> + 2858
Illegal instruction
The command '/bin/sh -c swift run' returned a non-zero code: 132

This is used in Alamofire’s retry functionality to reset the progress of a request.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant