NetBSD Problem Report #58270

From www@netbsd.org  Mon May 20 07:42:39 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 458C41A9264
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 20 May 2024 07:42:39 +0000 (UTC)
Message-Id: <20240520074237.DD64B1A9265@mollari.NetBSD.org>
Date: Mon, 20 May 2024 07:42:37 +0000 (UTC)
From: RVP@SDF.ORG
Reply-To: RVP@SDF.ORG
To: gnats-bugs@NetBSD.org
Subject: tic(1) always creates files with mode 0666
X-Send-Pr-Version: www-1.0

>Number:         58270
>Category:       bin
>Synopsis:       tic(1) always creates files with mode 0666
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          pending-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 20 07:45:00 +0000 2024
>Closed-Date:    
>Last-Modified:  Mon Oct 14 16:30:02 +0000 2024
>Originator:     RVP
>Release:        NetBSD/amd64 10.99.10
>Organization:
>Environment:
NetBSD/amd64 10.99.10
>Description:
tic(1) doesn't honour user's umask. It always creates output files having mode 0666.


>How-To-Repeat:
$ umask 022; tic -x -o x.cdb /usr/share/misc/terminfo; ls -l x.cdb
-rw-rw-rw-  1 rvp  wheel  2006370 May 20 07:39 x.cdb
$ umask 077; tic -x -o x.cdb /usr/share/misc/terminfo; ls -l x.cdb
-rw-rw-rw-  1 rvp  wheel  2006370 May 20 07:39 x.cdb
$ 

>Fix:
diff -urN a/tic.c b/tic.c
--- a/tic.c	2024-05-12 03:21:53.102375590 +0000
+++ b/tic.c	2024-05-20 07:28:21.977135183 +0000
@@ -589,7 +589,8 @@
 	if (cdbw_output(db, fd, "NetBSD terminfo", cdbw_stable_seeder))
 		err(EXIT_FAILURE,
 		    "writing temporary database %s failed", tmp_dbname);
-	if (fchmod(fd, DEFFILEMODE))
+	mode_t m = umask(0077); (void)umask(m);
+	if (fchmod(fd, DEFFILEMODE & ~m))
 		err(EXIT_FAILURE, "fchmod failed");
 	if (close(fd))
 		err(EXIT_FAILURE,

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58270 CVS commit: src/usr.bin/tic
Date: Mon, 20 May 2024 10:41:37 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Mon May 20 14:41:37 UTC 2024

 Modified Files:
 	src/usr.bin/tic: tic.c

 Log Message:
 PR/58270: RVP: tic does not honor the user's umask, output files are 0666.


 To generate a diff of this commit:
 cvs rdiff -u -r1.41 -r1.42 src/usr.bin/tic/tic.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 23 Jul 2024 21:08:55 +0000
State-Changed-Why:
probably needs pullup-10 and pullup-9


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58270 CVS commit: [netbsd-10] src/usr.bin/tic
Date: Thu, 12 Sep 2024 19:53:41 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Sep 12 19:53:41 UTC 2024

 Modified Files:
 	src/usr.bin/tic [netbsd-10]: tic.c

 Log Message:
 Pull up following revision(s) (requested by rin in ticket #846):

 	usr.bin/tic/tic.c: revision 1.42

 PR/58270: RVP: tic does not honor the user's umask, output files are 0666.


 To generate a diff of this commit:
 cvs rdiff -u -r1.40.6.1 -r1.40.6.2 src/usr.bin/tic/tic.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 14 Oct 2024 00:25:19 +0000
State-Changed-Why:
pullup-10 #846 https://releng.netbsd.org/cgi-bin/req-10.cgi?show=846
pullup-9 #1911 https://releng.netbsd.org/cgi-bin/req-9.cgi?show=1911


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58270 CVS commit: [netbsd-9] src/usr.bin/tic
Date: Mon, 14 Oct 2024 16:29:22 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Mon Oct 14 16:29:22 UTC 2024

 Modified Files:
 	src/usr.bin/tic [netbsd-9]: tic.c

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #1911):

 	usr.bin/tic/tic.c: revision 1.42

 PR/58270: RVP: tic does not honor the user's umask, output files are 0666.


 To generate a diff of this commit:
 cvs rdiff -u -r1.31 -r1.31.6.1 src/usr.bin/tic/tic.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.