From 88a8d4793473259b392241f1e2d20d39bd96b214 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 20 Jan 2022 18:34:19 +0000 Subject: use YAML.unsafe_load in Psych 4.x (Ruby 3.1+) Psych 4.x defaults to "nanny mode" to handle untrusted data. This causes breakage with since YAML references (aliases) emitted by dtas-player can't be handled by Psych clients under Ruby 3.1. Since dtas is single user and is a shell designed to run arbitrary code, favor the new YAML.unsafe_load API which behaves like the old YAML.load in Ruby <= 3.0. --- bin/dtas-readahead | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin/dtas-readahead') diff --git a/bin/dtas-readahead b/bin/dtas-readahead index a1971bd..3f46b95 100755 --- a/bin/dtas-readahead +++ b/bin/dtas-readahead @@ -140,7 +140,7 @@ def do_open(path) when "---\n" buf << fp.read(fp.size - 4) Dir.chdir(File.dirname(path)) do - yml = YAML.load(buf) + yml = DTAS.yaml_load(buf) x = yml['infile'] and return File.open(File.expand_path(x).freeze) end end @@ -155,7 +155,7 @@ begin @todo_ra = @max_ra t0 = DTAS.now fp = nil - cur = YAML.load(c.req('current')) + cur = DTAS.yaml_load(c.req('current')) while @todo_ra > 0 && fp.nil? if current = cur['current'] track = current['infile'] @@ -177,7 +177,7 @@ begin end # queue has priority, work on it, first - queue = YAML.load(c.req('queue cat')) + queue = DTAS.yaml_load(c.req('queue cat')) while @todo_ra > 0 && track = queue.shift next unless track.kind_of?(String) fp = nil @@ -209,7 +209,7 @@ begin end end idx or break - cur = YAML.load(c.req('current')) + cur = DTAS.yaml_load(c.req('current')) current = cur['current'] or break end if current -- cgit v1.2.3-24-ge0c7