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

Dependency on GNU date command #49

Open
dverite opened this issue Oct 3, 2024 · 0 comments
Open

Dependency on GNU date command #49

dverite opened this issue Oct 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dverite
Copy link
Collaborator

dverite commented Oct 3, 2024

scripts/bats/test/libs/partitions.bash (in the test suite invoked with make bats-test) uses code like the following:

  local LOWER_BOUND=$(date -d "@$(( $(date +%s) + 86400 * $TIMEDELTA))" +"%Y-%m-%d")
  local UPPER_BOUND=$(date -d "@$(( $(date +%s) + 86400 * $TIMEDELTA + 86400))" +"%Y-%m-%d")
...
  echo $(date -d "@$(( $(date +%s) + 86400 * $TIMEDELTA))" +"${PARENT_TABLE}_%Y_%m_%d")

This is problematic on MacOS local development since the -d option is specific to GNU date and does not work with MacOS date built-in command, making the test fail.

MacOS users can install GNU date through the coreutils package as described on apple.stackexchange.com in How to have GNU's date in OS X?, but it would be better to remove that dependency.

The code adds or substracts N days to the current date and produces a result in YYYY-MM-DD format.

@dverite dverite added the bug Something isn't working label Oct 3, 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