ComixHe
56bb0d1e6b
build: CPM is disabled by default
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-10-15 15:35:07 +08:00
ComixHe
72ca241a20
chore: update CPM.cmake to 0.42.0
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-10-15 15:35:07 +08:00
ComixHe
11face2e94
chore: formatting codes
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-10-13 11:28:59 +08:00
ComixHe
04aface617
chore(tools): add clang-format script for formatting C++ sources
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-10-13 11:28:59 +08:00
ComixHe
08b790480d
feat: allow cn.org.linyaps.runtime.ns_last_pid extension failed
...
if /proc/sys/kernel/ns_last_pid doesn't exist, skip this extension.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-10-13 11:28:59 +08:00
deepsource-autofix[bot]
53f0e1e835
style: format code with ClangFormat and Prettier
...
This commit fixes the style issues introduced in 881bcc9 according to the output
from ClangFormat and Prettier.
Details: None
2025-10-13 10:57:55 +08:00
ComixHe
881bcc93c0
fix: move the one of sockpairs to child container process
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-10-09 15:20:07 +08:00
ComixHe
0e5def0fe2
refactor: change the default open flag
...
make O_PATH as the default flag.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-09-15 14:32:46 +08:00
ComixHe
9204ffba0c
fix: use O_PATH flag when masking paths to avoid permission issues
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-09-15 14:21:39 +08:00
ComixHe
3b94fbcf43
fix(deps): upgrade CLI11 to 2.5.0 to resolve bug in argument parsing
...
See 7ff65c16f2
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-09-11 17:59:04 +08:00
ComixHe
4ad30a7efb
fix: correct variable name
...
Fixes #115
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-09-05 14:16:53 +08:00
ComixHe
24a6a99f98
feat: implement preserve_fds support and fix file descriptor handling
...
- Add --preserve-fds command line option for runtime
- Refactor container creation with unified options structure
- Improve file_descriptor class API
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-09-01 14:13:21 +08:00
ComixHe
b1c7fa13d8
fix: handle broken symlinks during mount destination creation
...
When a destination file doesn't exist, the previous implementation couldn't
distinguish between creation failure due to existing files vs other reasons.
If both opening and creating fail, the destination is definitely a broken symlink.
- Add recursive symlink resolution with depth limit (32) in create_destination_file()
- Use O_NOFOLLOW to detect symlink during file creation
- When creation fails with ELOOP, read symlink target and recursively create it
- Replace filesystem functions with internal utils for consistent error handling
- Add proper broken symlink detection and resolution logic
This ensures mount destinations work correctly even when they point to
broken symlinks, by creating the missing target files in the symlink chain.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-08-29 17:51:36 +08:00
ComixHe
08c47fff3c
refactor: resolving the most of compiler warnings
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-08-26 14:45:06 +08:00
ComixHe
e62d7d53e4
fix: early return if an exception is thrown while command parsing
...
According the documentation of CLI11, this library will throw a exception
while encounter -h,--help or a parse error.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-08-25 10:44:11 +08:00
ComixHe
2b51656a6e
chore: suppress compiler warning
...
If the log level is higher than debug level
the dump_mount_flags function will not be called.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-08-25 10:29:21 +08:00
taotieren
2a8c21b681
docs: Update linyaps-box documentation
...
1. Update linyaps-box package status
docs: 更新 linyaps-box文档
1. 更新 linyaps-box 软件包状态
2025-08-20 15:27:24 +08:00
ComixHe
61d1b26eae
feat: add ns_last_pid extension test and enhance test framework
...
- Add comprehensive test for ns_last_pid extension
- Improve test script JSON merging capabilities
- Update existing tests and CMake configuration
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-08-06 11:53:44 +08:00
ComixHe
53883d5bf4
improve: add system error details to file operation error handling
...
Replace std::runtime_error with std::system_error for better debugging.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-08-06 11:53:44 +08:00
ComixHe
55a147033b
chore: bump version to 2.1.0
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-08-06 10:59:45 +08:00
ComixHe
308b80bacf
feat: add rootfsPropagation support and improve error handling
...
- Add rootfsPropagation field to linux config (shared/slave/private/unbindable)
- Fix mount propagation flag handling (use |= instead of &=)
- Replace std::cerr with LINYAPS_BOX_ERR() for consistent logging
- Use _exit() instead of exit() in child processes
- Improve error messages with better context
Allows control over mount propagation for the root filesystem according
to OCI spec.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-08-05 15:43:50 +08:00
ComixHe
16f40a416a
fix: resolve GCC enum conversion error in MountFlag
...
Use std::underlying_type_t to fix "int cannot be converted to unnamed enum"
compilation error on older GCC versions.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-23 13:47:39 +08:00
ComixHe
3951cfc9b2
fix: some warnings
...
- non-const global variable
- avoid array-to-pointer decay
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-23 13:23:47 +08:00
ComixHe
0bb8d07bb2
feat: add runtime extension 'cn.org.linyaps.runtime.ns_last_pid'
...
Add support for the 'cn.org.linyaps.runtime.ns_last_pid' runtime extension
that allows setting the last PID in the namespace during container startup.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-23 13:23:47 +08:00
ComixHe
ee4e07a827
refactor: resolve some warnings from static check
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-23 11:38:07 +08:00
ComixHe
e31f62f382
build: specifying the internal library type explicitly
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-21 10:17:01 +08:00
dengbo
000fa7ff73
chore: add deepsource config
...
Add deepsource config.
2025-07-18 14:50:46 +08:00
ComixHe
1fd78ccf1a
chore: update CMake preset
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-18 11:15:47 +08:00
ComixHe
f30bf60148
build: add an option to generate version
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-17 21:25:25 +08:00
ComixHe
aa58f981ef
fix: 'cgroup-manager' is not assigned while creating container
...
make 'disabled' as the default value of field 'cgroup-manager'
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-17 21:11:20 +08:00
ComixHe
489cc336e4
fix: correct ptmx source location
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-14 14:59:23 +08:00
ComixHe
35ac00a66a
feat: support runtime Dev symbolic link
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-01 20:10:47 +08:00
ComixHe
9d524a908c
feat: bind mount /dev/pts/ptmx to /dev/ptmx
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-01 20:10:47 +08:00
ComixHe
46ff1b817f
fix: correct the default value of open_at parameter 'mode'
...
if mode is nonzero, but how.flags does not contain O_CREAT or O_TMPFILE
will cause an EINVAL.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-07-01 17:32:51 +08:00
ComixHe
e714f88ba3
chore: update CMakePresets
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-20 17:19:55 +08:00
ComixHe
995231effc
feat: add option '--env' for exec
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-17 16:24:06 +08:00
ComixHe
123cfeb539
chore: add version information for vendoring dependencies
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-13 13:12:28 +08:00
ComixHe
9887a351c4
fix: remove nsenter option '--wdns'
...
old nsenter command doesn't support '--wdns'.
remove this option for now.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-12 11:24:03 +08:00
ComixHe
37f8126145
fix: correct fallback syscall number
...
__NR_close_range should be 436.
include sys/syscall.h instead of asm/unistd.h.
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-12 11:00:29 +08:00
ComixHe
bcd7063161
Revert "fix: do not define syscall number directly"
...
This reverts commit 2cb58b3a0f .
2025-06-12 11:00:29 +08:00
Iceyer
16ed42928d
fix: correct output flag name in inspect_fcntl_or_open_flags
...
The function was incorrectly outputting 'O_SYNC' when checking for
the O_NDELAY flag. This was likely a copy-paste error that could
cause confusion when debugging file descriptor flags.
The issue was in the inspect_fcntl_or_open_flags function where
the condition checked for O_NDELAY but output the wrong flag name.
Changed:
- Fixed output from 'O_SYNC' to 'O_NDELAY' to match the actual flag being checked
2025-06-12 09:31:21 +08:00
ComixHe
2cb58b3a0f
fix: do not define syscall number directly
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-11 18:17:20 +08:00
ComixHe
cc49934702
fix: avoid dead loop in close_range_fallback
...
add helper class 'defer'
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-06-04 11:48:34 +08:00
ComixHe
d2b7adbb1d
feat: add flag 'mount_dev_from_host'
...
skip processing default devices if user binds '/dev' from host
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-05-30 17:56:03 +08:00
ComixHe
4f8ad981d5
build: add public definition 'LINYAPS_BOX_STATIC_LINK' to library target
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-05-30 16:19:26 +08:00
ComixHe
594bedcf1c
refactor: add version flag
...
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
2025-05-23 14:32:44 +08:00
ComixHe
25fdeda582
refactor: try single mapping at first if it could be
...
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-05-08 15:32:36 +08:00
ComixHe
6b9422ff84
refactor: remove unneed shared_ptr
...
improve open/open_at
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-04-30 17:40:13 +08:00
ComixHe
4d3d0002f2
test: ignore deprecated warning from libstdc++
...
refer: 5c34f02ba7
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-04-30 16:42:57 +08:00
ComixHe
f1378216b3
chore: correct log
...
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-04-30 12:10:53 +08:00