Does jq have a filepath length limit?

95 Views Asked by At

(OS is Windows 7 Professional. jq is version 1.5.)

I've been using jq to automate prettifying some JSON files (with Python). It seems to me after some time trying to determine why it wasn't working that jq fails silently when working with a file path string that's length 28, or simply stops working if the file path string is length 29 or more.

E.g. on cmd (and it's worth pointing out that I made a kind of shortcut so that jq calls jq-win64.exe, and tested the latter directly as well, so that's not the source of the issue):

C:\jq>jq . 123456789012345678901234567

displays prettified content of the file;

C:\jq>jq . 1234567890123456789012345678

displays nothing; and

C:\jq>jq . 12345678901234567890123456789

causes a "jq-win64.exe has stopped working" window.

(I also tested this on JSON files within folders; the common point was that the input string be of length 28 or more including slashes to fail.)

Is this a bug? If it's not, what can I do to work around it Okay, I admit that was a stupid question, I can work around it by copying content into a temp file in the base folder, prettify it, and then save it back to wherever I want it to be. More on-point question: is this the best workaround available for me to take?

1

There are 1 best solutions below

1
On

There was a Windows-specific bug in jq 1.5 (see e.g. https://github.com/stedolan/jq/issues/1094). It was fixed shortly after the release of jq 1.5.

To obtain a post-1.5 .exe for Windows, see any of: