Commit Graph

53 Commits

Author SHA1 Message Date
Jacek Sieka
2c4b889d0a Remove Nim signal handler for SIGINT (#25169)
Inside a signal handler, you cannot allocate memory because the signal
handler, being implemented with a C
[`signal`](https://en.cppreference.com/w/c/program/signal) call, can be
called _during_ a memory allocation - when that happens, the CTRL-C
handler causes a segfault and/or other inconsistent state.

Similarly, the call can happen from a non-nim thread or inside a C
library function call etc, most of which do not support reentrancy and
therefore cannot be called _from_ a signal handler.

The stack trace facility used in the default handler is unfortunately
beyond fixing without more significant refactoring since it uses
garbage-collected types in its API and implementation.

As an alternative to https://github.com/nim-lang/Nim/pull/25110, this PR
removes the most problematic signal handler, namely the one for SIGINT
(ctrl-c) - SIGINT is special because it's meant to cause a regular
shutdown of the application and crashes during SIGINT handling are both
confusing and, if turned into SIGSEGV, have downstream effects like core
dumps and OS crash reports.

The signal handlers for the various crash scenarios remain as-is - they
may too cause their own crashes but we're already going down in a bad
way, so the harm is more limited - in particular, crashing during a
crash handler corrupts `core`/crash dumps. Users wanting to keep their
core files pristine should continue to use `-d:noSignalHandler` - this
is usually the better option for production applications since they
carry more detail than the Nim stack trace that gets printed.

Finally, the example of a ctrl-c handler performs the same mistake of
calling `echo` which is not well-defined - replace it with an example
that is mostly correct (except maybe for the lack of `volatile` for the
`stop` variable).

(cherry picked from commit 41ce86b577)
2025-09-22 08:47:08 +02:00
ringabout
2d470c9afd fixes strictdefs warnings for stdlibs [part two] (#24514)
After some cleanups for stdlibs, then we should enable warningaserror
for all tests

(cherry picked from commit c0861142f8)
2025-01-14 13:15:55 +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
Andrey Makarov
19ff746916 Markdown code blocks migration part 7 (#20547) 2022-10-12 16:13:43 +02: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
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
Danil Yarantsev
56461c280f Change stdlib imports to use std prefix in most examples (#17202) 2021-02-28 13:17:19 -08:00
flywind
f140c92409 fix some warnings (#16952) 2021-02-08 13:50:15 +01:00
Juan Carlos
78a99587a4 Deprecate TaintedString (#15423)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
2021-01-15 18:56:38 -08:00
Mildred Ki'Lya
71db2be833 Improve uri.parseQuery to never raise an error (#16647)
In case of malformed query string where there is `=` on the value, handle
this character as part of the value instead of throwing an error.

The following query string should no longer crash a program:

    key=value&key2=x=1

It will be interpreted as [("key", "value"), ("key2", "x=1")]

This is correct according to latest WhatWG's HTML5 specification
recarding the urlencoded parser:
https://url.spec.whatwg.org/#concept-urlencoded-parser

Older behavior can be restored using the -d:nimLegacyParseQueryStrict
flag.
2021-01-12 13:42:05 +01:00
flywind
e718a4a058 follow #15860 clean cgi module (#16487)
* follow #15860  clean cgi module

* follow #15860  clean cgi module
2020-12-27 19:46:21 +01:00
flywind
689504081f follow #15357 and move decodeQuery (#15860)
* follow #15357 and move decodeQuery
* solve problem one
* minor
* deprecate decodeData
* add changelog and since
* add testcase for decodeQuery
2020-12-27 11:59:32 +01:00
flywind
139075e965 move decode_helpers to std/private (#16209) 2020-12-02 10:30:55 -08:00
Andreas Rumpf
ebb632ccba fixes #15369 (#15371) 2020-09-20 01:07:13 +02:00
Miran
c62513049c fix #14082, don't crash on incorrectly formatted input (#14977) [backport]
* fix #14082, don't crash on incorrectly formatted input

* address code review

* remove duplication
2020-07-17 10:59:53 +02:00
narimiran
5732bb41ef [backport] run nimpretty on the remaining files 2019-09-30 13:58:17 +02:00
Gérôme Fournier
181350f6c9 Fix out of bound access in cgi module (#11578)
When an HTTP request with a zero CONTENT_LENGTH is made,
attempting to access addr(result[0]) raise an exception as the 0 index
is out of bound
2019-06-25 02:03:44 +02:00
Miran
214f48eae9 Remove long deprecated stuff (#10332) 2019-01-18 07:18:32 +01:00
Konstantin Molchanov
d5e113c3a6 Add readData proc that accepts a string. 2018-11-07 11:26:51 +01:00
Araq
64517445ea even more strict isNil handling for strings/seqs in order to detect bugs 2018-08-22 12:35:46 +02:00
Araq
bbb0fd4eb7 remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
Andreas Rumpf
39b81c836c cgi module: don't depent on the terminating zero 2018-04-29 01:18:26 +02:00
Veladus
27ea1750e5 Moved encodeUrl and decodeUrl from cgi to url 2017-11-25 16:55:10 +01:00
Andreas Rumpf
58187f2120 added a warning that the .deprecate statement is unreliable for routines 2017-11-21 11:27:35 +01:00
Araq
8be9e46403 udpated the compiler and tester to use getOrDefault 2015-10-13 14:10:33 +02:00
patrick dw
15e7fe787a renamed writeln to writeLine in lib 2015-06-19 01:02:22 -05:00
Araq
9500780037 renamed URLencode to encodeUrl 2014-09-10 23:25:29 +02:00
Dominik Picheta
055ed5149f Add depraction warnings for URLencode/decode. 2014-09-10 00:42:40 +01:00
Dominik Picheta
205b765fdd Fixes case in cgi module. 2014-09-10 00:01:32 +01:00
Araq
d05df2173b Nimrod renamed to Nim 2014-08-28 09:50:51 +02:00
Araq
bae9a0ceac more modules updated 2014-08-28 01:30:12 +02:00
Araq
11b6958755 big rename 2014-08-27 23:42:51 +02:00
Araq
2f43fdb837 renamefest 2014-08-23 01:43:49 +02:00
Araq
e6d17e6273 made large parts of the stdlib gcsafe 2014-04-20 20:01:24 +02:00
Araq
3e25d5f247 merged better html links #850 2014-04-08 01:19:15 +02:00
Michał Zieliński
74a63c004f Rework CGI error reporting.
- remove 'undocumented' stackTraceNL
- add 'undocumented' errorMessageWriter
- make printing errors for browser optional (for security)
2013-12-18 18:15:39 +01:00
Grzegorz Adam Hankiewicz
72a3e21f28 Removes executable bit for text files. 2013-03-16 23:53:07 +01:00
Araq
0cac8d9b6f made tests green again 2012-08-16 19:05:38 +02:00
Araq
f0172b0a5f exported strutils.abbrev 2012-02-24 19:19:13 +01:00
Araq
0f37d0e1f2 sockets.recv optimizations; stdlib now supports taint mode 2011-09-24 20:22:53 +02:00
Araq
6023e994fb beginning of a taint mode; type system enhancements 2011-09-24 00:46:41 +02:00
Keita Haga
9da77eb5cb lib/pure/cgi.nim: fix typo 'passwort' instead of 'password' 2011-08-17 02:08:49 +09:00
Araq
d2e2d71d05 newStringOfCap implemented and used to optimize some procs 2011-05-08 17:38:34 +02:00
Araq
adf13aaea3 docgen understands and ignores *when false* 2010-11-18 22:26:20 +01:00
Araq
d11a62af31 bugfix: httpclient 2010-10-30 19:13:35 +02:00
Andreas Rumpf
40ea1d0330 fixed pango/pangoutils new wrappers 2010-02-26 01:26:16 +01:00
rumpf_a@web.de
40a5d6c3b9 continued work on html/xmlparser 2010-02-14 00:29:35 +01:00
Andreas Rumpf
8259d9d15a wrappers do not contain invalid identifiers 2010-01-17 22:19:10 +01:00
Andreas Rumpf
fb2ae12c49 sockets module complete 2010-01-13 00:38:39 +01:00
Andreas Rumpf
2169fd63bd version 0.8.6 2009-12-22 01:28:20 +01:00