Skip to content

Don't assume localtime() result is non-nil#280

Merged
tomerd merged 3 commits intoapple:mainfrom
gwynne:patch-1
Nov 17, 2023
Merged

Don't assume localtime() result is non-nil#280
tomerd merged 3 commits intoapple:mainfrom
gwynne:patch-1

Conversation

@gwynne
Copy link
Copy Markdown
Contributor

@gwynne gwynne commented Nov 16, 2023

Check for localtime(3) returning a nil result.

Motivation:

This avoids calling strftime(3) with a NULL pointer in the odd case that localtime(3) fails. It also has the useful, if incidental, side effect of fixing building swift-log on Arch Linux (see vapor/toolbox#430 for more info).

Modifications:

Added a guard which returns a generic failure string if localtime(3) returns nil.

Result:

There should be no visible impact on virtually any users, seeing as how this has not been previously encountered, and the use of swift-log on at least one unofficial (but apparently commonly used) platform will be fixed.

@tomerd
Copy link
Copy Markdown
Member

tomerd commented Nov 16, 2023

fixing CI in #281

@tomerd tomerd enabled auto-merge (squash) November 16, 2023 21:48
@tomerd
Copy link
Copy Markdown
Member

tomerd commented Nov 17, 2023

@swift-server-bot test this please

@tomerd tomerd disabled auto-merge November 17, 2023 00:13
@tomerd tomerd enabled auto-merge (squash) November 17, 2023 00:13
@tomerd tomerd merged commit f447991 into apple:main Nov 17, 2023
@ktoso ktoso added this to the 1.5.4 milestone Jan 22, 2024
cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/rules_swift_package_manager Jan 22, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [apple/swift-log](https://togithub.com/apple/swift-log) | patch |
`from: "1.5.3"` -> `from: "1.5.4"` |

---

### Release Notes

<details>
<summary>apple/swift-log (apple/swift-log)</summary>

### [`v1.5.4`](https://togithub.com/apple/swift-log/releases/tag/1.5.4)

[Compare
Source](https://togithub.com/apple/swift-log/compare/1.5.3...1.5.4)

##### What's Changed

##### Cleanups & minor compatibility improvements

- Don't assume localtime() result is non-nil by
[@&#8203;gwynne](https://togithub.com/gwynne) in
[https://github.com/apple/swift-log/pull/280](https://togithub.com/apple/swift-log/pull/280)
- Changes to build with Musl. by
[@&#8203;al45tair](https://togithub.com/al45tair) in
[https://github.com/apple/swift-log/pull/283](https://togithub.com/apple/swift-log/pull/283)

##### Non code changes

- Add CocoaLumberjack to list of logging backends by
[@&#8203;ffried](https://togithub.com/ffried) in
[https://github.com/apple/swift-log/pull/276](https://togithub.com/apple/swift-log/pull/276)
- update CI script by [@&#8203;tomerd](https://togithub.com/tomerd) in
[https://github.com/apple/swift-log/pull/281](https://togithub.com/apple/swift-log/pull/281)
- Update README.md by [@&#8203;0xTim](https://togithub.com/0xTim) in
[https://github.com/apple/swift-log/pull/279](https://togithub.com/apple/swift-log/pull/279)

##### New Contributors

- [@&#8203;ffried](https://togithub.com/ffried) made their first
contribution in
[https://github.com/apple/swift-log/pull/276](https://togithub.com/apple/swift-log/pull/276)
- [@&#8203;0xTim](https://togithub.com/0xTim) made their first
contribution in
[https://github.com/apple/swift-log/pull/279](https://togithub.com/apple/swift-log/pull/279)
- [@&#8203;al45tair](https://togithub.com/al45tair) made their first
contribution in
[https://github.com/apple/swift-log/pull/283](https://togithub.com/apple/swift-log/pull/283)

**Full Changelog**:
apple/swift-log@1.5.3...1.5.4

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
@gwynne gwynne deleted the patch-1 branch January 23, 2024 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants