flux-framework / flux-core

core services for the Flux resource management framework
GNU Lesser General Public License v3.0
168 stars 50 forks source link

ERROR: jobspec: invalid JSON: \u0000 is not allowed without JSON_ALLOW_NUL #6098

Open garlick opened 4 months ago

garlick commented 4 months ago

Problem: flux run --add-file doesn't work with files that contain embedded nulls:

$ dd if=/dev/zero of=/tmp/zz bs=1024 count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 0.000795757 s, 1.3 MB/s

$ flux run --add-file=/tmp/zz true
flux-run: ERROR: jobspec: invalid JSON: \u0000 is not allowed without JSON_ALLOW_NUL

I didn't look too closely but this seems like it might not be functioning as designed. At the very least, this should be documented in the man page.

grondo commented 4 months ago

This isn't an issue with flux run --add-file, but probably somewhere else in ingest pipeline that loads the JSON jobspec. That is, flux run --add-file --dry-run works:

$ flux run --add-file=zero --dry-run hostname | jq .attributes.system.files
{
  "zero": {
    "mode": 33152,
    "size": 8,
    "data": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
    "encoding": "utf-8"
  }
}