about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-01-20 18:34:19 +0000
committerEric Wong <e@80x24.org>2022-01-21 19:54:43 +0000
commit88a8d4793473259b392241f1e2d20d39bd96b214 (patch)
tree28e3fb5d17017038045de143bd2e6a7d95655d0d /bin
parent748c3633ce794685af343de0bcd24eca7440281b (diff)
downloaddtas-88a8d4793473259b392241f1e2d20d39bd96b214.tar.gz
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.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dtas-console4
-rwxr-xr-xbin/dtas-msinkctl4
-rwxr-xr-xbin/dtas-readahead8
-rwxr-xr-xbin/dtas-sinkedit4
-rwxr-xr-xbin/dtas-sourceedit4
-rwxr-xr-xbin/dtas-splitfx6
-rwxr-xr-xbin/dtas-tl4
7 files changed, 17 insertions, 17 deletions
diff --git a/bin/dtas-console b/bin/dtas-console
index e02dda4..a519ba9 100755
--- a/bin/dtas-console
+++ b/bin/dtas-console
@@ -27,7 +27,7 @@ trap(:WINCH) { se.signal }
 w = DTAS::UNIXClient.new
 w.req_ok('watch')
 c = DTAS::UNIXClient.new
-cur = YAML.load(c.req('current'))
+cur = DTAS.yaml_load(c.req('current'))
 readable = [ se, w, $stdin ]
 set_title = (ENV['DISPLAY'] || ENV['WAYLAND_DISPLAY']) ? $stdout : nil
 
@@ -254,7 +254,7 @@ begin
         events << "#{Time.now.strftime(tfmt)} #{event}"
         # something happened, refresh current
         # we could be more intelligent here, maybe, but too much work.
-        cur = YAML.load(c.req('current'))
+        cur = DTAS.yaml_load(c.req('current'))
       when $stdin
         # keybindings taken from mplayer / vi
         case key = Curses.getch
diff --git a/bin/dtas-msinkctl b/bin/dtas-msinkctl
index 189738f..6fb3863 100755
--- a/bin/dtas-msinkctl
+++ b/bin/dtas-msinkctl
@@ -1,5 +1,5 @@
 #!/usr/bin/env ruby
-# Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
+# Copyright (C) all contributors <dtas-all@nongnu.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 # frozen_string_literal: true
 require 'yaml'
@@ -29,7 +29,7 @@ def filter(c, player_sinks, key)
   rv = []
   player_sinks.each do |name|
     buf = c.req("sink cat #{name}")
-    sink = YAML.load(buf)
+    sink = DTAS.yaml_load(buf)
     rv << sink["name"] if sink[key]
   end
   rv
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
diff --git a/bin/dtas-sinkedit b/bin/dtas-sinkedit
index 8f96a97..252270f 100755
--- a/bin/dtas-sinkedit
+++ b/bin/dtas-sinkedit
@@ -36,10 +36,10 @@ st_in = $stdin.stat
 
 buf = c.req(%W(sink cat #{name}))
 abort(buf) if buf =~ /\AERR/
-orig = YAML.load(buf)
+orig = DTAS.yaml_load(buf)
 
 commit_update = lambda do |buf|
-  sink = YAML.load(buf)
+  sink = DTAS.yaml_load(buf)
   cmd = %W(sink ed #{name})
   update_cmd_env(cmd, orig, sink)
 
diff --git a/bin/dtas-sourceedit b/bin/dtas-sourceedit
index e6603bf..1b3f4ee 100755
--- a/bin/dtas-sourceedit
+++ b/bin/dtas-sourceedit
@@ -36,10 +36,10 @@ st_in = $stdin.stat
 
 buf = c.req(%W(source cat #{name}))
 abort(buf) if buf =~ /\AERR/
-orig = YAML.load(buf)
+orig = DTAS.yaml_load(buf)
 
 commit_update = lambda do |buf|
-  source = YAML.load(buf)
+  source = DTAS.yaml_load(buf)
   cmd = %W(source ed #{name})
   update_cmd_env(cmd, orig, source)
 
diff --git a/bin/dtas-splitfx b/bin/dtas-splitfx
index 18ea0b4..05e71e5 100755
--- a/bin/dtas-splitfx
+++ b/bin/dtas-splitfx
@@ -1,5 +1,5 @@
 #!/usr/bin/env ruby
-# Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
+# Copyright (C) all contributors <dtas-all@nongnu.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 # frozen_string_literal: true
 require 'yaml'
@@ -48,7 +48,7 @@ ARGV.each do |arg|
   when %r{\A(\w+)=(.*)\z}
     key, val = $1, $2
     # only one that makes sense is infile=another_file
-    overrides[key] = YAML.load(val)
+    overrides[key] = DTAS.yaml_load(val)
   when %r{\A(\w+)\.(\w+)=(.*)\z}
     # comments.ARTIST='blah'
     top, key, val = $1, $2, $3
@@ -63,5 +63,5 @@ trap(:INT) { exit 130 }
 file = args.shift or abort usage
 target = args.shift || default_target
 splitfx = DTAS::SplitFX.new
-splitfx.import(YAML.load(File.read(file)), overrides)
+splitfx.import(DTAS.yaml_load(File.read(file)), overrides)
 splitfx.run(target, opts)
diff --git a/bin/dtas-tl b/bin/dtas-tl
index 988e726..c1af933 100755
--- a/bin/dtas-tl
+++ b/bin/dtas-tl
@@ -1,5 +1,5 @@
 #!/usr/bin/env ruby
-# Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
+# Copyright (C) all contributors <dtas-all@nongnu.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 # frozen_string_literal: true
 # encoding: binary
@@ -51,7 +51,7 @@ def do_edit(c)
   # jump to the line of the currently playing track if using vi or vim
   # Patches for other editors welcome: dtas-all@nongnu.org
   if ed =~ /vim?\z/
-    cur = YAML.load(c.req('current'))
+    cur = DTAS.yaml_load(c.req('current'))
     if tl = cur['tracklist']
       if pos = tl['pos']
         ed += " +#{pos + 1}"