From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout12.t-online.de (mailout12.t-online.de [194.25.134.22]) by sourceware.org (Postfix) with ESMTPS id D936D3858C52 for ; Sat, 9 Jul 2022 12:21:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D936D3858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=t-online.de Received: from fwd82.dcpf.telekom.de (fwd82.aul.t-online.de [10.223.144.108]) by mailout12.t-online.de (Postfix) with SMTP id 5621FB8C1 for ; Sat, 9 Jul 2022 14:21:16 +0200 (CEST) Received: from [192.168.2.102] ([87.187.34.65]) by fwd82.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1oA9SQ-0l93su0; Sat, 9 Jul 2022 14:21:10 +0200 Subject: Re: [PATCH setup] Add new option --chown-admin To: The Cygwin Mailing List References: <3096f251-d7ca-073b-d7d7-751b7fe3e8c1@t-online.de> <405df5c6-ce47-0254-ae4d-4a23ff3533d5@dronecode.org.uk> <5b45ccdc-da32-ff11-037f-c00828f397c5@dronecode.org.uk> From: Christian Franke Message-ID: <32655945-5075-0823-2a1d-b72caa4b7791@t-online.de> Date: Sat, 9 Jul 2022 14:21:09 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 SeaMonkey/2.53.12 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TOI-EXPURGATEID: 150726::1657369270-014275D8-7AB3134D/0/0 CLEAN NORMAL X-TOI-MSGID: 5471de1a-c338-4164-bc1f-918a4cd49dbe X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, BODY_8BITS, FREEMAIL_FROM, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jul 2022 12:21:19 -0000 Jon Turney wrote: > On 07/07/2022 15:45, Christian Franke wrote: >> Jon Turney wrote: >>> On 06/07/2022 17:34, Christian Franke wrote: >>>> Jon Turney wrote: >>>>> On 06/07/2022 08:14, Christian Franke wrote: > [...] >>>>>> >>>>>> BTW: 'nt_sec.setDefaultSecurity (isAdmin)' is never called with >>>>>> 'isAdmin==true' as 'root_scope' is always 0. >>>>> >>>>> root_scope is set later, by the "Install For" option on the >>>>> "Select Root Install Directory" page. >>>>> >>>>> To me, this looks like a (very long standing) bug that we >>>>> shouldn't be calling setAdminGroup() here, but after root_scope >>>>> has been set. >>>> >>>> If this bug is very old, I'm not sure whether this should be fixed. >>>> Setting admin group to files which are owned "only" by current user >>>> is possibly not very effective. >>> >>> It's true that some people might be relying on that buggy behaviour. >> >> I have one very old Cygwin installation from Win7 times. Very old >> installed files still have group="Administrator", newer files have >> group="None". The timestamps suggest that the regression was >> introduced early in 2012. The first file with group="None" is from >> March 2 2012. > > Hmm... [1] seems like the obvious suspect for the change responsible > for that, but I don't immediately see how... > > [1] > https://cygwin.com/git/?p=cygwin-apps/setup.git;a=commitdiff;h=befc9dd806824f22ebb740be96ba8c0ae8f63bb4;hp=34d534a6d74e5516d6691fb1d9cb6309682afa0b > Hmm... correct as this change moves UserSettings ctor behind setDefaultSecurity (): Old version 34d534a: ... UserSettings Settings (local_dir); ... nt_sec.setDefaultSecurity (); ... Main.WindowCreate() New version befc9dd: ... nt_sec.setDefaultSecurity (); ... UserSettings Settings (local_dir); ... Main.WindowCreate() The UserSettings ctor has a somewhat hidden side effect which sets root_scope correctly:  UserSettings::UserSettings(...);   open_settings("setup.rc", ...);    io_stream::open("cygfile:///etc/setup/setup.rc", ...);     io_stream_cygfile::io_stream_cygfile("/etc/setup/setup.rc", ...);      get_root_dir_now();       read_mounts("");        read_mounts_nt("");         root_scope = isuser ? IDC_ROOT_USER : IDC_ROOT_SYSTEM; Conclusion: Regression introduced Feb 24, 2012 (befc9dd).