psyinfra / onyo

text-based inventory system on top of git
ISC License
3 stars 5 forks source link

BUG: `onyo get` quoting unsuitable for use with `onyo set` #619

Closed aqw closed 3 months ago

aqw commented 3 months ago

We introduced quoting for the output of onyo get (5bea0d7efb25ada397cfe8b15466205a6cb3aca6), thinking that it would help with command expansion. However, it seems that input from command expansion is treated literally and word splitting proceeds unaltered.

This has two results:

Example:

(onyo) aqw@hrududu in ~/git/inm7/onyo demo on git:main
❱ onyo set --rename --keys model=mbp --asset $(onyo get --machine-readable --keys path --match model=macbookpro)
ERROR: The following paths aren't assets:
/home/aqw/git/inm7/onyo demo/"admin/Karl
/home/aqw/git/inm7/onyo demo/Krebs/laptop_apple_macbookpro.9sdjwb"
/home/aqw/git/inm7/onyo demo/"repair/laptop_apple_macbookpro.dd082o"
/home/aqw/git/inm7/onyo demo/"repair/laptop_apple_macbookpro.j7tbkk"
/home/aqw/git/inm7/onyo demo/"warehouse/laptop_apple_macbookpro.0io4ff"
/home/aqw/git/inm7/onyo demo/"warehouse/laptop_apple_macbookpro.1eic93"

So 5bea0d7efb25ada397cfe8b15466205a6cb3aca6 should be reverted.