[PR #7151] [MERGED] feature: allow subpaths in xdg macros #6344

Closed
opened 2026-05-05 10:55:09 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netblue30/firejail/pull/7151
Author: @kmk3
Created: 4/27/2026
Status: Merged
Merged: 5/1/2026
Merged by: @kmk3

Base: masterHead: improve-xdg-macros


📝 Commits (5)

  • 1155e0d macros.c: fix whitespace after if in expand_macros()
  • 8e1954d macros.c: remove redundant braces in expand_macros()
  • 68d16bf macros.c: deduplicate code in expand_macros()
  • c2f1201 macros.c: sort macro array
  • aff7cb6 feature: allow subpaths in xdg macros

📊 Changes

8 files changed (+299 additions, -65 deletions)

View changed files

📝 src/firejail/firejail.h (+3 -3)
📝 src/firejail/fs_whitelist.c (+2 -2)
📝 src/firejail/macros.c (+55 -60)
📝 test/fs/fs.sh (+21 -0)
test/fs/macro-subpath-blacklist.profile (+6 -0)
test/fs/macro-subpath-readonly.profile (+6 -0)
test/fs/macro-subpath-whitelist.profile (+6 -0)
test/fs/macro-subpath.exp (+200 -0)

📄 Description

Currently it is not possible to use XDG-related macros (such as
${DOCUMENTS}) with subpaths (such as ${DOCUMENTS}/foo) and so
profiles just use ${HOME} with a hardcoded path using the English
directory name and the subpath (such as ${HOME}/Documents/foo).

Allow using subpaths after XDG macros, so that they automatically use
the auto-detected XDG path, just as when currently using the XDG macros
without subpaths.

Before:

${HOME}/Documents/foo

After:

${DOCUMENTS}/foo

This is a follow-up to #7147.

Closes #2359.

Relates to #4229.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netblue30/firejail/pull/7151 **Author:** [@kmk3](https://github.com/kmk3) **Created:** 4/27/2026 **Status:** ✅ Merged **Merged:** 5/1/2026 **Merged by:** [@kmk3](https://github.com/kmk3) **Base:** `master` ← **Head:** `improve-xdg-macros` --- ### 📝 Commits (5) - [`1155e0d`](https://github.com/netblue30/firejail/commit/1155e0da0ffb55beb6f395a60f65b1097387433d) macros.c: fix whitespace after if in `expand_macros()` - [`8e1954d`](https://github.com/netblue30/firejail/commit/8e1954d8875057ecb39583b771df20c5c2f432df) macros.c: remove redundant braces in `expand_macros()` - [`68d16bf`](https://github.com/netblue30/firejail/commit/68d16bf9da2c7492fd6bc218581fdb75805ee48e) macros.c: deduplicate code in `expand_macros()` - [`c2f1201`](https://github.com/netblue30/firejail/commit/c2f12016f2af919f4bc60d3280be352e65ce852b) macros.c: sort macro array - [`aff7cb6`](https://github.com/netblue30/firejail/commit/aff7cb630c80248791273a2bec4bc87461e38a3e) feature: allow subpaths in xdg macros ### 📊 Changes **8 files changed** (+299 additions, -65 deletions) <details> <summary>View changed files</summary> 📝 `src/firejail/firejail.h` (+3 -3) 📝 `src/firejail/fs_whitelist.c` (+2 -2) 📝 `src/firejail/macros.c` (+55 -60) 📝 `test/fs/fs.sh` (+21 -0) ➕ `test/fs/macro-subpath-blacklist.profile` (+6 -0) ➕ `test/fs/macro-subpath-readonly.profile` (+6 -0) ➕ `test/fs/macro-subpath-whitelist.profile` (+6 -0) ➕ `test/fs/macro-subpath.exp` (+200 -0) </details> ### 📄 Description Currently it is not possible to use XDG-related macros (such as `${DOCUMENTS}`) with subpaths (such as `${DOCUMENTS}/foo`) and so profiles just use `${HOME}` with a hardcoded path using the English directory name and the subpath (such as `${HOME}/Documents/foo`). Allow using subpaths after XDG macros, so that they automatically use the auto-detected XDG path, just as when currently using the XDG macros without subpaths. Before: ${HOME}/Documents/foo After: ${DOCUMENTS}/foo This is a follow-up to #7147. Closes #2359. Relates to #4229. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 10:55:09 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#6344
No description provided.