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

Unparsed Version #7

Closed
kassane opened this issue Mar 28, 2024 · 0 comments
Closed

Unparsed Version #7

kassane opened this issue Mar 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kassane
Copy link
Owner

kassane commented Mar 28, 2024

v5.1.3-416-gd23b7a0361 unparsed version.

CI: https://github.com/georgik/esp32-lang-lab/actions/runs/8466882009/job/23196614994#step:4:1478

PANIC: caused by InvalidCharacter - timestamp: 1073423880l

Impl:

// skip [0] == 'v' and remove [idf_version.len - 4] == "-dev"
var it = if (std.mem.endsWith(u8, idf_version, "-dev"))
std.mem.split(u8, idf_version[1 .. idf_version.len - 4], ".")
else
std.mem.split(u8, idf_version[1..], ".");
final_version.major = std.fmt.parseUnsigned(u32, it.first(), 10) catch |err|
@panic(@errorName(err));
while (it.next()) |token| {
if (!std.ascii.isDigit(token[0]))
continue;
const digit = std.fmt.parseUnsigned(u32, token, 10) catch |err|
@panic(@errorName(err));
if (digit != final_version.minor and final_version.minor == 0) {
final_version.minor = digit;
continue;
}
if (digit != final_version.patch)
final_version.patch = digit;
}
return final_version;
}

Reference

@kassane kassane added the bug Something isn't working label Mar 28, 2024
@kassane kassane changed the title Invalid version parser Unparsed Version Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant