- Notifications
You must be signed in to change notification settings - Fork1.3k
libmount: non-root mkdir support#3640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Signed-off-by: Karel Zak <kzak@redhat.com>
* introduce do_canonicalize() with proper return values * use do_canonicalize() everywhereSigned-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
* add ul_restricted_path_oper() to fileutils.c* use it as backed for canonicalize_path_restricted()Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Based on ul_restricted_path_oper().Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Based-on:util-linux#3597Signed-off-by: Karel Zak <kzak@redhat.com>
fb3655d to02f6eb5CompareSigned-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Uh oh!
There was an error while loading.Please reload this page.
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
* test classic user-mount (mount.static required)* test user-mount with X-mount.mkdirSigned-off-by: Karel Zak <kzak@redhat.com>
lib/canonicalize.c Outdated
| len=canonical ?(ssize_t)strlen(canonical) : | ||
| errno ?-errno :-EINVAL; | ||
| len=canonical ?(ssize_t)strlen(canonical) : | ||
| errno ?-errno :-EINVAL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Spurious whitespace changes? If intentional should be in a dedicated commit.
| if (!path|| !*path) | ||
| returnNULL; | ||
| if (result) | ||
| *result=NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
result seems to be always non-NULL.
| return-errno; | ||
| } | ||
| errno=0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Seems unnecessary.
| * unreachable path is not an error (!), and in this case, it just duplicates | ||
| * @path. | ||
| */ | ||
| char*canonicalize_path(constchar*path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Shouldn't these also all get theul_ prefix?
| fprintf(stdout,"real: %s\n",canonicalize_path(argv[1])); | ||
| fprintf(stdout,"real: %s\n",canonicalize_path(argv[1])); | ||
| fprintf(stdout,"real-restricted: %s\n",canonicalize_path_restricted(argv[1])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can this be used to have a real unittest which validates the results?
| ts_init_subtest"basic" | ||
| TS_FSTAB="/etc/fstab" | ||
| ts_fstab_add$MOUNT_SOURCE$MOUNT_TARGET"none""bind,user,default,noauto" | ||
| runuser -u testuser_mount --$TS_CMD_MOUNT_STATIC$MOUNT_TARGET>>$TS_OUTPUT2>>$TS_ERRLOG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Maybe use therunuser from the current build.
| # Add test user | ||
| # | ||
| useradd -u 9899 --shell /bin/bash testuser_mount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Not a fan of this. Can we usenobody?
Or just a random user id from a transient uid range.
| # classic user-mount | ||
| # | ||
| ts_init_subtest"basic" | ||
| TS_FSTAB="/etc/fstab" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is the regular test fstab not enough?
| runuser -u testuser_mount --$TS_CMD_MOUNT_STATIC$MOUNT_TARGET>>$TS_OUTPUT2>>$TS_ERRLOG | ||
| opts=$(findmnt -nr -o VFS-OPTIONS --mountpoint$MOUNT_TARGET) | ||
| [[$opts==*"noexec"*&&$opts==*"nosuid"*&&$opts==*"nodev"* ]] \ | ||
| || ts_log"Cannot find user options" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
ts_errlog
| TS_FSTAB="/etc/fstab" | ||
| ts_fstab_add$MOUNT_SOURCE$MOUNT_TARGET"none""bind,user,default,noauto" | ||
| runuser -u testuser_mount --$TS_CMD_MOUNT_STATIC$MOUNT_TARGET>>$TS_OUTPUT2>>$TS_ERRLOG | ||
| opts=$(findmnt -nr -o VFS-OPTIONS --mountpoint$MOUNT_TARGET) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
TS_CMD_FINDMNT
karelzak commentedAug 27, 2025
I'll split this pull request into three separate pull requests:
I'll keep it open as a draw until all is implemented. |
No description provided.