Skip to content

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

@soberich

Description

@soberich

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?

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

however

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions