From fd4fcf7fb7b2470c027e923bb1b6ea57d69b7ba9 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 20 Jan 2023 10:51:29 -0500 Subject: [PATCH] Prevent fork bombing from `cc` -> `tea` symlinks --- projects/tea.xyz/gx/cc/cc.rb | 3 +++ projects/tea.xyz/gx/cc/package.yml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/tea.xyz/gx/cc/cc.rb b/projects/tea.xyz/gx/cc/cc.rb index 0a330222..c4bb35da 100755 --- a/projects/tea.xyz/gx/cc/cc.rb +++ b/projects/tea.xyz/gx/cc/cc.rb @@ -22,6 +22,9 @@ exe_path = ENV['PATH'].split(":").filter { |path| path != File.dirname(__FILE__) }.map { |path| "#{path}/#{exe}" +}.reject { |path| + # if the user created a symlink of `cc` to `tea` don’t use it + File.symlink? path and File.basename(File.readlink(path)) == "tea" }.find { |path| File.exist?(path) } diff --git a/projects/tea.xyz/gx/cc/package.yml b/projects/tea.xyz/gx/cc/package.yml index 08b5392d..08733e74 100644 --- a/projects/tea.xyz/gx/cc/package.yml +++ b/projects/tea.xyz/gx/cc/package.yml @@ -1,9 +1,9 @@ distributable: ~ -# FIXME we want the c version eg. c99 +# FIXME we want the c version eg. c99 # or should that be some kind of option? so you specify you want a cc that support c99 versions: - - 0.1.2 + - 0.1.3 dependencies: linux: