[4301] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[barnowl/barnowl] Load PAR only when a .par module is found (PR #200)

daemon@ATHENA.MIT.EDU (Daniel JB Clark)
Mon Nov 2 21:45:46 2026

Date: Mon, 02 Nov 2026 18:45:39 -0800
From: Daniel JB Clark <notifications@github.com>
Reply-To: barnowl/barnowl <reply+ABCERSNH6IDWAGRGZEA7S5LLMKKNHEVBNHHQAAAAAFYBGE5C@reply.github.com>
To: barnowl/barnowl <barnowl@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>


----==_mimepart_6ae94ad3e4b14_12712d01048f3
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

ModuleLoader does `use PAR` at the top. PAR's import creates a cache directory in the first writable temporary directory (`PAR_TMPDIR`, `TMPDIR`, ..., then `/tmp`). Where that cannot be made, for example when BarnOwl runs in a sandbox that may not write `/tmp` (Landlock), ModuleLoader fails to compile and Hooks.pm reports "Can't load BarnOwl::ModuleLoader, loadable module support disabled": no module loads, not even the unpacked ones in `~/.owl/modules` that never use PAR.

Require and import PAR only when a `.par` file is found. If that fails, report it for that module and continue, so the unpacked modules still load. `reload_libs` is called only when a `.par` module was imported (`@PAR::PAR_INC` is filled only after PAR's temp setup succeeds).

Seen with the Debian package of master under a Landlock sandbox that allows only the client's own HOME: before, `:goose` (an unpacked module in `~/.owl/modules`) was "Unknown command" and the error above was shown; after, the unpacked modules load and each `.par` module (IRC, Jabber, Kerberos, Twitter, WordWrap) gets its own "Unable to load module" error.

Tests: t/moduleloader.t loads an unpacked module from a temporary config dir and checks that PAR is not loaded, then adds a `.par` module (built with Archive::Zip) and checks that it loads and PAR is loaded. It fails on master (https://github.com/djbclark/barnowl/actions/runs/41567482068, tests 1 and 3) and passes with this change (https://github.com/djbclark/barnowl/actions/runs/41567645662).

I searched this repository's pull requests for PAR, ModuleLoader, "cache directory", TMPDIR and "loadable module" first; the nearest are #91 (load the Jabber module lazily) and #129 (Perl module build cleanup), neither of which touches this.

You can view, comment on, or merge this pull request online at:

  https://github.com/barnowl/barnowl/pull/200

-- Commit Summary --

  * Load PAR only when a .par module is found

-- File Changes --

    M perl/lib/BarnOwl/ModuleLoader.pm (12)
    A t/moduleloader.t (65)

-- Patch Links --

https://github.com/barnowl/barnowl/pull/200.patch
https://github.com/barnowl/barnowl/pull/200.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/barnowl/barnowl/pull/200
You are receiving this because you are subscribed to this thread.

Message ID: <barnowl/barnowl/pull/200@github.com>

----==_mimepart_6ae94ad3e4b14_12712d01048f3
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"auto">ModuleLoader does <code class=3D"notranslate">use PAR</co=
de> at the top. PAR's import creates a cache directory in the first writa=
ble temporary directory (<code class=3D"notranslate">PAR_TMPDIR</code>, <=
code class=3D"notranslate">TMPDIR</code>, ..., then <code class=3D"notran=
slate">/tmp</code>). Where that cannot be made, for example when BarnOwl =
runs in a sandbox that may not write <code class=3D"notranslate">/tmp</co=
de> (Landlock), ModuleLoader fails to compile and Hooks.pm reports "Can't=
 load BarnOwl::ModuleLoader, loadable module support disabled": no module=
 loads, not even the unpacked ones in <code class=3D"notranslate">~/.owl/=
modules</code> that never use PAR.</p>
<p dir=3D"auto">Require and import PAR only when a <code class=3D"notrans=
late">.par</code> file is found. If that fails, report it for that module=
 and continue, so the unpacked modules still load. <code class=3D"notrans=
late">reload_libs</code> is called only when a <code class=3D"notranslate=
">.par</code> module was imported (<code class=3D"notranslate">@PAR::PAR_=
INC</code> is filled only after PAR's temp setup succeeds).</p>
<p dir=3D"auto">Seen with the Debian package of master under a Landlock s=
andbox that allows only the client's own HOME: before, <code class=3D"not=
ranslate">:goose</code> (an unpacked module in <code class=3D"notranslate=
">~/.owl/modules</code>) was "Unknown command" and the error above was sh=
own; after, the unpacked modules load and each <code class=3D"notranslate=
">.par</code> module (IRC, Jabber, Kerberos, Twitter, WordWrap) gets its =
own "Unable to load module" error.</p>
<p dir=3D"auto">Tests: t/moduleloader.t loads an unpacked module from a t=
emporary config dir and checks that PAR is not loaded, then adds a <code =
class=3D"notranslate">.par</code> module (built with Archive::Zip) and ch=
ecks that it loads and PAR is loaded. It fails on master (<a href=3D"http=
s://github.com/djbclark/barnowl/actions/runs/41567482068">https://github.=
com/djbclark/barnowl/actions/runs/41567482068</a>, tests 1 and 3) and pas=
ses with this change (<a href=3D"https://github.com/djbclark/barnowl/acti=
ons/runs/41567645662">https://github.com/djbclark/barnowl/actions/runs/41=
567645662</a>).</p>
<p dir=3D"auto">I searched this repository's pull requests for PAR, Modul=
eLoader, "cache directory", TMPDIR and "loadable module" first; the neare=
st are <a class=3D"issue-link js-issue-link" data-error-text=3D"Failed to=
 load title" data-id=3D"3652225" data-permission-text=3D"Title is private=
" data-url=3D"https://github.com/barnowl/barnowl/issues/91" data-hovercar=
d-type=3D"pull_request" data-hovercard-url=3D"/barnowl/barnowl/pull/91/ho=
vercard" href=3D"https://github.com/barnowl/barnowl/pull/91">#91</a> (loa=
d the Jabber module lazily) and <a class=3D"issue-link js-issue-link" dat=
a-error-text=3D"Failed to load title" data-id=3D"13015163" data-permissio=
n-text=3D"Title is private" data-url=3D"https://github.com/barnowl/barnow=
l/issues/129" data-hovercard-type=3D"pull_request" data-hovercard-url=3D"=
/barnowl/barnowl/pull/129/hovercard" href=3D"https://github.com/barnowl/b=
arnowl/pull/129">#129</a> (Perl module build cleanup), neither of which t=
ouches this.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>&nbsp;&nbsp;<a href=3D'https://github.com/barnowl/barnowl/pull/200'>ht=
tps://github.com/barnowl/barnowl/pull/200</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href=3D"https://github.com/barnowl/barnowl/pull/200/commits/2ed8=
b7eadbdbb4cfa890ac99b292f131118a6bc1" class=3D"commit-link">2ed8b7e</a>  =
Load PAR only when a .par module is found</li>
</ul>

<h4 style=3D"display: inline-block">File Changes </h4> <p style=3D"displa=
y: inline-block">(<a href=3D"https://github.com/barnowl/barnowl/pull/200/=
files">2&nbsp;files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href=3D"https://github.com/barnowl/barnowl/pull/200/files#diff-67f=
0e3b545a46366aed5e9c3c5f169eab7f6c33ba1b36e3624f3e5ddf8c38670">perl/lib/B=
arnOwl/ModuleLoader.pm</a>
    (12)
  </li>
  <li>
    <strong>A</strong>
    <a href=3D"https://github.com/barnowl/barnowl/pull/200/files#diff-ca2=
324472763824bd451cfda53310be34a087981edcf1763842d1c66f764b412">t/modulelo=
ader.t</a>
    (65)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href=3D'https://github.com/barnowl/barnowl/pull/200.patch'>https=
://github.com/barnowl/barnowl/pull/200.patch</a></li>
  <li><a href=3D'https://github.com/barnowl/barnowl/pull/200.diff'>https:=
//github.com/barnowl/barnowl/pull/200.diff</a></li>
</ul>

<p style=3D"font-size:small;-webkit-text-size-adjust:none;color:#666;">&m=
dash;<br />Reply to this email directly, <a href=3D"https://github.com/ba=
rnowl/barnowl/pull/200?email_source=3Dnotifications&amp;email_token=3DABC=
ERSISWIIJOIXUYZVPODT5XFBFHA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2W=
K43UF42TCMZRGA2DOMRQGCTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6=
Y3MNFRWW">view it on GitHub</a>, or <a href=3D"https://github.com/notific=
ations/unsubscribe-auth/ABCERSPTYR7EUXQNPG6V6C35XFBFHAVCNFSNUABCKJSXA33TN=
F2G64TZHM3TINZTGA4TWSLTON2WKOZWGE3TKMRWGU3DSOFBOYBA">unsubscribe</a>.<br =
/>Triage notifications, keep track of coding agent tasks and review pull =
requests on the go with GitHub Mobile for <a href=3D"https://github.com/n=
otifications/mobile/ios/ABCERSKS5SHLZW7KOKFFDQL5XFBFHA5CNFSNUABEM5UWIORPF=
5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMZRGA2DOMRQGCTHEZLBONXW5KTTOVRHGY3SNF=
RGKZFFMV3GK3TUVJTG633UMVZF62LPOM">iOS</a> and <a href=3D"https://github.c=
om/notifications/mobile/android/ABCERSNIDDDQ55665V4N73L5XFBFHA5CNFSNUABEM=
5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMZRGA2DOMRQGCTHEZLBONXW5KTTOV=
RHGY3SNFRGKZFFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE">Android</a>. Download it =
today!
<br />You are receiving this because you are subscribed to this thread.<i=
mg src=3D"https://github.com/notifications/beacon/ABCERSKPGC62QVXP73BOLET=
5XFBFHBFCNFSM6AAAAADEDMNKJ6WGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3J=
MTHQAAAAAFYBGE5CUZZGKYLTN5XKU43VMJZWG4TJMJSWI.gif" height=3D"1" width=3D"=
1" alt=3D"" /><span style=3D"color: transparent; font-size: 0; display: n=
one; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: =
0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span>&lt;barn=
owl/barnowl/pull/200</span><span>@</span><span>github</span><span>.</span=
><span>com&gt;</span></span></p>
<script type=3D"application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/barnowl/barnowl/pull/200?email_source=3Dnot=
ifications\u0026email_token=3DABCERSJC22LW4D5HMKYWSM35XFBFHA5CNFSNUABEM5U=
WIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMZRGA2DOMRQGCTHEZLBONXW5KTTOVRH=
GY3SNFRGKZFFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ",
"url": "https://github.com/barnowl/barnowl/pull/200?email_source=3Dnotifi=
cations\u0026email_token=3DABCERSJC22LW4D5HMKYWSM35XFBFHA5CNFSNUABEM5UWIO=
RPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TCMZRGA2DOMRQGCTHEZLBONXW5KTTOVRHGY3=
SNFRGKZFFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>

----==_mimepart_6ae94ad3e4b14_12712d01048f3--

home help back first fref pref prev next nref lref last post