From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) by sourceware.org (Postfix) with ESMTPS id BFEE73858D28 for ; Fri, 7 Apr 2023 22:20:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFEE73858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=Shaw.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=shaw.ca Received: from shw-obgw-4002a.ext.cloudfilter.net ([10.228.9.250]) by cmsmtp with ESMTP id ktJQpvtVguZMSkuRlp92zB; Fri, 07 Apr 2023 22:20:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=shaw.ca; s=s20180605; t=1680906041; bh=1xs7xaYkMCRMP3/uevUE7HWPjH2rVDE4j3OZKMLs6iU=; h=Date:Reply-To:Subject:To:References:Cc:From:In-Reply-To; b=vsDa+n0BvEr8+x/Q6EM7L0PpKyzAw3uaO2WRAhL+fuN1tNfhJXTCsIurdugBtE6Zk WURTmN0XgDypK05DVOiSaaLhG2ihk2cjOUVuUeqtXBYjR64iVvSbgpmyENCjmb8+Gd l9m8ZYgG/DCaf9c9i/5nyFDKgV8FKOhHHmnA7wSxEJzvOHWoPcXRLL0vM6ClA0INe8 OHCrvexeWBZdJG3yJIUFsRq7cWqhsELWO+oQ0s7rBafrexSDVZtu4LNataeLseyDmj STyiIPoYWqOrmBe/ZCWjHlw093LO0YuEj8uy9F3euT3RFzt8LtzgfzBz6/wrvjwjV9 t2xYn+TFc/DEg== Received: from [10.0.0.5] ([184.64.102.149]) by cmsmtp with ESMTP id kuRkpAFFUyAOekuRkpRdGc; Fri, 07 Apr 2023 22:20:41 +0000 X-Authority-Analysis: v=2.4 cv=e5oV9Il/ c=1 sm=1 tr=0 ts=64309739 a=DxHlV3/gbUaP7LOF0QAmaA==:117 a=DxHlV3/gbUaP7LOF0QAmaA==:17 a=IkcTkHD0fZMA:10 a=g66GJ4__9IZaR6cqYIkA:9 a=QEXdDO2ut3YA:10 Message-ID: Date: Fri, 7 Apr 2023 16:20:40 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Reply-To: cygwin@cygwin.com Subject: Re: Howto fix C:\cygwin acl after backup/restore? Content-Language: en-CA To: cygwin@cygwin.com References: <77a9a77a-8848-f582-18c9-2d2b13a71d4f@bfs.de> Cc: Thomas Schweikle From: Brian Inglis Organization: Inglis In-Reply-To: <77a9a77a-8848-f582-18c9-2d2b13a71d4f@bfs.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfC1WDZtMSjiB3ZhM3irnYYu6gzjiv8Fdci+wMSyaTqcll689Mjd7WC4a3NpcisW4K0jq8Tlt6rim62zH7i+4iURuuC8VycSLroc2Vb3sMj9O5qnN6H97 saFVZ+/XxrTOuV9fSIr2DQA8i/HpVAAX6M1Kkx30E+OeVmmK5iP/Kp7UUrD36Fyu47/TOwJqb4zSCmLfm5LWFgAXszWBjHhUy0Q= X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-04-07 14:36, Thomas Schweikle via Cygwin wrote: > How can C:\cygwin ACL be fixed after a backup/restore (file by file, not image). > The program seems to force canonical ACL while restoring. > How do i get back ACL as they are right after installing cygwin? > Docs did not help here. They discussed Windows-ACL to POSIX-ACL or simple > rwxrwxrwx POSIX rights used on most *nix machines, but at no point where > concrete ACL shown as they are supposed to be applied to the installed C:\cygwin > tree. > Any idea? Any script? Any existing command to recreate recommended ACLs? For the Cygwin root directory, normal u+rwx,go+rx perms are sufficient. For other Cygwin files where perms are significant, you should use Cygwin backup/restore utilities e.g. rsync, tar, cpio, etc. Without some image of Cygwin ACLs, you can not restore them as they were, as in the setfacl(1) example: $ getfacl source_file | setfacl -f - target_file or an equivalent en masse. For user created files and scripts, use relevant normal permissions. For installed files, if you have a complete and current package cache directory, you can compare the installation to the latest archive of each package under /{x86_64,noarch}/release/ looping thru: tar -d -C / -f /{x86_64,noarch}/release//.../...--.tar.*z* e.g. $ tar -d -C / -f ~/mirror/x86_64/release/bash/bash-4.4.12-3.tar.xz /bin/tar: etc/postinstall/bash.sh: Warning: Cannot stat: No such file or directory usr/bin/bash.exe: Uid differs usr/bin/bash.exe: Gid differs usr/bin/bashbug: Mode differs usr/bin/bashbug: Uid differs usr/bin/sh.exe: Not linked to usr/bin/bash.exe usr/include/bash/alias.h: Uid differs ... which is very verbose, or do your own perms comparison vs the outputs from looping thru: tar -tv -C / -f /{x86_64,noarch}/release//.../...--.tar.*z* (*always remembering that all Cygwin installation tar file paths are relative to the Cygwin root directory / and need adjusted for use*) sort and group the files and directories which differ by tar permissions, and feed the lists of files and directories in a loop to e.g.: /bin/xargs -P `nproc` -a .lst /bin/chmod to safely batch and parallelize the changes, or background each command in the loop: /bin/xargs -a .lst /bin/chmod & to parallelize the workload. The Windows directory cache will buffer the changes, and it might be good to: $ sync -f /usr /etc to flush updates to disk: the second arg, if to the same file system, may have to wait until the first has completed, unless the command detects that. -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut -- Antoine de Saint-Exupéry