#1268·fq

fq hangs indefinitely when `torepr` piped to custom function (Ala `def:`)

Author: soberichCreated Feb 22, 2026Updated Mar 8, 2026

What version are you using (fq -v)?


$ fq -v
0.16.0 (darwin arm64 go1.25.5)

How was fq installed?

brew

Can you reproduce the problem using the latest release or master branch?

yes

What did you do?

bash
fq 'torepr | walk( recurse | fromjson? ) | @base64d | from_bplist | from_ns_keyed_archiver' ~/some.plist
{
  "$class": "_NSPersistentHistoryToken",
  "NSPersistentHistoryTokenDictionary": {
    "10B5B333-0A57-4172-9960-5B60748D39DA": 2260
  }
}

however

bash
fq 'def r:                                                                                                                                                                
  walk(
    if type == "string" then
      (fromjson? | r)
      //
      (ltrimstr("base64:") | select(test("^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/][AQgw]==|[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=)?$")) | @base64d? | r)
      //
      (from_bplist? | r)
      //
      (from_ns_keyed_archiver? | r)
      //
      .
    else
      (select(length? > 0) // booleans)
    end
  );
torepr | r
' ~/some.plist 

... hangs indefinitely

without torepr | part it works but the output is not in desirable format.