|
6 | 6 | # https://github.com/Softmotions/autark |
7 | 7 |
|
8 | 8 | META_VERSION=0.9.11 |
9 | | -META_REVISION=fa37b24 |
| 9 | +META_REVISION=5352b5e |
10 | 10 | cd "$(cd "$(dirname "$0")"; pwd -P)" |
11 | 11 |
|
12 | 12 | prev_arg="" |
@@ -68,7 +68,7 @@ cat <<'a292effa503b' > ${AUTARK_HOME}/autark.c |
68 | 68 | #ifndef CONFIG_H |
69 | 69 | #define CONFIG_H |
70 | 70 | #define META_VERSION "0.9.11" |
71 | | -#define META_REVISION "fa37b24" |
| 71 | +#define META_REVISION "5352b5e" |
72 | 72 | #define MACRO_MAX_RECURSIVE_CALLS 128 |
73 | 73 | #endif |
74 | 74 | #define _AMALGAMATE_ |
@@ -2552,18 +2552,36 @@ const char* utils_json_escape_str(const char *val, ssize_t len, struct xstr *xst |
2552 | 2552 | if (len < 0) { |
2553 | 2553 | len = strlen(val); |
2554 | 2554 | } |
2555 | | - static const char *specials = "btnvfr"; |
2556 | 2555 | xstr_cat2(xstr, "\"", 1); |
2557 | 2556 | for (size_t i = 0; i < len; ++i) { |
2558 | 2557 | uint8_t ch = (uint8_t) val[i]; |
2559 | | - if (ch == '"' || ch == '\\') { |
2560 | | - xstr_cat2(xstr, "\\", 1); |
2561 | | - xstr_cat2(xstr, &ch, 1); |
2562 | | - } else if (ch >= '\b' && ch <= '\r') { |
2563 | | - xstr_cat2(xstr, "\\", 1); |
2564 | | - xstr_cat2(xstr, &specials[ch - '\b'], 1); |
2565 | | - } else { |
2566 | | - xstr_cat2(xstr, &ch, 1); |
| 2558 | + switch (ch) { |
| 2559 | + case '"': |
| 2560 | + case '\\': |
| 2561 | + xstr_cat2(xstr, "\\", 1); |
| 2562 | + xstr_cat2(xstr, &ch, 1); |
| 2563 | + break; |
| 2564 | + case '\b': |
| 2565 | + xstr_cat(xstr, "\\b"); |
| 2566 | + break; |
| 2567 | + case '\t': |
| 2568 | + xstr_cat(xstr, "\\t"); |
| 2569 | + break; |
| 2570 | + case '\n': |
| 2571 | + xstr_cat(xstr, "\\n"); |
| 2572 | + break; |
| 2573 | + case '\f': |
| 2574 | + xstr_cat(xstr, "\\f"); |
| 2575 | + break; |
| 2576 | + case '\r': |
| 2577 | + xstr_cat(xstr, "\\r"); |
| 2578 | + break; |
| 2579 | + default: |
| 2580 | + if (ch < 0x20) { |
| 2581 | + xstr_printf(xstr, "\\u%04x", ch); |
| 2582 | + } else { |
| 2583 | + xstr_cat2(xstr, &ch, 1); |
| 2584 | + } |
2567 | 2585 | } |
2568 | 2586 | } |
2569 | 2587 | xstr_cat2(xstr, "\"", 1); |
@@ -3019,6 +3037,9 @@ const char* path_is_prefix_for(const char *prefix, const char *path, const char |
3019 | 3037 | return 0; |
3020 | 3038 | } |
3021 | 3039 | const char *p = path + len; |
| 3040 | + if (*p == '\0') { |
| 3041 | + return p; |
| 3042 | + } |
3022 | 3043 | if (*p == '/') { |
3023 | 3044 | while (*p == '/') ++p; |
3024 | 3045 | return p; |
@@ -3598,11 +3619,7 @@ bool deps_cur_is_outdated(struct node *n, struct deps *d) { |
3598 | 3619 | return strcmp(val, d->resource) != 0; |
3599 | 3620 | } |
3600 | 3621 | case DEPS_TYPE_FILE_NOT_EXISTS: { |
3601 | | - struct akpath_stat st; |
3602 | | - if (path_stat(d->resource, &st) || st.ftype == AKPATH_NOT_EXISTS) { |
3603 | | - return true; |
3604 | | - } |
3605 | | - break; |
| 3622 | + return !access(d->resource, F_OK); |
3606 | 3623 | } |
3607 | 3624 | case DEPS_TYPE_OUTDATED: |
3608 | 3625 | return true; |
@@ -3780,7 +3797,10 @@ int fetchreg_register(struct fetchreg *r, const struct fetcherg_entry *entry) { |
3780 | 3797 | return AK_ERROR_INVALID_ARGS; |
3781 | 3798 | } |
3782 | 3799 | long int old_pos = ftell(r->f); |
3783 | | - if (fseek(r->f, SEEK_END, 0) == -1) { |
| 3800 | + if (old_pos < 0) { |
| 3801 | + return errno; |
| 3802 | + } |
| 3803 | + if (fseek(r->f, 0, SEEK_END) == -1) { |
3784 | 3804 | return errno; |
3785 | 3805 | } |
3786 | 3806 | if (entry->target) { |
@@ -5322,12 +5342,10 @@ static void _cc_deps_MMD_add(struct node *n, struct deps *deps, const char *src, |
5322 | 5342 | break; |
5323 | 5343 | } |
5324 | 5344 | char *sp = p; |
5325 | | - char *ep = sp; |
5326 | 5345 | while (*p != '\0' && !utils_char_is_space(*p)) { |
5327 | | - ep = p; |
5328 | 5346 | ++p; |
5329 | 5347 | } |
5330 | | - if (ep > sp) { |
| 5348 | + if (p > sp) { |
5331 | 5349 | if (*p != '\0') { |
5332 | 5350 | *p = '\0'; |
5333 | 5351 | ++p; |
@@ -9467,7 +9485,7 @@ void node_resolve(struct node_resolve *r) { |
9467 | 9485 | bool env_created = false; |
9468 | 9486 | if (r->on_resolve && (r->num_deps == 0 || r->resolve_outdated.num)) { |
9469 | 9487 | if (g_env.check.log && r->n) { |
9470 | | - xstr_printf(g_env.check.log, "%s: resolved outdated outdated=%d\n", r->n->name, r->resolve_outdated.num); |
| 9488 | + xstr_printf(g_env.check.log, "%s: resolved outdated outdated=%u\n", r->n->name, r->resolve_outdated.num); |
9471 | 9489 | } |
9472 | 9490 | r->on_resolve(r); |
9473 | 9491 | if (access(deps_path_tmp, F_OK) == 0) { |
|
0 commit comments