Skip to content

v0.4.3 crashs when using Transform closure #338

@griffin-stewie

Description

@griffin-stewie

It crashes(SIGABRT) on Release build when I use Transform closure.

I tested several versions bellow. Only v0.4.3 has this issue.

  • ✅ 0.3.2
  • ✅ 0.4.0
  • ✅ 0.4.1
  • ✅ 0.4.2
  • ‼️ 0.4.3
  • ‼️ main branch

ArgumentParser version: 0.4.3
Swift version: Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55) Target: x86_64-apple-darwin20.5.0

Checklist

  • If possible, I've reproduced the issue using the main branch of this package
  • I've searched for existing GitHub issues

Steps to Reproduce

Here is my sample code to reproduce this issue.

  1. Build sample code with Release configuration.
  2. Run this sample_cal description --start-date 2021/07/18_11:22:33 --name aaa

I suspect that the crash is caused by using @Option(name: , help: , transform: ).

One more thing, It prints a blank where start: Date should be printed, if I deleted @Option() var name: String.

Expected behavior

No crash, and prints OptionGroup’s description.

Actual behavior

Crashed.

Xcode shows some logs on console, like bellow:

sample\_cal(687,0x10026fe00) malloc: Double free of object 0x105a47cc0
sample\_cal(687,0x10026fe00) malloc: \*\*\* set a breakpoint in malloc\_error\_break to debug

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions