seL4 / seL4-CAmkES-L4v-dockerfiles

Dockerfiles defining the dependencies required to build seL4, CAmkES, and L4v.
13 stars 40 forks source link

MacOS date command has different arguments and breaks docker image age checking #17

Closed micheloosterhof closed 4 years ago

micheloosterhof commented 4 years ago

This module does not work on MacOS the date command has different flags than Linux.

:; make user
# Figure out if any trustworthy systems docker images are potentially too old
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... 
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
/bin/sh: ( 1587977226 -  ) / (60*60*24) : syntax error: operand expected (error token is ") / (60*60*24) ")
make: *** [run_checks] Error 127
LukeMondy commented 4 years ago

Can you run:

docker images

and also

docker inspect --format='{{json .Created}}' trustworthysystems/camkes

(assuming you have that particular image trustworthysystems/camkes - sub in any other trustworthysystems/ image if not.

and finally, try running:

date --date=2020-04-25T18:44:40.822475865Z +%s

and let me know the results of each?

micheloosterhof commented 4 years ago
:; docker images
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
trustworthysystems/sel4     latest              1ef2c5921950        4 days ago          2.87GB
user_img-michel             latest              44767d3ce9a6        6 days ago          6.58GB
extras                      latest              4a0fbdf64efc        6 days ago          6.58GB
trustworthysystems/camkes   latest              38bc983beee2        6 days ago          6.32GB
trustworthysystems/sel4     <none>              ab2964507f41        6 days ago          2.87GB
:; docker inspect --format='{{json .Created}}' trustworthysystems/camkes
"2020-04-24T05:01:05.040785167Z"
:; date --date=2020-04-25T18:44:40.822475865Z +%s
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... 
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
LukeMondy commented 4 years ago

hmm, that is a pain.

I've put up a PR on our internal SCM to check if the date command is compatible with this use. In the PR, if it is not compatible, it will just skip this check with a warning.

Not ideal, but at least it avoids crashing behavior. The PR also moves the checks from the Makefile to a bash script, so adding more complex behavior should be much easier in the future. I will try to get a Mac setup somewhere, so I can do some better testing.

micheloosterhof commented 4 years ago

Thanks! I agree, avoiding the crash is preferred behaviour. I'm sure the test for age check can be rewritten in a more platform independent way.

LukeMondy commented 4 years ago

This is 'fixed' in this commit: https://github.com/SEL4PROJ/seL4-CAmkES-L4v-dockerfiles/commit/02c017b36263336f2c488324dcd52c2bc7063ac8 I have fixed in inverted commas, because it just does a quick check to see if the date command behaves as expected, and if not, will skip the check.