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

Require 2-digit hour for local time #320

Closed
moorereason opened this issue Oct 29, 2021 · 3 comments
Closed

Require 2-digit hour for local time #320

moorereason opened this issue Oct 29, 2021 · 3 comments
Labels

Comments

@moorereason
Copy link

Given a=1:32:00, this package returns a valid time-local value instead of returning an error.

Reproduction

https://play.golang.org/p/fciY3UVyoT6

toml.Unmarshal([]byte("a=1:32:00"), &v)

Or using the toml-test decoder:

$ echo "a=1:32:00" | toml-test-decoder2
{
  "a": {
    "type": "time-local",
    "value": "01:32:00"
  }
}
@arp242 arp242 added the bug label Nov 16, 2021
arp242 added a commit to toml-lang/toml-test that referenced this issue Nov 25, 2021
@arp242
Copy link
Collaborator

arp242 commented Nov 25, 2021

This is actually an issue for all datetimes, not just local time; the problem is that 15 in time.Parse accepts both 01 and 1. There doesn't seem any way to require a leading zero.

@arp242
Copy link
Collaborator

arp242 commented Nov 25, 2021

I'm somewhat leaning towards just leaving it like this; writing times like "1:12:13" isn't too uncommon, it will always encode things as "01:12:13" so it won't cause issues with other decoders, and even though it's not fully spec-compliant I don't really see any problems with it. Might be worth discussing modifying the specification on this.

@moorereason
Copy link
Author

I'm simply reporting issues I've found while doing differential fuzzing against this package and go-toml and toml.dart.

But I'm in favor of following the TOML spec. As reported, this issue doesn't follow the spec.

@arp242 arp242 closed this as completed in 59c762d Oct 1, 2023
nrdufour pushed a commit to nrdufour/marmitton that referenced this issue May 24, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) | require | minor | `v1.3.2` -> `v1.4.0` |

---

### Release Notes

<details>
<summary>BurntSushi/toml (github.com/BurntSushi/toml)</summary>

### [`v1.4.0`](https://github.com/BurntSushi/toml/releases/tag/v1.4.0)

[Compare Source](BurntSushi/toml@v1.3.2...v1.4.0)

This version requires Go 1.18

-   Add toml.Marshal() ([#&#8203;405](BurntSushi/toml#405))

-   Require 2-digit hour ([#&#8203;320](BurntSushi/toml#320))

-   Wrap UnmarshalTOML() and UnmarshalText() return values in ParseError for position information ([#&#8203;398](BurntSushi/toml#398))

-   Fix inline tables with dotted keys inside inline arrays (e.g. `k=[{a.b=1}]`) ([#&#8203;400](BurntSushi/toml#400))

</details>

---

### Configuration

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

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

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

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzQuMyIsInVwZGF0ZWRJblZlciI6IjM3LjM3NC4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.internal/nrdufour/marmitton/pulls/31
Co-authored-by: Renovate <[email protected]>
Co-committed-by: Renovate <[email protected]>
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

2 participants