1
1
mirror of https://github.com/mgree/ffs.git synced 2024-10-05 15:18:20 +03:00
Commit Graph

60 Commits

Author SHA1 Message Date
Michael Greenberg
2a406b9253
Upgrade dependencies (#68)
Resolves #67, fixing broken TOML printing.
2024-05-02 04:16:17 +00:00
Dan Liu
3857d74d27
pack/unpack (#65)
* scoping out multi-binary stuff

* todo notes for pack/unpack [ci skip]

* new version of r in gh action

* created lib.rs and moved ffs main.rs bin. added bfs traversal of json structure.

* moved main.rs last commit. forgot to commit the removal

* added file creation for null,bool,num,str

* main.rs > ffs.rs to have ffs as executable

* error condition for already existing root dir and text files

* first cut at BFS with nodes

* unpack supports all 3 types now

* use config object for file name parsing, change from_args to from_ffs_args in ffs.rs

* fixed unpack configs

* added from_pack_args and some code to get the Value structure from a file

* added dep walkdir

* not working pack.rs

* remove dep walkdir

* almost working pack.rs

* pack works, but not too efficient

* change pack to return name and value so recursion can work without queue

* pack.rs similar to as_other_value now and works

* unpack and pack now have their own args parsers

* changed cli options for pack-unpack (unfinished)

* edited config to better support pack and unpack actions

* fixed unpacking into empty dir. only unpacking into unempty dir errors

* checked almost all error statuses

* fix no-xattr option for unpack

* prevent non-object/array from being unpacked

* fixed missing RUST_LOG warnings

* roundtrip tests for formats. since comments and formatting aren't preserved, unpack and pack twice

* fix pack: added --exact

* rm ERR_MSG tmp file in all tests. added all possible format conversion tests. edit to run_tests.sh to support new tests

* fix packunpack tests

* another update to test scripts

* unpack: don't remove dir if value is not map or list. pack: detect file type without xattr. started adapting more scripts to use unpack/pack

* changed user.type xattr for non-lists from 'map' to 'named'. converted 10 scripts

* added more scripts. fixed bug in infer_mount_relative fail()

* more tests, fix: original_name xattr only gets used if name is invalid

* more tests, missing 1 fail message in yaml_output test, changed pack list sorting to use file name instead of parsed integers to match ffs

* fixed tests for unpack/pack

* edit script formatting using quotes around vars, rm readonly for unpack

* pack: added back ignored file for lists and --no-xattr option in cli, added macos_noxattr_cleanup (not exactly the same as ffs test)

* Run `pack/`unpack` in macOS CI; factor out benchmarks (#63)

* added quiet inplace, umask test based on mode.sh

* added fail (un)pack for every call, fix missing n in fail msg for basic_object_exact

* fixed issues with adding fail conditions

* added (un)pack exit status tests

* added symlink support for pack

* symlinks mostly done. cleanup + efficiency checks needed

* added test for packing symlinks, added some comments for pack

* fix test4 for symlink test on linux

* see why test5 not working on linux

* actually print out the xattr

* fix: setting xattr on symlink doesn't work in linux :( making it macOS-specific

* impl --max-depth and --allow-symlink-escape. tests needed

* fix: macos links /var to /private/var so checking if symlinked path starts with mount errors. canonicalizing mount works.

* fix: wrong detected type map instead of named. add: symlink escape and maxdepth test.

* code cleanup, added test for symlink escape and maxdepth together, show warnings in config for pack/unpack not just errors

* simple changes for requests:
pack:122 add loop to error msg
debug! for received config in unpack & pack
f.write(s)? instead of write!
shadowed original_name
verb agreement in cli.rs
remove reserve for BTreeMap and now useless TODOs

* while let instead of queue.empty

* use auto instead of detect and check for auto and is_dir to resolve directory type
use .as_ref instead of .clone for accessing mount
remove non-symlinks from mapping

* resolve directory type always. warn for unknown path_type.

* warn when hitting broken symlinks.

* better warn message for broken symlink

* resolve repeated traversal of broken symlinks
store bool of whether link is broken in symlink mapping
checks symlinks a maximum of two times for broken links

* use struct instead of tuple in symlink map
for better naming and code clarity

* loosen criterion for determining directory type
directories get resolved as list if all files begin with an integer.
if a directory's user.type gets forcibly set to list without obeying
that property, all filenames that don't begin with an integer get put
to the end of the list, but are still sorted alphabetically.

* don't use regex to detect. just check first or first two chars manually.
continue to use regex for sorting because lexicographic sorting for files starting with -
means larger negative numbers go to the right

---------

Co-authored-by: Michael Greenberg <michael.greenberg@stevens.edu>
2023-09-27 14:02:15 +00:00
Dan Liu
aa6c2307ee
added test for empty log to see if quiet was successful and rm all tmp files (#64) 2023-07-21 18:41:34 -07:00
Dan Liu
2dee504113
fix: wrong mountpoint in fail() (#62)
Fix buggy test.
2023-06-04 05:29:49 -07:00
Michael Greenberg
b9c6644312
Lazy loading (#50)
Lazy implementation is now the default. Use `--eager` to force ffs to construct the entire filesystem on startup.

NB that lazy loading is not the same as lazy parsing. There's still plenty of savings left on the table.

There is some unwelcome code duplication in saving to accommodate type-level jiggery pokery.
2021-10-01 07:57:58 -07:00
Michael Greenberg
6ed74ee0c7
Timing support (#46)
Benchmarks, in two flavors: real-world benchmarks and synthetic microbenchmarks.

`--time` flag for benchmarking output on stderr.

Using R to generate pretty graphs. Some overhaul of build scripts and artifacts, with the hope of simplifying the release system.
2021-07-29 17:55:53 -07:00
Michael Greenberg
b651c9c1ac
Exit status (#44)
Unify exit status (0=success, 1=fs error, 2=cli error).

Documented and tested; one test is disabled due to an upstream error masking.
2021-07-21 08:10:42 -07:00
Michael Greenberg
747301c815
Fix nested mount bug (#43)
@RaphaelWimmer reports in #42 an issue with nested mounts (which are just disallowed by FUSE and macFUSE), which we were handling poorly.

The solution is to check that mount2 worked correctly and report messages.
2021-07-21 06:32:43 -07:00
Michael Greenberg
85b1ac6da9
Better, configurable name munging (#41)
A new flag `--munge [rename|filter]` controls how a name munging will work.

Name munging only applies to fields named '.', '..', containing a NUL byte, or containing a forward slash '/'.

The `rename` option (the default) will change '.' to '_.' and '..' to '_..'; each NUL byte turns into '_NUL_' and each slash turns into '_SLASH_'.

This greatly simplified policy means that spaces and other special characters should work just fine in field names now.
2021-07-08 08:55:44 -07:00
Michael Greenberg
a1d5718ac9
--new flag for creating files from empty (#38)
Running `--new FILE.EXT` will:

- infer the output format form `EXT`
- use `FILE.EXT` as the output
- start with a single, empty, named directory (but allocate a bit more space)

In implementing this, I realized that introducing metadata (fad45bed4b) meant we no longer inferred types automatically. I added a type `Typ::Auto` and some inference code.
2021-07-04 18:19:31 -07:00
Michael Greenberg
7249ae95df
Pretty printing (#35)
Add --pretty flag, tests, docs.

Resolves #33.
2021-07-03 16:40:01 -07:00
Michael Greenberg
726a175163
More careful name munging (#34)
Save original names that don't work as filenames (e.g., `.` and `..`).

We restore these names as appropriate---if a file is `rename`d with the _same_ name, we leave it alone. But renames to fresh names destroy original names.

Resolves #29.

There is no way to create a file with such a name: the metadata is purely copied. There's a TODO note in the code to allow users to inspect and edit this metadata, but it's not worth exposing until somebody asks for it. (I mean, really, please don't use `.` or `:/` as a property name.)
2021-07-02 08:01:07 -07:00
Michael Greenberg
2f5a63aff7
Missing check for ignored files in list directories format::value_from_fs (#32)
Clearer ignored files, cleanup formatting in `fs`.

Add a test to make sure the various macOS flags do what they ought to. Astonishingly, tests pass on 10.13 _and_ whatever crazy shit they're on now.
2021-07-02 06:50:49 -07:00
Michael Greenberg
fad45bed4b
Manage metadata using extended attributes (#30)
Extended attributes in `user.type` track the type of files and directories. Users can update these to alter the metadata.

Loading files records types; serialization tries to use them (but will default to strings or bytes if it can't interpret the file appropriately).

In particular, it's now possible to convert between both kinds of directories (list and named).

This isn't a long term solution, because extended attributes have no real affordances---it's not obvious that they even exist, and even once you see `user.type`, it's obvious what it means or what values it has. #2 has other ideas about ways to represent and manipulate metadata.

All of this comes with a few new flags and some brittle file ignoring behavior (macOS will generate `._*` files to hold extended attributes on filesystems that don't support them). The man page is updated with detail on the data model, and now the manpage is part of the website proper.
2021-07-01 18:52:53 -07:00
Michael Greenberg
5a0100bfb1 change default behavior to modify newlines; update readme 2021-06-24 11:05:57 -04:00
Michael Greenberg
4aff907523
Better mount control (issue #12; pr #24)
Mountpoints are typically inferred/generated from filenames with a -m/--mount flag for when reading from STDIN or to manually specify a mountpoint.
2021-06-24 07:06:38 -07:00
Michael Greenberg
4639d31cc6
Implement setattr (#22)
The `setattr` interface implements `chmod`, `chown`, `truncate`, and some timing related things (for, e.g., `touch`).

It's not clear I've covered _every_ base, but it certainly seems to allow for common use cases in bash without any error messages.

Comes with some nice refactors (metadata on each `Inode`, `FS::attr` is now `Inode::attr`, which simplifies some weird code that made the only the borrow checker happy---nobody else).
2021-06-23 17:36:12 -07:00
Michael Greenberg
2ec8fa6991 run tests in parallel, collect logs 2021-06-21 21:10:29 -04:00
Michael Greenberg
94917eda25
Yaml support (#14)
Adds support for YAML using [yaml_rust](https://crates.io/crates/yaml-rust).

Some compromises due to YAML funniness: compound keys will be treated as their hashes.
2021-06-21 17:36:15 -07:00
Michael Greenberg
b48efc266c
Support other formats. (#11)
Broad refactor of how things work, moving `json.rs` to `format.rs`.

Adds support for TOML, along with CLI stuff for setting formats (which are automatically inferred from filenames).

Adds support for binary data using base64 encodings.
2021-06-20 18:20:06 -07:00
Michael Greenberg
afb359c7ff better testing of null values 2021-06-18 11:43:24 -04:00
Michael Greenberg
8345d510f4 better handling of newlines, tests 2021-06-17 20:50:43 -04:00
Michael Greenberg
cb388da9e4 quiet flag, test for quiet/inplace 2021-06-17 20:30:23 -04:00
Michael Greenberg
1ae13c66f5 try running output test on linux, now that drop is getting called 2021-06-17 10:22:07 -04:00
Michael Greenberg
867cb6bc58 drop broken test 2021-06-16 20:10:58 -04:00
Michael Greenberg
4a71042e51 try using sync 2021-06-16 20:08:13 -04:00
Michael Greenberg
0b45914f3c clearer output, pause after fsync 2021-06-16 20:04:23 -04:00
Michael Greenberg
9d0ae6d682 fsync, improved output test 2021-06-16 19:51:54 -04:00
Michael Greenberg
fef31489de and you say you're an expert on the shell 2021-06-16 19:17:39 -04:00
Michael Greenberg
b57479177c just abort on linux 2021-06-16 19:09:02 -04:00
Michael Greenberg
e7657cb1a5 try some hostility 2021-06-16 18:44:24 -04:00
Michael Greenberg
faded25aeb derp 2021-06-16 18:38:30 -04:00
Michael Greenberg
e47a7db493 bad command 2021-06-16 18:33:06 -04:00
Michael Greenberg
ec7e63e129 try using fusemount to force it 2021-06-16 18:29:29 -04:00
Michael Greenberg
1830074f32 more debug 2021-06-16 17:46:18 -04:00
Michael Greenberg
ba64e76763 Basics of output seem to be working.
Addresses (most of) #5.
2021-06-16 17:28:45 -04:00
Michael Greenberg
9d8e084cf0 take mode as command line arg 2021-06-15 15:27:20 -04:00
Michael Greenberg
0b985d1e09 clean up cli 2021-06-15 14:59:11 -04:00
Michael Greenberg
520c606821 test for rename 2021-06-14 21:26:32 -04:00
Michael Greenberg
3e0285b2a2 fix broken unlink.sh, support access 2021-06-14 20:18:46 -04:00
Michael Greenberg
6a613084a4 rmdir, have unlink check it's a regular file 2021-06-14 20:14:12 -04:00
Michael Greenberg
d8dfe960c8 unlink 2021-06-14 19:54:04 -04:00
Michael Greenberg
6b2b37398e math is hard 2021-06-14 12:00:39 -04:00
Michael Greenberg
4a474245c7 longer sleep for macos tests 2021-06-14 11:38:51 -04:00
Michael Greenberg
c8636bb3b7 gentler tests, hoping for linux success 2021-06-13 20:42:29 -04:00
Michael Greenberg
1d2a2c38c0 mkdir 2021-06-13 20:32:58 -04:00
Michael Greenberg
4e93b697c6 mknod 2021-06-13 20:26:00 -04:00
Michael Greenberg
ef4c002965 support linux 2021-06-13 15:48:09 -04:00
Michael Greenberg
b1550ff26b correct computation of nlink 2021-06-13 15:33:22 -04:00
Michael Greenberg
a09a786ad4 fix argument style 2021-06-13 15:09:39 -04:00