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

howard-hinnant-date: allow access to zoneinfo #81594

Merged
merged 1 commit into from Mar 4, 2020

Conversation

cole-h
Copy link
Member

@cole-h cole-h commented Mar 3, 2020

This fixes the situtation where, if /usr/share/zoneinfo was
inaccessible/didn't otherwise exist, howard-hinnant-date would
download and drop a ~/Downloads/tzdata directory containing some
timezone information from IANA [1]. To avoid this, we make use of the
tzdata's zoneinfo, preventing the dropping of random directories and
files.

[1] https://data.iana.org/time-zones/releases/tzdata2019c.tar.gz

Motivation for this change

This was discovered after a brief conversation on IRC with @lovesegfault who noticed ~/Downloads/tzdata was being created by... something. It was traced back to the Waybar from nixpkgs -- I could not reproduce with a Waybar built from source on my non-NixOS system, but nix-shell -p waybar --run waybar reproduced the issue perfectly.

Because howard-hinnant-date hardcodes the default timezone path to /usr/share/zoneinfo, we have to patch it to point to the zoneinfo directory of tzdata (and obviously enable the use of this "system tz db" to avoid downloading one).

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS (courtesy of @lovesegfault)
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Sorry to the unrelated reviewers requested -- I had originally touched Waybar, but that was unnecessary.

Copy link
Member

@lovesegfault lovesegfault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after the one change I outlined

pkgs/applications/misc/waybar/default.nix Outdated Show resolved Hide resolved
This fixes the situtation where, if `/usr/share/zoneinfo` was
inaccessible/didn't otherwise exist, `howard-hinnant-date` would
download and drop a `~/Downloads/tzdata` directory containing some
timezone information from IANA [1]. To avoid this, we make use of the
`tzdata`'s `zoneinfo`, preventing the dropping of random directories and
files.

[1] https://data.iana.org/time-zones/releases/tzdata2019c.tar.gz
@cole-h cole-h changed the title waybar,howard-hinnant-date: allow access to zoneinfo howard-hinnant-date: allow access to zoneinfo Mar 3, 2020
Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ Cool ✨

@worldofpeace worldofpeace merged commit d86a414 into NixOS:master Mar 4, 2020
@cole-h cole-h deleted the hhdate-use-sys-tzdb branch March 4, 2020 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants