mirror of
https://github.com/gbdev/rgbds.git
synced 2026-05-08 10:59:36 +00:00
SOURCE_DATE_EPOCH must be in base 10
This commit is contained in:
+5
-3
@@ -501,9 +501,11 @@ int main(int argc, char *argv[]) {
|
||||
// https://reproducible-builds.org/docs/source-date-epoch/
|
||||
time_t now = time(nullptr);
|
||||
if (char const *sourceDateEpoch = getenv("SOURCE_DATE_EPOCH"); sourceDateEpoch) {
|
||||
// Use `strtoul`, not `parseWholeNumber`, because SOURCE_DATE_EPOCH does
|
||||
// not conventionally support our custom base prefixes
|
||||
now = static_cast<time_t>(strtoul(sourceDateEpoch, nullptr, 0));
|
||||
if (std::optional<uint64_t> epoch = parseWholeNumber(sourceDateEpoch, BASE_10); epoch) {
|
||||
now = static_cast<time_t>(*epoch);
|
||||
} else {
|
||||
warnx("Ignoring invalid `SOURCE_DATE_EPOCH` value \"%s\"", sourceDateEpoch);
|
||||
}
|
||||
}
|
||||
sym_Init(now);
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
warning: Ignoring invalid `SOURCE_DATE_EPOCH` value "0x1234"
|
||||
@@ -161,6 +161,20 @@ done
|
||||
|
||||
# These tests do their own thing
|
||||
|
||||
i="invalid-source-date-epoch"
|
||||
RGBASMFLAGS="-Weverything -Bcollapse"
|
||||
(( tests++ ))
|
||||
echo "${bold}${green}${i}...${rescolors}${resbold}"
|
||||
SOURCE_DATE_EPOCH=0x1234 "$RGBASM" $RGBASMFLAGS /dev/null >"$output" 2>"$errput"
|
||||
tryDiff /dev/null "$output" out
|
||||
our_rc=$?
|
||||
tryDiff invalid-source-date-epoch.err "$errput" err
|
||||
(( our_rc = our_rc || $? ))
|
||||
(( rc = rc || our_rc ))
|
||||
if [[ $our_rc -ne 0 ]]; then
|
||||
(( failed++ ))
|
||||
fi
|
||||
|
||||
evaluateDepTest () {
|
||||
i="$1"
|
||||
RGBASMFLAGS="-Weverything -Bcollapse -M -"
|
||||
|
||||
Reference in New Issue
Block a user