Commit Graph

29002 Commits

Author SHA1 Message Date
andrewkraevskii
f7a76bdfe3 autodoc: fix tokenizer 2024-04-10 20:44:10 -07:00
Andrew Kelley
7fb5a0b18b introduce std.Build.path; deprecate LazyPath.relative
This adds the *std.Build owner to LazyPath so that lazy paths returned
from a dependency can be used in the application without friction or
footguns.

closes #19313
2024-04-10 15:02:20 -07:00
Jacob Young
c4587dc9f4 Uri: propagate per-component encoding
This allows `std.Uri.resolve_inplace` to properly preserve the fact
that `new` is already escaped but `base` may not be.  I originally tried
just moving `raw_uri` around, but it made uri resolution unmanagably
complicated, so I instead added per-component information to `Uri` which
allows extra allocations to be avoided when constructing uris with
components from different sources, and in some cases, deferring the work
all the way to when the uri is printed, where an allocator may not even
be needed.

Closes #19587
2024-04-10 02:11:54 -07:00
Andrew Kelley
215de3ee67
Merge pull request #19500 from ianic/package_filter_errors
package manager: filter unpack errors on paths excluded by manifest
2024-04-09 13:22:48 -07:00
Andrew Kelley
fc17402919
std.crypto.Certificate: support 3072 bits RSA certificate (#19591)
Used by musicbrainz.org API.
2024-04-09 12:16:45 -07:00
Frank Denis
9d27f34d04
crypto.sha3: implement constructions from NIST SP 800-185 (#19533)
https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-185.pdf

This adds useful standard SHA3-based constructions from the
NIST SP 800-185 document:

- cSHAKE: similar to the SHAKE extensible hash function, but
with the addition of a context parameter.
- KMAC: SHAKE-based authentication / keyed XOF
- TupleHash: unambiguous hashing of tuples

These are required by recent protocols and specifications.

They also offer properties that none of the currently available
constructions in the stdlib offer, especially the ability to safely
hash tuples.

Other keyed hash functions/XOFs will fall back to using HMAC, which
is suboptimal from a performance perspective, but fine from a
security perspective.
2024-04-09 12:16:19 -07:00
Igor Anić
4151e6c31b fetch: use arena allocator for diagnostic/UnpackResult
Reference:
https://github.com/ziglang/zig/pull/19500#discussion_r1556476973

Arena is now used for Diagnostic (tar and git). `deinit` is not called on Diagnostic
allowing us to reference strings from Diagnostic in UnpackResult without
dupe.

That seamed reasonable to me. Instead of using gpa for Diagnostic, and
then dupe to arena. Or using arena for both and making dupe so we can deinit
Diagnostic.
2024-04-09 15:00:22 +02:00
Igor Anić
f8dd2a1064 fetch: add executable bit test 2024-04-09 15:00:22 +02:00
Igor Anić
8c58b8fe01 fetch: refactor package root in errors
Use stripRoot in less places. Strip it while copying error from
diagnostic to unpack result so other palaces can be free of this logic.
2024-04-09 15:00:22 +02:00
Igor Anić
b422e4a202 fetch: save test cases
Prepare test cases, store them in Fetch/testdata.
They cover changes in this PR as well from previous one #19111.
2024-04-09 15:00:22 +02:00
Igor Anić
3d5a9237f7 fetch: use empty string instead of null for root_dir
Make it consistent with Cache.Path sub_path.
Remove null check in many locations.
2024-04-09 15:00:22 +02:00
Igor Anić
5f0b434f90 fetch: remove root_dir from error messages
To be consistent with paths in manifest.
2024-04-09 15:00:22 +02:00
Igor Anić
22e9c50376 fetch: fix test tarball
Should include folder structure, at least root folder so it can be found
in pipeToFileSystem.
2024-04-09 15:00:21 +02:00
Igor Anić
fc745fb05c fetch: remove test with mount and net dependencies 2024-04-09 15:00:21 +02:00
Igor Anić
84fac2242c fix zig fmt 2024-04-09 15:00:21 +02:00
Igor Anić
dc61c2e904 add comments 2024-04-09 15:00:21 +02:00
Igor Anić
373d48212f fetch: add pathological packages test
Using test cases from:
https://github.com/ianprime0509/pathological-packages repository.
Depends on existence of the FAT32 file system. Folder is in FAT32 file
system because it is case insensitive and and does not support symlinks.

It is complicated test case requires internet connection, depends on
existence of FAT32 in the specific location. But it is so valuable for
development. Running `zig test Package.zig` is so much faster than
building zig binary and running `zig fetch URL`. Committing it here
although it should probably be removed.
2024-04-09 15:00:21 +02:00
Igor Anić
5a38924a7d fetch.git: collect file create diagnostic errors
On case insensitive file systems, don't overwrite files with same name
in different casing. Add diagnostic error so caller could decide what to do.
2024-04-09 15:00:21 +02:00
Igor Anić
ad60b6c1ed fetch: update comments 2024-04-09 15:00:21 +02:00
Igor Anić
dfec4918a3 fetch: remove absolute path from tests 2024-04-09 15:00:21 +02:00
Igor Anić
4d6a7e074b fetch: filter unpack errors
Report only errors which are not filtered by paths in build.zig.zon.
2024-04-09 15:00:21 +02:00
Igor Anić
a0790914b4 fetch: return UnpackResult from unpackResource
Test that we are still outputing same errors.
2024-04-09 15:00:21 +02:00
Igor Anić
b3339f3cd5 tar: store diagnostic errors into UnpackResult
Test that UnpackResult prints same error output as diagnostic.
2024-04-09 15:00:21 +02:00
Igor Anić
9e47857ae9 fetch: make failing test 2024-04-09 15:00:21 +02:00
Andrew Kelley
ac21ade667
Merge pull request #19572 from jacobly0/haiku-bootstrap
haiku: get cmake bootstrap working
2024-04-09 00:50:58 -07:00
Jakub Konka
bc0e2089bc link/elf: do not set soname unless only dynlib (reverts for haiku exec) 2024-04-08 22:20:49 +02:00
Jakub Konka
84a0110464 link/elf: handle symbols to begin/end of .eh_frame section 2024-04-08 22:09:49 +02:00
Jakub Konka
9875ab4ee8 link/elf: actually emit DYN when targetting haiku 2024-04-08 20:54:54 +02:00
Jacob Young
b66fd87a4c update zig1.wasm
Fixes cbe bugs affecting bootstrap.
2024-04-08 13:24:08 -04:00
Jacob Young
7611d90ba0 InternPool: remove slice from byte aggregate keys
This deletes a ton of lookups and avoids many UAF bugs.

Closes #19485
2024-04-08 13:24:08 -04:00
Jakub Konka
4cd92567e7 link/elf: propagate Haiku requirement of always passing -shared for images 2024-04-08 13:24:08 -04:00
Jacob Young
b98e3bee2b haiku: default to single threaded to work around tls bugs 2024-04-08 13:20:14 -04:00
Jacob Young
3f1f05011e haiku: fix abi and dynamic linker detection 2024-04-08 13:20:14 -04:00
Jacob Young
fcdb7027e9 haiku: fix linking issues 2024-04-08 13:20:14 -04:00
Jacob Young
0c83fa2fd0 haiku: fix directory iteration 2024-04-08 13:20:14 -04:00
Jacob Young
23ee39116c cbe: fix struct field location computation 2024-04-08 13:20:13 -04:00
Jacob Young
d979df585d cbe: remove threadlocal variables in single threaded mode 2024-04-08 13:20:02 -04:00
Andrew Kelley
fbb38a7682 std.Build: fix regression in Step.ConfigHeader
Commit 0b7123f41d regressed the
`include_path` option of ConfigHeader which is intended to set the path,
including subdirectories, that C code would pass to an include
directive.

For example if it passes

    .include_path = "config/config.h",

Then the C code should be able to have

    #include "config/config.h"

This regressed https://github.com/andrewrk/nasm/ but this commit fixes
it.
2024-04-08 07:11:18 -07:00
Ian Johnson
6dcbad780c
Autodoc: fix Markdown indented lists (#19577)
Previously, indentation was not being handled correctly in some cases,
causing examples such as `std.json.WriteStream` to be rendered with
improper list nesting.

Additionally, some more test cases have been added to ensure
indentation (or lack of indentation) is handled correctly in some other
constructs.
2024-04-08 09:49:22 +00:00
Andrew Kelley
355cceebc7
Merge pull request #18920 from castholm/fmtId
`std.zig.fmtId`: conditionally escape primitives/`_` (breaking)
2024-04-07 19:22:35 -07:00
Andrew Kelley
1b27146792
Merge pull request #18590 from castholm/move-standalone-test-cases
std.Build: Remove `anonymousDependency`
2024-04-07 16:08:23 -07:00
Carl Åstholm
e5bf1a5d50 Make std.Build.dependencyInner private 2024-04-07 16:06:20 -07:00
Carl Åstholm
ef90d3af54 Remove std.Build.anonymousDependency 2024-04-07 16:06:19 -07:00
Carl Åstholm
09f1bbe11b std.Build: Remove unused c_std field
This field has not been referenced by compile steps since
e76ce2c1d0, all the way back in 2019.
To specify the language standard, pass `-std=[value]` as a regular
C flag instead.
2024-04-07 16:06:15 -07:00
Carl Åstholm
5d5e89aa8d Promote linker test cases to packages 2024-04-07 16:05:54 -07:00
Carl Åstholm
33b8fdb6bc Turn "simple" standalone test cases into a package 2024-04-07 16:05:54 -07:00
Carl Åstholm
c3ecc6972e Don't add standalone test cases until we've built stage3 2024-04-07 16:05:54 -07:00
Carl Åstholm
d6ecfa7025 Move "simple" standalone test cases to a new directory 2024-04-07 16:05:54 -07:00
Carl Åstholm
3ed221f149 Promote standalone test cases to packages
This is a prerequisite for removing `b.anonymousDependency()`, but
having compiler tests dogfood package management might be a good idea
in general.
2024-04-07 16:05:53 -07:00
Carl Åstholm
05126fc4c5 std.Build: add dependencyFromBuildZig 2024-04-07 15:54:30 -07:00