A modern, delicious implementation of the Nix package manager, focused on correctness, usability, and growth — and committed to doing right by its community
Find a file
Jade Lovelace ffbad9b762 progress-bar.cc: fix signed overflow
this was caused by the use of std::chrono::duration::max() which gets
multiplied by some ratio to calculate nanoseconds to wait. then, it
explodes because that is a signed integer overflow. this was definitely
a bug.

error below:

/nix/store/fdiknsmnnczx6brsbppyljcs9hqckawk-gcc-12.3.0/include/c++/12.3.0/bits/chrono.h:225:38: runtime error: signed integer overflow: 9223372036854775807 * 1000000 cannot be represented in type 'long'
    #0 0x736d376b2b69 in std::chrono::duration<long, std::ratio<1l, 1000000000l>> std::chrono::__duration_cast_impl<std::chrono:
:duration<long, std::ratio<1l, 1000000000l>>, std::ratio<1000000l, 1l>, long, false, true>::__cast<long, std::ratio<1l, 1000l>>(
std::chrono::duration<long, std::ratio<1l, 1000l>> const&) /nix/store/fdiknsmnnczx6brsbppyljcs9hqckawk-gcc-12.3.0/include/c++/12
.3.0/bits/chrono.h:225:38
    #1 0x736d376b2b69 in std::enable_if<__is_duration<std::chrono::duration<long, std::ratio<1l, 1000000000l>>>::value, std::chr
ono::duration<long, std::ratio<1l, 1000000000l>>>::type std::chrono::duration_cast<std::chrono::duration<long, std::ratio<1l, 10
00000000l>>, long, std::ratio<1l, 1000l>>(std::chrono::duration<long, std::ratio<1l, 1000l>> const&) /nix/store/fdiknsmnnczx6brs
bppyljcs9hqckawk-gcc-12.3.0/include/c++/12.3.0/bits/chrono.h:270:9
    #2 0x736d376b2b69 in std::enable_if<__is_duration<std::chrono::duration<long, std::ratio<1l, 1000000000l>>>::value, std::chr
ono::duration<long, std::ratio<1l, 1000000000l>>>::type std::chrono::ceil<std::chrono::duration<long, std::ratio<1l, 1000000000l
>>, long, std::ratio<1l, 1000l>>(std::chrono::duration<long, std::ratio<1l, 1000l>> const&) /nix/store/fdiknsmnnczx6brsbppyljcs9
hqckawk-gcc-12.3.0/include/c++/12.3.0/bits/chrono.h:386:14
    #3 0x736d376b2b69 in std::cv_status std::condition_variable::wait_for<long, std::ratio<1l, 1000l>>(std::unique_lock<std::mut
ex>&, std::chrono::duration<long, std::ratio<1l, 1000l>> const&) /nix/store/fdiknsmnnczx6brsbppyljcs9hqckawk-gcc-12.3.0/include/
c++/12.3.0/condition_variable:164:6
    #4 0x736d376b1ee9 in std::cv_status nix::Sync<nix::ProgressBar::State, std::mutex>::Lock::wait_for<long, std::ratio<1l, 1000
l>>(std::condition_variable&, std::chrono::duration<long, std::ratio<1l, 1000l>> const&) /home/jade/lix/lix/src/libutil/sync.hh:
65:23
    #5 0x736d376b1ee9 in nix::ProgressBar::ProgressBar(bool)::'lambda'()::operator()() const /home/jade/lix/lix/src/libmain/prog
ress-bar.cc:99:27
    #6 0x736d36de25c2 in execute_native_thread_routine (/nix/store/a3zlvnswi1p8cg7i9w4lpnvaankc7dxx-gcc-12.3.0-lib/lib/libstdc++
.so.6+0xe05c2)
    #7 0x736d36b6b0e3 in start_thread (/nix/store/1zy01hjzwvvia6h9dq5xar88v77fgh9x-glibc-2.38-44/lib/libc.so.6+0x8b0e3) (BuildId
: 287831bffdbdde0ec25dbd021d12bdfc0ab9f5ff)
    #8 0x736d36bed5e3 in __clone (/nix/store/1zy01hjzwvvia6h9dq5xar88v77fgh9x-glibc-2.38-44/lib/libc.so.6+0x10d5e3) (BuildId: 28
7831bffdbdde0ec25dbd021d12bdfc0ab9f5ff)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /nix/store/fdiknsmnnczx6brsbppyljcs9hqckawk-gcc-12.3.0/include/c++/12.3.
0/bits/chrono.h:225:38 in

Change-Id: Ia0303242cdfd5d49385ae9e99718d709625a4633
2024-03-27 22:56:04 -07:00
.github issue template: use nix --version instead of nix-env --version 2024-03-25 12:59:30 -06:00
clang-tidy clang-tidy check infrastructure 2024-03-18 16:10:29 -07:00
config
contrib
doc Enable clang build timing analysis 2024-03-27 03:52:57 +00:00
m4 Merge pull request #6258 from obsidiansystems/gcc-bug-ergonomics 2024-03-04 05:24:33 +01:00
maintainers Enable clang build timing analysis 2024-03-27 03:52:57 +00:00
meson build: optionally build and install with meson 2024-03-22 08:36:50 -06:00
misc Enable clang build timing analysis 2024-03-27 03:52:57 +00:00
mk Merge "Backport PR#10204 by 9999years: Replace foo with __NIX_STR in cxx-big-literal" into main 2024-03-14 00:07:21 -06:00
perl Merge pull request #9152 from obsidiansystems/split-out-perl-nix 2024-03-04 04:37:44 +01:00
scripts Restore system-install profile files from the previous installer 2024-03-25 04:17:14 +00:00
src progress-bar.cc: fix signed overflow 2024-03-27 22:56:04 -07:00
tests HOT SALE: 15% off your build times! 2024-03-27 03:52:57 +00:00
.clang-format Add clang format configuration 2024-03-18 13:31:39 -07:00
.dir-locals.el
.editorconfig
.envrc envrc: improve 2024-03-26 19:40:43 +03:00
.gitignore Enable clang build timing analysis 2024-03-27 03:52:57 +00:00
.version Update version to 2.90.0 2024-03-07 19:57:39 -07:00
boehmgc-coroutine-sp-fallback.diff Merge pull request #8887 from obsidiansystems/bsd-cross-ci 2024-03-04 04:36:04 +01:00
boehmgc-traceable_allocator-public.diff Merge pull request #9430 from hercules-ci/remove-vlas 2024-03-04 07:11:25 +01:00
configure.ac Merge pull request #9844 from NixOS/pkg-config-gmock 2024-03-04 08:47:39 +01:00
CONTRIBUTING.md Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
COPYING
default.nix
docker.nix fix "add an option to include flake-registry..." 2023-05-16 14:35:31 +02:00
flake.lock flake.nix: upgrade to nixos-23.11 2024-03-08 23:59:01 +00:00
flake.nix Enable clang build timing analysis 2024-03-27 03:52:57 +00:00
local.mk Merge pull request #9106 from Ericson2314/positive-source-filtering 2024-03-04 04:36:42 +01:00
Makefile un-ups your start 2024-03-18 18:28:08 -07:00
Makefile.config.in Merge pull request #9106 from Ericson2314/positive-source-filtering 2024-03-04 04:36:42 +01:00
meson.build Enable clang build timing analysis 2024-03-27 03:52:57 +00:00
meson.options Enable clang build timing analysis 2024-03-27 03:52:57 +00:00
package.nix build: replace changelog-d with local script 2024-03-27 03:09:14 +00:00
precompiled-headers.h
README.md
shell.nix

Nix

Open Collective supporters Test

Nix is a powerful package manager for Linux and other Unix systems that makes package management reliable and reproducible. Please refer to the Nix manual for more details.

Installation

On Linux and macOS the easiest way to install Nix is to run the following shell command (as a user other than root):

$ curl -L https://nixos.org/nix/install | sh

Information on additional installation methods is available on the Nix download page.

Building And Developing

See our Hacking guide in our manual for instruction on how to to set up a development environment and build Nix from source.

Additional Resources

License

Nix is released under the LGPL v2.1.