21 Commits

Author SHA1 Message Date
ringabout
c0861142f8 fixes strictdefs warnings for stdlibs [part two] (#24514)
After some cleanups for stdlibs, then we should enable warningaserror
for all tests
2024-12-06 05:40:48 +01:00
ringabout
4d11d0619d complete std prefixes for stdlib (#22887)
follow up https://github.com/nim-lang/Nim/pull/22851
follow up https://github.com/nim-lang/Nim/pull/22873
2023-10-30 17:03:04 +01:00
ringabout
3f7e1d7daa replace doAssert false with raiseAssert in lib, which works better with strictdefs (#22458) 2023-08-11 18:24:46 +02:00
metagn
02be212dae clean up SOME pending/xxx/issue link comments (#21826)
* clean up SOME pending/xxx/issue link comments

* great
2023-05-11 10:23:52 +02:00
ringabout
135b677704 fixes nightlies regression (#21689)
* fixes nightlies regression

ref https://github.com/nim-lang/Nim/pull/21659
ref https://github.com/nim-lang/nightlies/actions/runs/4727252660/jobs/8387899690

> /home/runner/work/nightlies/nightlies/nim-1.9.3/lib/std/sysrand.nim(198, 12) Error: cannot evaluate at compile time: EINTR

Because EINTR is not a const on i386

* Update lib/std/sysrand.nim
2023-04-19 11:56:12 +02:00
metagn
b0a98cc01e warn on set types bigger than max size, default to 0..255 for int literals (#21659)
* test implicitly huge set types

refs https://github.com/nim-lang/RFCs/issues/298

* oh my god

* boot at least

* don't error, fix remaining issues, no 2 len arrays

* fix runnable example

* test assuming 0..255 for int literal

* test refactor, add changelog, test
2023-04-17 20:55:22 +02:00
ringabout
6166b796ba refactor os imports into corresponding small modules (#20720) 2022-11-01 10:18:04 +01:00
Matt Haggard
594e93a66b macOS use SecRandomCopyBytes instead of getentropy (#20466)
* On macOS use SecRandomCopyBytes instead of getentropy (which is only available on macOS 10.12+)

* Change passL to passl
2022-10-05 13:59:10 -04:00
ringabout
3d2f0e2c7c make more standard libraries work with nimPreviewSlimSystem (#20343)
* make more standard libraries work with `nimPreviewSlimSystem`

* typo

* part two

* Delete specutils.nim

* fixes more tests

* more fixes

* fixes tests

* fixes three more tests

* add formatfloat import

* fix

* last
2022-09-27 20:06:23 +02:00
Jacek Sieka
ad0aee5354 sysrand: fix syscall signature [backport] (#19982)
sysrand: fix syscall signature

`syscall` is a `C` varags function
2022-07-07 21:26:58 +08:00
Jaremy Creechley
6976d18519 Implement zephyr urandom and monotime (#19142)
* implement urandom for Zephyr

* add monotime on zephyr

Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
2021-11-14 12:49:30 +01:00
Anuken
270a5a372d Fix undeclared 'SYS_getrandom' on emscripten (#19144) 2021-11-13 19:09:15 -05:00
Timothy Alexander
dde556665a Fix #19052; [backport:1.6.0] (#19053)
* Fix #19052; [backport:1.6.0]

Adds a compile flag to avoid a getrandom syscall, fixing #19052.

This is neccesary when the getrandom syscall is missing, as noted in #19052, particularly in kernel versions < 3.17 when getrandom was introduced. Specifically relevant is this is missing from kernel 3.10, which is the supported kernel throughout RHEL 7 and CentOS 7, which is widely used at many organizations. Without this, versions of nim that include sysrand (i.e. versions >= 1.6.0) will not compile without modification, however with this change a compile flag may be used to fall back using /dev/urandom as done with any unknown Posix OS (preferred here as a fallback since it already supplies a cryptographically secure PRNG and existing code deals with entropy pool init, etc).

The change is placed behind a compile flag, as discussed in github ticket #19052 (summed up here):
* First, I can't seem to catch that a importc such as SYS_getrandom is declared without using it (the declared proc returns true, but compiler throws an undeclared identifier flag when referencing it).
* Second, it seemed preferable to be behaviorally explicit vs implicit when considering this is intended to be a cryptographically secure PRNG.
* Third, if I intend to compile on a kernel >= 3.17 while running the binary on at least one system < 3.17, I'll want to be able to target this without relying on a compile time determination if the getrandom syscall is available.

* Documenting compile flag for -d:nimNoGetRandom and adding changelog entry
Related to #19052 and comments in PR #19053. Also created a new changelog file since none currently exists.

Co-authored-by: Timothy Alexander <talexander@midwestlabs.com>
2021-10-26 20:32:52 +02:00
Andreas Rumpf
96a7f9b31c deprecate cuchar, don't redefine it (#18505) 2021-07-16 15:50:02 +02:00
Andreas Rumpf
a9b62de895 CIs: attempt to use csources_v1 (#16282)
* CIs: attempt to use csources_v1
* also updated the BSDs
* also updated azure pipelines
* std modules should not itself use the 'std/' import dir...
* compiler has to be careful with std/ for v1 booting
2021-04-21 07:41:33 +02:00
konsumlamm
9f0f477552 Update sysrand documentation (#17676)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-04-08 12:41:43 -05:00
flywind
51a04a3674 make std/sysrand better (#17360) 2021-03-15 14:07:27 +01:00
flywind
60ec3e2417 add warnings to std/sysrand (#17191)
* remove unnecessary when statement

* remove outdated codes

* add warnings to std/sysrand

* Update lib/std/sysrand.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-02-26 20:06:20 +01:00
Timothee Cour
f455e03028 fix #17078 csources generation (#17079)
* fix #17078 csources generation

* fixup
2021-02-18 07:00:51 +01:00
flywind
4f118721be make system random work in VM (#17059)
* make system random work in VM
2021-02-17 11:52:46 +01:00
flywind
18c24eb4d0 add system random to stdlib: std/sysrand (#16459) 2021-02-11 16:00:01 -08:00