-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
9pfs, vfscore: Fix symlink support for 9pfs #830
Conversation
6cd13fa
to
734f248
Compare
Hi, @andraprs. Thanks for the fix. This works. I added two tests in the @maniatro111, @John-Ted, I'll wait for you to do your own review and testing, and then I'll approve the PR. |
Hi, I tested this and have encountered a problem. The config_notworking.txt Test program: #include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#define FILENAME "symlink_inside_2"
#define ORIG_FILENAME "abc.txt"
int main()
{
char buf[10];
strcpy(buf, "abcdefg");
int ret = symlink(ORIG_FILENAME, FILENAME);
printf("symlink call returned %d\n", ret);
if (ret < 0) {
printf("failed to create symlink errno=%d\n", errno);
return 1;
}
int fd = open(FILENAME, O_RDWR);
printf("fd=%d\n", fd);
if (fd < 0) {
printf("open failed errno=%d\n", errno);
return 1;
}
ret = write(fd, "abcd", 4); //read(fd, buf, 9);
buf[10]='\0';
if (ret < 0) {
printf("write failed errno=%d\n", errno);
return 1;
}
//printf("read buffer: %s\n", buf);
ret = close(fd);
if (ret < 0) {
printf("close failed errno=%d\n", errno);
return 1;
}
return 0;
} With the first config, I get the output:
With the second config, I get:
On the first config, debug messages are enabled, on the second one, debug messages are disabled. There are no other differences as far as I can tell. In both cases, Also, if a symlink inside |
Thank you for trying it out and adding the tests. |
Thank you for the shared details, Teo. I'll try to reproduce and identify what happens. |
I added a fix to this PR, for the mentioned issue. I checked it out using the provided test program. Let me know if the logic works fine now. Thank you. :) With regard to the access outside [1] https://wiki.qemu.org/Documentation/9psetup#Starting_the_Guest_directly |
d9867d8
to
45d00c7
Compare
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.
Everything works fine now, thanks!
Reviewed-by: Ioan-Teodor Teugea ioan_teodor.teugea@stud.acs.upb.ro
✅ Checkpatch passed Beep boop! I ran Unikraft's
|
Hello! Sorry for being so late. It also works on my side. To test this, I used this repo. It made easier to test I just have one question. I tried to create the Otherwise, it works for me. |
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.
Reviewed-by: Florin Postolache florin.postolache.of@gmail.com
No problem, thank you for trying it out. :) With regard to the As we've discussed during the Application Compatibility community meeting, the next step is to create a GitHub issue to track this. Thank you for looking into it. |
45d00c7
to
0665e4e
Compare
Opening a symlink file doesn't successfully complete. The mountpoint length provided to the function that resolves a symlink needs to be adjusted. Update the mountpoint length to be the difference in size between the full path of the symlink file and the relative path of the symlink file to the mountpoint. Signed-off-by: Andra Paraschiv <andra@unikraft.io>
Sometimes the fp local string variable includes data that was used before e.g. previous file paths. Thus, fp can contain characters that are not part of the currently processed file path and different errors can appear e.g. ENOENT (No such file or directory), when trying to open a file. Initialize the fp variable to an empty string before using it. Signed-off-by: Andra Paraschiv <andra@unikraft.io>
Till now, symlink files could be created / opened only when using the UK_9P_PROTO_2000L 9pfs version. The current default 9pfs version is UK_9P_PROTO_2000U. Enable the symlink support also for the UK_9P_PROTO_2000U 9pfs version. Signed-off-by: Andra Paraschiv <andra@unikraft.io>
0665e4e
to
eddf4f0
Compare
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.
Thanks, @andraprs.
Reviewed-by: Razvan Deaconescu razvand@unikraft.io
Approved-by: Razvan Deaconescu razvand@unikraft.io
Sometimes the fp local string variable includes data that was used before e.g. previous file paths. Thus, fp can contain characters that are not part of the currently processed file path and different errors can appear e.g. ENOENT (No such file or directory), when trying to open a file. Initialize the fp variable to an empty string before using it. Signed-off-by: Andra Paraschiv <andra@unikraft.io> Reviewed-by: Florin Postolache <florin.postolache.of@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #830
Till now, symlink files could be created / opened only when using the UK_9P_PROTO_2000L 9pfs version. The current default 9pfs version is UK_9P_PROTO_2000U. Enable the symlink support also for the UK_9P_PROTO_2000U 9pfs version. Signed-off-by: Andra Paraschiv <andra@unikraft.io> Reviewed-by: Florin Postolache <florin.postolache.of@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #830
Prerequisite checklist
checkpatch.pl
on your commit series before opening this PR;Base target
x86_64
kvm
app-helloworld
Checked out the fix using:
// Open a symlink file
<symlink-file> exists in the rootfs filesystem (9pfs type).
// Create a symlink file
<symlink-target-file> exists in the rootfs filesystem (9pfs type).
Additional configuration
Description of changes