From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E8F4A3851C1B; Thu, 2 Jul 2020 16:23:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E8F4A3851C1B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593707017; bh=ZavOc0Ym7AJlh8KtH8lDXfhOXy6JBXRhLU8W4FSYmy4=; h=From:To:Subject:Date:From; b=pOJc60612/pcQ5B+3iAVLBh8193hb7bTNMHN+4Qui63gK2ykpbTnUyDyCpJ28OCZc 53M/xoapDOY3mYoz8WM63JUTm+Q6Chn/8cHM8umQ7elTadM6QtEsauyvCwtEDQyz22 AnY7IlJ2gDSqKkjALfVdVAMNUm5N493ICglD7APo= From: "michelpalleau at yahoo dot fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgcc/96035] New: directories created when writing gcov data have limited rights compared to umask Date: Thu, 02 Jul 2020 16:23:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgcc X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: michelpalleau at yahoo dot fr X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2020 16:23:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96035 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=3D0755, while gocv data files will be created with rights=3D0666. 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), consist= ing of several executables that are running with different uids. Even with a umask=3D0, the first executable that ends will create the directories and i= ts 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.=