From 7fc84f6abaac95b4c67a8fed500e5971106609d8 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Mon, 2 Nov 2026 20:49:31 -1000 Subject: Name a missing Lua module in the error log --- custom/extensions/about-render.lua | 6 +++++- custom/extensions/email-gravatar.lua | 6 +++++- custom/extensions/email-libravatar.lua | 6 +++++- custom/extensions/syntax-highlight.lua | 9 +++++++-- 4 files changed, 22 insertions(+), 5 deletions(-) (limited to 'custom') diff --git a/custom/extensions/about-render.lua b/custom/extensions/about-render.lua index 35f30d0..e3747ec 100644 --- a/custom/extensions/about-render.lua +++ b/custom/extensions/about-render.lua @@ -10,7 +10,8 @@ -- about-filter=lua:/usr/local/lib/cgit/filters/about-render.lua -- Markdown and man pages need lpeg, built for the Lua cgit is linked --- against. Without it both fall back to escaped plain text. +-- against. Without it both fall back to escaped plain text, and the error +-- log says so. -- -- # Debian and Ubuntu -- sudo apt install lua-lpeg @@ -21,6 +22,9 @@ -- # or with LuaRocks, matched to your Lua version -- sudo luarocks --lua-version 5.1 install lpeg local has_lpeg, lpeg = pcall(require, "lpeg") +if not has_lpeg then + io.stderr:write("[cgit] Unable to load lpeg, so markdown and man pages show as plain text\n") +end -- Readmes larger than this are served as escaped plain text rather than diff --git a/custom/extensions/email-gravatar.lua b/custom/extensions/email-gravatar.lua index 467deff..c89da79 100644 --- a/custom/extensions/email-gravatar.lua +++ b/custom/extensions/email-gravatar.lua @@ -13,7 +13,8 @@ -- openssl.digest, from . The reliable -- cross-platform install is LuaRocks, matched to the Lua version cgit is built -- against, and it needs the OpenSSL development headers present. Without it --- the filter draws no icons and leaves the names as they are. +-- the filter draws no icons, leaving the names as they are, and says so in the +-- error log. -- -- # Debian and Ubuntu -- sudo apt install luarocks libssl-dev @@ -33,6 +34,9 @@ -- SHA-256, the form Gravatar documents. local has_digest, digest = pcall(require, "openssl.digest") +if not has_digest then + io.stderr:write("[cgit] Unable to load openssl.digest, so no avatar icons are drawn\n") +end -- The size is in pixels and serves both as the image asked of the service and diff --git a/custom/extensions/email-libravatar.lua b/custom/extensions/email-libravatar.lua index 0a6e10c..79794a7 100644 --- a/custom/extensions/email-libravatar.lua +++ b/custom/extensions/email-libravatar.lua @@ -12,7 +12,8 @@ -- openssl.digest, from . The reliable -- cross-platform install is LuaRocks, matched to the Lua version cgit is built -- against, and it needs the OpenSSL development headers present. Without it --- the filter draws no icons and leaves the names as they are. +-- the filter draws no icons, leaving the names as they are, and says so in the +-- error log. -- -- # Debian and Ubuntu -- sudo apt install luarocks libssl-dev @@ -32,6 +33,9 @@ -- SHA-256, which Libravatar accepts alongside MD5. local has_digest, digest = pcall(require, "openssl.digest") +if not has_digest then + io.stderr:write("[cgit] Unable to load openssl.digest, so no avatar icons are drawn\n") +end -- The size is in pixels and serves both as the image asked of the service and diff --git a/custom/extensions/syntax-highlight.lua b/custom/extensions/syntax-highlight.lua index 7414b63..2928250 100644 --- a/custom/extensions/syntax-highlight.lua +++ b/custom/extensions/syntax-highlight.lua @@ -4,8 +4,8 @@ -- Scintillua lexers and reach the page wrapped in span elements carrying the -- hl- classes that assets/cgit.css styles. Whenever a piece is missing or -- will not load, from lpeg down to a single lexer, the filter falls back to --- plain escaped text instead of failing. It runs on Lua 5.1 through 5.5 and --- LuaJIT. +-- plain escaped text instead of failing, and a missing lpeg or Scintillua is +-- noted in the error log. It runs on Lua 5.1 through 5.5 and LuaJIT. -- -- source-filter=lua:/usr/local/lib/cgit/filters/syntax-highlight.lua @@ -140,6 +140,7 @@ end local function load_scintillua() local dir = scintillua_path() if not dir then + io.stderr:write("[cgit] Unable to find the Scintillua lexers, so source is shown uncoloured\n") return nil end package.path = dir .. "/?.lua;" .. package.path @@ -149,6 +150,10 @@ local function load_scintillua() if ok and type(mod) == "table" and type(mod.load) == "function" then return mod end + if not ok then + local reason = tostring(mod):match("[^\n]*") + io.stderr:write("[cgit] Unable to load the Scintillua lexers: " .. reason .. "\n") + end return nil end -- cgit 2.12.1