Re: Permission denied when chainbuilding packages with mock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes - here is a trivial reproducer (excuse the ugly sample cut-n-paste)

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

int main(int argc, char *argv[]) {
char *str = "Text to be added";
int fd, ret, fsyncrc, fsyncr_rc, openrc, closerc, close2rc;

fd = creat("test.txt", S_IWUSR | S_IRUSR);
if (fd < 0) {
perror("creat()");
exit(1);
}
ret = write(fd, str, strlen(str));
if (ret < 0) {
perror("write()");
exit(1);
}
openrc = open("test.txt", O_RDONLY);
        if (openrc < 0) {
                perror("creat()");
                exit(1);
        }
fsyncr_rc = fsync(openrc);
if (fsyncr_rc < 0)
perror("fsync()");
fsyncrc = fsync(fd);
closerc = close(fd);
close2rc = close(openrc);
printf("read fsync rc=%d, write fsync rc=%d, close rc=%d, RO close
rc=%d\n", fsyncr_rc, fsyncrc, closerc, close2rc);
}

On Mon, Nov 8, 2021 at 10:47 AM Jeremy Allison <jra@xxxxxxxxx> wrote:
>
> On Mon, Nov 08, 2021 at 07:59:49AM +0100, Julian Sikorski wrote:
> >I will try to generate a log for the working case later. Having said
> >that, the question becomes: why are some files read-only but others
> >are not, when they are generated by the same software in the same
> >folder? The permissions on both folders are exactly the same:
>
> It's nothing to do with the permissions on the files. It's to
> do with the open mode the client uses when opening the file.



-- 
Thanks,

Steve



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux