https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96035
Bug ID: 96035 Summary: directories created when writing gcov data have limited rights compared to umask Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcc Assignee: unassigned at gcc dot gnu.org Reporter: michelpalleau at yahoo dot fr Target Milestone: --- In libgcov-driver-system.c, function create_file_directory(), any missing directory is created with "mkdir(filename, 0755)". >From mkdir's man page: the argument mode specifies the permissions to use. It is modified by the process's umask in the usual way: the permissions of the created directory are (mode & ~umask & 0777). So if the process umask is set to 0, the directories will be created with rights=0755, while gocv data files will be created with rights=0666. I do not see the rationale to prevent group & other write permissions on the created directories if the process umask is not preventing it. I think the code should be "mkdir(filename, 0777)", so that all directories and files are created with the process umask. No more, no less. Long story: I work on an embedded project (with cross compilation), consisting of several executables that are running with different uids. Even with a umask=0, the first executable that ends will create the directories and its coverage files, and the other executables won't be able to write their own files. If I run all the executables with the same uid, I do not face the problem.