Anticanonicalize
anticanonicalize is a tool which runs a command with the current working directory set to an "unreachable" version of the directory.
Install / Use
/learn @ComputerDruid/AnticanonicalizeREADME
anticanonicalize is a tool which runs a command with the current working directory set to an "unreachable" version of the directory.
Some things that work:
anticanonicalize lsanticanonicalize bash -i(although it'll print some warnings and show "." as the cwd on the prompt)
Some things that don't work:
anticanonicalize pwd(this is the whole point)anticanonicalize cargo check(error: Unable to proceed. Could not locate working directory.: No such file or directory (os error 2))
To try it yourself, get a rust toolchain if you don't have one already and run cargo install --git https://github.com/ComputerDruid/anticanonicalize
How?
Basically:
unshare --user --mount --map-rootto make a mount namespace, and inside:mount --bind . $some_tmpdirto bind mount it somewhere that won't be visible outside the namespace- open a file descriptor for
$some_tmpdirand send it back outside the mount namespace with a unix domain socket.
fchdirthe received file descriptor to cd thereexecthe specified command
Why??
Well, it's fun!
Also, this is theoretically useful as a tool to prove that some command does not rely on the absolute paths of its inputs. In general, I want that property in build systems because I want to be able to share build caches between multiple checkouts/worktrees.
Unfortunately, in practice this breaks many many things, so it's unlikely you can use this technique to prove anything about real builds.
Also, a given tool could have fallback logic to handle this case, so unless you always run your build with anticanonicalize, it still might rely on absolute paths when you don't run it that way.
License
Copyright 2025 Daniel Johnson et al.
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
