Commit Graph

27562 Commits

Author SHA1 Message Date
vinnichase
279607cae5
Fix fmt UTF-8 characters as fill (#18533)
Co-authored-by: Jacob Young <jacobly0@users.noreply.github.com>
2024-01-13 22:47:03 -05:00
Nameless
b723296e1f std.http: add missing documentation and a few examples 2024-01-13 18:51:38 -08:00
Nameless
832f6d8f7f std.Uri: fix implementation of resolve with trailing slashes 2024-01-13 18:50:29 -08:00
Guillaume Wenzek
c5d359e4cd fix #17142, wrong comptime log_int computation 2024-01-13 18:46:16 -08:00
Andrew Kelley
d55d1e32b6
Merge pull request #18261 from ianic/tar_tests
std:tar Copy Go tar test suite and make them pass
2024-01-13 18:44:14 -08:00
Andrew Kelley
3f809cbe7d build.zig: don't install testdata 2024-01-13 19:37:33 -07:00
Igor Anić
7d3a31872e tar: improve diagnostic reporting
Using Python testtar file (mentioned in #14310) to test diagnostic
reporting.
Added computing checksum by using both unsigned and signed header bytes
values.
Added skipping gnu exteneded sparse headers while reporting unsupported
header in diagnostic.

Note on testing:

wget https://github.com/python/cpython/raw/3.11/Lib/test/testtar.tar -O
/tmp/testtar.tar

```
test "Python testtar.tar file" {
    const file_name = "testtar.tar";

    var file = try std.fs.cwd().openFile("/tmp/" ++ file_name, .{});
    defer file.close();

    var diag = Options.Diagnostics{ .allocator = std.testing.allocator };
    defer diag.deinit();

    var iter = iterator(file.reader(), &diag);
    while (try iter.next()) |f| {
        std.debug.print("supported: {} {s} {d}\n", .{ f.kind, f.name, f.size });
        try f.skip();
    }
    for (diag.errors.items) |e| {
        switch (e) {
            .unsupported_file_type => |u| {
                std.debug.print("unsupported: {} {s}\n", .{ u.file_type, u.file_name });
            },
            else => unreachable,
        }
    }
}
```
2024-01-13 19:37:33 -07:00
Igor Anić
7923a53996 tar: rename reader to iterator
Itarator has `next` function, iterates over tar files. When using from
outside of module with `tar.` prefix makes more sense.

var iter = tar.iterator(reader, null);
while (try iter.next()) |file| {
...
}
2024-01-13 19:37:33 -07:00
Igor Anić
e21a12e56b tar: use @embedFile in tests
Like in other tests which uses testdata files (compress). That enables
wasi testing also, was failing because file system operations in tests.
2024-01-13 19:37:33 -07:00
Igor Anić
76fe1f53d5 tar: fix tests on 32-bit platforms 2024-01-13 19:37:33 -07:00
Igor Anić
a75fd4ff15 tar: move test cases to std/tar/testdata
Create std/tar/test.zig for test which uses cases from testdata.
2024-01-13 19:37:33 -07:00
Igor Anić
f8e42d6b30 tar: add Go test case files to the project 2024-01-13 19:37:33 -07:00
Igor Anić
c07527abac tar: reorganize file, functions before tests 2024-01-13 19:37:33 -07:00
Igor Anić
c76abe0e18 tar: use file word in less places 2024-01-13 19:37:33 -07:00
Igor Anić
4a6d67ab1a tar: remove stratch from tar reader
Use explicit buffers for name, link_name instead.
It is cleaner that way.
2024-01-13 19:37:33 -07:00
Igor Anić
9f7dd32308 tar: refactor pax attribute
Make it little readable.
2024-01-13 19:37:33 -07:00
Igor Anić
dbab45cfc6 tar: replace custom buffered reader with std.io 2024-01-13 19:37:33 -07:00
Igor Anić
58e0e509c6 tar: add module comment and references 2024-01-13 19:37:33 -07:00
Igor Anić
a3cf8ec71e tar: add pax file reader tests 2024-01-13 19:37:33 -07:00
Igor Anić
7b0bbc680f tar: add file mode to result of tarbal iteration
So we have information to set executable bit on write to file system.
2024-01-13 19:37:33 -07:00
Igor Anić
2a432d3008 tar: prefix test cases with 'tar'
To make it little easier to filter from all stdlib tests.
2024-01-13 19:37:33 -07:00
Igor Anić
2ed9a276a7 tar: use Go test cases path from env variable
Skip tests if env is not set.
2024-01-13 19:37:33 -07:00
Igor Anić
6bfa7bf197 tar: use scratch buffer for file names
That makes names strings stable during the iteration. Otherwise string
buffers can be overwritten while reading file content.
2024-01-13 19:37:33 -07:00
Igor Anić
6e7a39c935 tar: refactor reading pax attributes 2024-01-13 19:37:33 -07:00
Igor Anić
c761dfc176 tar: add gnu path and link extensions handling 2024-01-13 19:37:33 -07:00
Igor Anić
48b160c1bf tar: handle pax null attrs and pax attr ending 2024-01-13 19:37:33 -07:00
Igor Anić
16c40fc471 tar: add header chksum checking 2024-01-13 19:37:33 -07:00
Igor Anić
169f28d3e6 tar: fix import path 2024-01-13 19:37:33 -07:00
Igor Anić
e1424b84b8 tar: add parsing size in gnu extended format
Reference:
https://www.gnu.org/software/tar/manual/html_node/Extensions.html#Extensions

If the leading byte is 0x80 (128), the non-leading bytes of the field
are concatenated in big-endian order, with the result being a positive
number expressed in binary form.
2024-01-13 19:37:33 -07:00
Igor Anić
6d5283e835 tar: refactor reader and iterator
Make it more readable.
2024-01-13 19:37:33 -07:00
Igor Anić
be5d04ab79 tar: add pax linkpath attribute parsing
Name of symbolic link can be also found in pax attribute.
2024-01-13 19:37:33 -07:00
Igor Anić
1817063375 tar: add initial test cases
Just adding tests, without changing functionality.
2024-01-13 19:37:33 -07:00
Igor Anić
4381241237 tar: refactor Buffer
Move reader into Buffer and make it BufferedReader. This doesn't
introduce any new functionality just grouping similar things.
2024-01-13 19:37:33 -07:00
Igor Anić
ff8544daa5 tar: refactor code to be more testable
Split reading/parsing tar file and writing results to the disk in two
separate steps. So we can later test parsing part without need to write
everyting to the disk.
2024-01-13 19:37:33 -07:00
Jacob Young
7916cf6f83 std.io.GenericReader: add missing error annotations 2024-01-13 13:16:51 -08:00
Luuk de Gram
4f2009de12
Merge pull request #18528 from Luukdegram/wasm-linker-fixes
wasm-linker: Fix debug info
2024-01-13 08:42:33 +01:00
Michael Scott
e5dc9b1d09 Update styles in std docs to correct display glitch 2024-01-12 16:25:55 -08:00
Meghan Denny
3d6c26525f sema: forbid asm output to const locals 2024-01-12 16:23:42 -08:00
Chris Boesch
d8b5831dc4 Fixed verbatim copy of trailing '%' in unescapeStr 2024-01-12 16:20:44 -08:00
Meghan Denny
f49a8c5431 std: make c.versionCheck() a comptime-known function 2024-01-12 16:17:39 -08:00
Luuk de Gram
3f22bb96f3
wasm-linker: fix debug info relocation
This corrects calculating the offsets to the code section as we now
correctly allocate the code atoms during write taking the 'size' into
account. We also handle dead symbols which are garbage-collected by
writing -2 and -1 to skip ranges, loc and other sections respectively.
2024-01-12 14:57:37 +01:00
Luuk de Gram
7fe629a812
wasm-linker: delay code atom allocation till write
We delay atom allocation for the code section until we write the actual
atoms. We do this to ensure the offset of the atom also includes the
'size' field which is leb128-encoded and therefore variable. We need this
correct offset to ensure debug info works correctly.

The ordering of the code section is now automatic due to iterating the
function section and then finding the corresponding atom to each
function. This also ensures each function corresponds to the right atom,
and they do not go out-of-sync.

Lastly, we removed the `next` field as it is no longer required and also
removed manually setting the offset in synthetic functions. This means
atoms use less memory and synthetic functions are less prone. They will
also be placed in order of function order correctly.
2024-01-12 14:57:36 +01:00
Luuk de Gram
2b3e6f680c
wasm-linker: ensure custom sections are parsed
Not all custom sections are represented by a symbol, which means the
section will not be parsed by the lazy parsing and therefore get garbage-
collected. This is problematic as it may contain debug information that
should not be garbage-collected. To resolve this, we manually create
local symbols for those sections and also ensure they do not get garbage-
collected.
2024-01-12 14:57:32 +01:00
Andrew Kelley
63de8a5989 langref: fix typo 2024-01-11 01:02:21 -08:00
Andrew Kelley
30688c341b LLVM: fix lowering of extern anyopaque
closes #18461
2024-01-11 01:00:49 -08:00
Andrew Kelley
aba8d4f62c langref: document inline functions 2024-01-10 19:31:45 -07:00
Andrew Kelley
45ec851733 zig build: handle stderr more elegantly
* Specifically recognize stderr as a different concept than an error
  message in Step results.
* Display it differently when only stderr occurs but the build proceeds
  successfully.

closes #18473
2024-01-10 17:11:26 -08:00
Andrew Kelley
df6aed0fc3
Merge pull request #18505 from ziglang/tsan
TSAN: update to LLVM 17.0.6
2024-01-10 15:08:49 -08:00
february cozzocrea
aafff25897
translate-c: float cast from boolean expr fix 2024-01-10 19:13:11 +00:00
Andrew Kelley
71e7bef2a2 tsan: use explicit error set
Fixes fail to build from source when LLVM not linked.
2024-01-10 09:30:24 -08:00