Commit Graph

258 Commits

Author SHA1 Message Date
e6b9d43646 slice pointer and unit test fixes 2022-07-04 05:46:56 +03:00
c39f89d995 realistic bugfixes 2022-07-03 09:44:09 +03:00
2e4229d613 main: trivial errors 2022-07-03 06:39:33 +03:00
c294d149fc fix unix2db 2022-07-02 21:19:42 +03:00
e79cdaffde fix user writing 2022-07-02 16:24:47 +03:00
83fa0c8733 better char debugging experience 2022-07-02 16:17:10 +03:00
186796fffc user.fromLine tests 2022-07-02 09:14:02 +03:00
e7fb0c18d4 User.fromLine 2022-06-29 13:55:53 +03:00
5d171883a7 home + shell validators 2022-06-29 13:49:20 +03:00
7911287261 gecos validator 2022-06-29 13:37:36 +03:00
942c05f348 name validation 2022-06-29 10:48:37 +03:00
b703eeb37c wip fromLine tests 2022-06-28 19:55:33 +03:00
f30510f122 wrap errors in real code with quotes 2022-06-28 16:44:44 +03:00
71f94d0600 fix error wrapping 2022-06-28 16:41:10 +03:00
3872f2af40 fix split_rev 2022-06-28 16:04:23 +03:00
0865965762 wip: failure tests 2022-06-22 21:16:13 +03:00
7d73667250 code style 2022-06-22 21:06:20 +03:00
a4d5be6fab wip error context 2022-06-22 20:59:58 +03:00
6aa4b01692 wip handling errors in top level 2022-06-22 16:23:04 +03:00
62b643dbc2 ErrCtx: splitRev 2022-06-22 15:36:22 +03:00
675125be05 beginnings of using ErrCtx 2022-06-15 13:34:37 +03:00
eb6003c957 wip ErrCtx 2022-06-15 12:56:19 +03:00
72f6c9c6f4 don't be smart about memory continuity 2022-06-12 13:38:10 +03:00
9b803b84d2 add ErrContext 2022-06-12 13:27:12 +03:00
12561d9f3a wip: full smoke test 2022-06-07 13:14:50 +03:00
e2d20bb805 formatting 2022-06-07 06:30:18 +03:00
a5c24ace80 writing to the db 2022-06-07 05:59:00 +03:00
31b5bb2d72 Group.fromReader 2022-06-07 05:39:16 +03:00
e238db9b60 unix2db: first stab at flag parsing 2022-06-06 10:01:15 +03:00
20bfa60f26 fixes for zig 0.10.0-dev.2473+e498fb155 2022-06-05 23:11:18 +03:00
d71f0d615b fix one of stage2 errors 2022-05-25 09:48:39 +03:00
c602b7a039 rename lib to src 2022-05-25 09:42:42 +03:00
a8b45911aa weekend changes
- move main.zig to it's own package, create lib/
- rename AllSections to DB, remove intermediate tuples
- iovec does not allocate
- remove error{Overflow} from almost everywhere
2022-03-23 12:01:13 +02:00
886382d900 clean up build a bit 2022-03-20 08:46:54 +01:00
b220dd92e3 iovec 2022-03-20 08:42:51 +01:00
787fbcf375 [cmph] do our own definitions
so we don't import headers any more.
2022-03-20 08:42:22 +01:00
f4012c8694 constructing header 2022-03-18 18:22:35 +01:00
bb3577f7b3 fix one-off bugs 2022-03-18 18:11:45 +01:00
0331364da2 test ergonomics
thanks tsmanner
2022-03-18 17:55:45 +01:00
e4e845384f endianess and nblocks 2022-03-18 17:48:33 +01:00
692d80cdd7 corpus: add root 2022-03-18 06:34:28 +01:00
4daa6fd38a sections: store offsets in indices 2022-03-18 06:17:52 +01:00
a426c46efa tidy up imports 2022-03-18 05:52:21 +01:00
4e36d7850e rewrite shells
- Shell is up to 256 bytes long.
- Store up to 255 shells in the Shells area.
- Remove padding from the User struct.
2022-03-17 17:07:33 +01:00
d526f1fab8 fix shell unit test 2022-03-16 07:12:35 +02:00
c721fa6d5d split bdz int and str tests 2022-03-16 07:08:57 +02:00
e142621753 nits in tests 2022-03-16 06:59:12 +02:00
9c2f0969dc sections: gc on error 2022-03-16 06:57:35 +02:00
8a4bb62613 shr user and group offsets
by 3 bits, all of them.
2022-03-15 10:56:50 +02:00
249cdb1a31 remove corpus.users and corpus.groups
These use cases are now fully replaced with MultiArrayList
2022-03-15 10:07:05 +02:00
0a0559824a Bdz index helper 2022-03-15 08:09:28 +02:00
92ee170d54 bdz/cmph nits 2022-03-15 06:35:48 +02:00
6bf3e10eed test packed users iterator 2022-03-15 06:27:03 +02:00
2c4e61d0ed remove redundant sections 2022-03-13 14:22:49 +02:00
3b2f135d5c refactor ShellReader, so it can be included 2022-03-10 19:20:25 +02:00
1751f6c996 replace PackedUserHash with simple PackedUser
passing hashes is OK
2022-03-10 19:20:25 +02:00
c78a2c0def Implement Groupmembers and Groups section without tests 2022-03-10 19:20:25 +02:00
d6ba7bed63 group_members 2022-03-10 19:20:25 +02:00
4cc655de24 store members_offset as a varint 2022-03-10 13:02:38 +02:00
ba56ff8d3b user gids are unpadded 2022-03-10 13:02:38 +02:00
8fbd605b8d use Multi where appropriate 2022-03-10 13:02:38 +02:00
15e018389a username2groups -> user2groups 2022-03-10 13:02:38 +02:00
c79741f4e2 groupname2users -> group2users 2022-03-10 13:02:38 +02:00
9aa52e5a69 offsets are u64, indices are u32 2022-03-10 13:02:38 +02:00
fc469acbf9 offsets are u64 2022-03-10 13:02:38 +02:00
d2ace3e125 remove redundant fields 2022-03-10 13:02:38 +02:00
9bf0a35689 add a struct for all sections 2022-03-10 13:02:38 +02:00
24d984d712 bdz.search_u32: search directly 2022-03-06 18:18:35 +02:00
1caf3f1184 some explicit errors in function signatures 2022-03-06 18:01:52 +02:00
d3be68b51d generalize Shell2Index for hash and test stubs 2022-03-06 17:55:29 +02:00
a6349cd114 wip writing of users 2022-03-06 13:11:06 +02:00
e3fd1c833c userGids unit test 2022-03-06 09:57:44 +02:00
efd3cfc367 expose len to the delta-compressed iterator 2022-03-06 09:39:18 +02:00
039aeb80dd delta decompression iterator 2022-03-06 06:37:24 +02:00
ec95b231fa varint iterator 2022-03-05 10:19:42 +02:00
e17b2c9641 expose native shell sections 2022-03-05 06:08:01 +02:00
869f3f3a65 less memory thrashing 2022-03-05 05:40:00 +02:00
87c424aab9 get rid of Corpus struct
it had some non-useful internal state
2022-03-04 11:12:04 +02:00
b81072f726 add usergids 2022-03-04 10:55:09 +02:00
a4e3e08f5f packing shell sections 2022-03-03 18:05:46 +02:00
e1bdb6c529 more robust bdz for numbers + helpers 2022-03-03 11:32:12 +02:00
4fc54e5b65 [Section] slices instead of ArrayLists
It will need to be only indexed and interated anyway.
2022-03-02 07:15:08 +02:00
9721e1be7f start with real sections 2022-03-02 06:50:15 +02:00
a526379fd8 cosmetic changes 2022-03-02 06:18:19 +02:00
0ccbdc4215 indentation 2022-03-02 06:07:07 +02:00
9392922216 some negative tests 2022-03-02 06:02:45 +02:00
321d1f6afd sort and use unmanaged ArrayLists 2022-03-02 06:02:04 +02:00
e5870a95fe make corpus smoke test pass 2022-03-02 05:42:23 +02:00
3c4455efeb cloning users and groups 2022-03-01 15:03:51 +02:00
7df1296ce1 corpus test passing 2022-03-01 05:47:44 +02:00
3eec9a3274 starting with sections 2022-02-28 20:34:15 +02:00
40deb3f0be preparing for bringing this all together 2022-02-28 06:19:32 +02:00
0b0e917086 deltaDecompress 2022-02-28 06:02:16 +02:00
ca67bf56e7 implement delta compression 2022-02-28 05:48:43 +02:00
df8ab1fbbf PackedGroup 2022-02-27 18:40:05 +02:00
1ef962d64a mutate users in tests 2022-02-27 06:26:01 +02:00
b4c7cba627 mutable/immutable PackedUser 2022-02-26 11:20:44 +02:00
f4c4dc535c remove redundant comment 2022-02-26 10:46:06 +02:00
b02edc7190 use ArrayList instead of slices
The API is more ergonimic.
2022-02-26 10:29:41 +02:00
87b4b81a48 formatting 2022-02-25 15:22:05 +02:00
22c61d1207 fix PackedUser.maxSize 2022-02-25 15:17:24 +02:00
b0d74c0cad formatting 2022-02-25 14:01:35 +02:00
eed4f4e234 add some clarifying comments 2022-02-25 13:58:06 +02:00
b9fb07121b remove debug statements 2022-02-25 13:50:24 +02:00
2154205711 refactoring UserReader 2022-02-25 13:47:23 +02:00
751b51b859 change size treatment for PackedUser 2022-02-24 17:37:22 +02:00
49a7d79b05 PackedUser is now readable 2022-02-24 17:33:27 +02:00
0f43f8b2d0 wip refactoring PackedUser 2022-02-24 17:09:17 +02:00
b924e3a935 start packed group 2022-02-24 10:13:26 +02:00
3bf1b3fc01 bring back additional_gids_offset 2022-02-24 05:32:27 +02:00
c0afca00b0 shorten cmph pack by 4 bytes 2022-02-23 20:30:42 +02:00
3498167108 add bdz.zig 2022-02-23 18:30:35 +02:00
4f1bada988 start with cmph.zig and bdz.zig 2022-02-23 18:24:23 +02:00
609ab3d2b6 overflow tests 2022-02-23 10:19:50 +02:00
d555994960 wip varint 2022-02-23 07:10:49 +02:00
b58063ef63 Implementation status for each section 2022-02-23 06:31:25 +02:00
bb4b5eba03 add utf8 validation; rework user iterator 2022-02-23 06:09:42 +02:00
0e5365127a increase gecos length 2022-02-22 15:22:30 +02:00
e06cac38b2 remove 3 bytes from PackedUser
additional_gids will be stored separately.
2022-02-22 15:16:45 +02:00
78dc63669d add tests for upper limits 2022-02-22 15:04:59 +02:00
26fbfc5f08 fix non-packed iterator 2022-02-22 14:37:47 +02:00
ab0562950c add some guard rails w.r.t. padding 2022-02-21 13:54:35 +02:00
f77d94e624 remove padding 2022-02-21 13:48:11 +02:00
91849c128f non-packed user iterator 2022-02-20 14:13:06 +02:00
f2434e3d3c working on iterator 2022-02-20 13:47:17 +02:00
54ec710f10 wip iterator 2022-02-20 12:44:21 +02:00
e54c153dd8 style 2022-02-20 09:47:47 +02:00
9487194c95 simplify catch 2022-02-20 09:19:59 +02:00
988ab9f6d4 update padded user alignment 2022-02-20 09:10:25 +02:00
330db487ac add roundUp assertion 2022-02-19 22:12:49 +02:00
4dbc7b03bc buffer is a pointer 2022-02-19 22:10:55 +02:00
ae2d3d5443 generalize padding funcs 2022-02-19 21:23:33 +02:00
2fc925923f wip between-user padding 2022-02-19 18:20:50 +02:00
4e45c6e5a9 simplify appendUser 2022-02-19 16:56:53 +02:00
ca28332126 add unit tests for padding 2022-02-19 16:04:13 +02:00
623060dac3 remove unnecessary cast 2022-02-19 15:50:13 +02:00
fd1cab251d fix shell index offsets 2022-02-19 15:48:51 +02:00
13b75e8046 user packing 2022-02-19 11:35:29 +02:00
93c6a1c12a rename shell_len_or_place to _idx 2022-02-18 20:36:32 +02:00
2964c918cc remove user.zig dependency on shell.zig 2022-02-18 20:35:42 +02:00
da727113e5 filling packed user 2022-02-18 20:29:45 +02:00
eacfc08592 fix PackedUser test
It is 120 bits long. @sizeOf returns 128, because, I guess, it tries to
word-align it (not byte-align it).

We are OK with non-word-aligned user struct, since it will have an
arbitrary []u8 slice right after it with the string data. However,
byte-alignment is important.
2022-02-18 17:40:04 +02:00
1fe23aa1e5 adding user 2022-02-18 17:35:01 +02:00
411fb91fd1 test and README tiny updates 2022-02-18 17:26:35 +02:00
80ec63b6a4 fix casting functions, add some tests 2022-02-18 15:28:04 +02:00
44107bac51 adding simple header validation 2022-02-18 07:42:43 +02:00
ed1e464305 header may err 2022-02-18 07:16:11 +02:00
8c8570e6d1 start with Header 2022-02-17 11:55:05 +02:00
00cf0e4a66 hashmap: use getOrPut 2022-02-17 11:11:16 +02:00
d9c8e69440 make Shell Writer work. 2022-02-17 10:54:39 +02:00