mgree / ffs

the file filesystem: mount semi-structured data (like JSON) as a Unix filesystem
https://mgree.github.io/ffs/
GNU General Public License v3.0
457 stars 14 forks source link

Broken TOML is generated #67

Closed asm0dey closed 4 months ago

asm0dey commented 4 months ago

Consider the following TOML:

[a]
array = [ "a", 2, { x = "y", z = 3 } ]
key1 = "value1"
key2 = "value2"

It passes validation at https://www.toml-lint.com even tho it's slightly unconventional.

When I do the following

❯ ffs -i x.toml&
[1] 469278
❯ tree x
x
└── a
    ├── array
    │   ├── 0
    │   ├── 1
    │   └── 2
    │       ├── x
    │       └── z
    ├── key1
    └── key2

4 directories, 6 files

it seems valid.

All the data is valid too:

❯ cat x/a/array/0
a
❯ cat x/a/array/1
2
❯ cat x/a/array/2/x
y
❯ cat x/a/array/2/z
3
❯ cat x/a/key1
value1
❯ cat x/a/key2
value2

However when I unmount it, it's completely broken:

❯ umount x
[1]  + 469278 done       ffs -i x.toml
❯ cat x.toml
[a]
key1 = "value1"
key2 = "value2"
array = ["a", 2
[[a.array]]
x = "y"
z = 3
]
mgree commented 4 months ago

When rendering toml, I'm just using the toml package (reference in our code), so this indicates a bug in their code... at v0.5. They're currently on v0.8.12, so I suspect that upgrading to a more recent version will fix things.

(If you're comfortable compiling the code yourself, you should be able to test this out by cloning and updating Cargo.toml with the new version for the toml package.)

asm0dey commented 4 months ago

Compiled version is the only one I tried, let me try to update the version :)

asm0dey commented 4 months ago

Yup, updating fixes it!

mgree commented 4 months ago

68 is set to merge when CI says it's good, which should generate a usable executable. Thanks for the report!

asm0dey commented 4 months ago

Will there be a new release published?

mgree commented 4 months ago

There's always a "latest" build. I'm overdue for a new release, to incorporate @nad2040's work on pack/unpack binaries. Possibly today, more likely next week (it's the end of the semester, so I'm a bit overloaded).