delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/04/07/18:22:09

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3C143858C30
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1680906078;
bh=vzE9NtpodI8Pj1+bbiGovcQ/p+JQb7Gyx7QDQ4Q4q6s=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=uZismzD3K5V+Q9MrVUmIINlOpHKkdGo2SiNfoWhRVZ60GF3yk9sS4PNTvg5654wey
tmlOymBM7AqtZCBMQ0HPbR3wEpwmgDZ/ZEzkKz3m7rCBL6wM76DwNdNGFsILn88iOf
wWRw2NxH5z7TvbLpIsp12wXhhBpxOJExhDYYnry8=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFEE73858D28
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: <e04c101e-4e62-ac39-7236-e509647c2b30@Shaw.ca>
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
Subject: Re: Howto fix C:\cygwin acl after backup/restore?
To: cygwin AT cygwin DOT com
References: <77a9a77a-8848-f582-18c9-2d2b13a71d4f AT bfs DOT de>
Organization: Inglis
In-Reply-To: <77a9a77a-8848-f582-18c9-2d2b13a71d4f@bfs.de>
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
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT Shaw DOT ca>, Thomas Schweikle <tschweikle AT bfs DOT de>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 337MLfDD009395

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 
<MIRROR>/{x86_64,noarch}/release/ looping thru:

tar -d -C / -f <MIRROR>/{x86_64,noarch}/release/<PKG>/.../...-<VER>-<REL>.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 <MIRROR>/{x86_64,noarch}/release/<PKG>/.../...-<VER>-<REL>.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 <PERMS>.lst /bin/chmod <PERMS>

to safely batch and parallelize the changes, or background each <PERMS> command 
in the loop:

	/bin/xargs -a <PERMS>.lst /bin/chmod <PERMS> &

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

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019