public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Howto fix C:\cygwin acl after backup/restore?
@ 2023-04-07 20:36 Thomas Schweikle
  2023-04-07 22:20 ` Brian Inglis
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Schweikle @ 2023-04-07 20:36 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1.1: Type: text/plain, Size: 551 bytes --]

Hi!

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?
-- 
Thomas


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2521 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 321 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Howto fix C:\cygwin acl after backup/restore?
  2023-04-07 20:36 Howto fix C:\cygwin acl after backup/restore? Thomas Schweikle
@ 2023-04-07 22:20 ` Brian Inglis
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Inglis @ 2023-04-07 22:20 UTC (permalink / raw)
  To: cygwin; +Cc: Thomas Schweikle

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-07 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-07 20:36 Howto fix C:\cygwin acl after backup/restore? Thomas Schweikle
2023-04-07 22:20 ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).