| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:mime-version:in-reply-to:references:from:date | |
| :message-id:subject:to:cc:content-type; q=dns; s=default; b=RxuH | |
| aGRDy2Y7NssJvvnTuxPKwk0qlbvNcEutjmDGEImUMCZunXtmDcbNIPFfH/JBebH3 | |
| /0xkuFEiTQlAvMUwK5z1IlzCmG36tWIMEzzF6SSrxUHCeJwTxKbSrGrCd8F11ZvF | |
| paCongxRUbM3+Jk9MgtloNkE7vkiWdJ0UQhoy4Q= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:mime-version:in-reply-to:references:from:date | |
| :message-id:subject:to:cc:content-type; s=default; bh=xasUWNsQ2J | |
| 3RknBNxDIT7/axxoE=; b=LLteyWV3yvc/lr9dc7hbNu7Sw7ysa+H5YLOzU08/Jq | |
| 6uG543VniBTSgTzEJi+JM6z72EN3Iiu6xDeriH2yS4sYtU82w88yLfCF48sKfJv3 | |
| O0AdV7sCkUcyDtLAJhtIF8jhAwU93oTWzaf4NRlJ+FzgN6vkARE1qIQ441duU0x7 | |
| Y= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=0.8 required=5.0 tests=AWL,BAYES_20,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 |
| X-HELO: | mail-la0-f50.google.com |
| X-Received: | by 10.152.28.9 with SMTP id x9mr144134lag.73.1443111206780; Thu, 24 Sep 2015 09:13:26 -0700 (PDT) |
| MIME-Version: | 1.0 |
| In-Reply-To: | <560366EE.5020207@tlinx.org> |
| References: | <CAGpXXZKUQtAbrQ80VDHZhy0aZtzG+5fDB7bcYz-kwQ3Kgx6ueQ AT mail DOT gmail DOT com> <560366EE DOT 5020207 AT tlinx DOT org> |
| From: | Greg Freemyer <greg DOT freemyer AT gmail DOT com> |
| Date: | Thu, 24 Sep 2015 12:12:47 -0400 |
| Message-ID: | <CAGpXXZJeWs33BJi7qROduZEhTx1pXXXseTbfXu+QP8+cf_r5hQ@mail.gmail.com> |
| Subject: | Re: cygwin potentially corrupting permissions? |
| To: | Linda Walsh <cygwin AT tlinx DOT org> |
| Cc: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> |
| X-IsSubscribed: | yes |
Linda,
We seem to travel the same mailing lists. This is my first time to cygwin's.
I saved your script as "lsacl.txt". Then I used "cp lsacl.txt it" to
make a copy.
The copy is permission denied for reading. Basic ls -l shows no
difference (as expected)
$ ls -l lsacl.sh it
----rwx---+ 1 gaf None 1630 Sep 24 12:05 it
----rwx---+ 1 gaf None 1630 Sep 24 12:00 lsacl.sh
But your script does show a difference:
$ ./lsacl.sh lsacl.sh it
[u::---,g::---,g:root:rwx,g:Authenticated
Users:rwx,g:SYSTEM:rwx,g:Users:r-x,m:rwx,o:---/] lsacl.sh
[u::---,g::r-x,g:root:rwx,g:Authenticated
Users:rwx,g:SYSTEM:rwx,g:Users:r-x,m:rwx,o:---/] it
My user id is "gaf".
fyi: I thought I knew how to read an ACL, but the above makes little
sense to me. Note I can cat out "lsacl.sh", but I can't cat out "it".
Greg
--
Greg Freemyer
www.IntelligentAvatar.net
On Wed, Sep 23, 2015 at 10:58 PM, Linda Walsh <cygwin AT tlinx DOT org> wrote:
> Greg Freemyer wrote:
>>
>> All,
>>
>> I've noticed on 2 different machines that if I copy (cp) a file I can
>> read with cygwin, I don't have permission to read the copy.
>
> ---
> What does the acl say?
>
> (Attached a script, lsacl, that I use -- it works
> with linux or cygwin and allows wildcards).
>
>
> #!/bin/bash
>
> ## $Id: lsacl,v 1.5 2015-08-02 10:29:25-07 law Exp law $
> # Version 2 -- try to work with getfacl on cygwin
> #
>
>
> shopt -s expand_aliases
> alias int=declare\ -i sub=function string=declare
>
> gfacl=$(type -P getfacl)
>
> if ! type -f cygwin 2>/dev/null ; then
> _un_=$(type -P uname)
> if [[ $_un_ ]] ; then _os_=$($_un_ -o);
> elif [[ -e /proc/sys/kernel ]]; then _os_=Linux;
> else _os_=Cygwin;
> fi
> if [[ $_os_ =~ Cygwin ]]; then function cygwin () {
> return 0; }
> else function cygwin () { return 1; }
> fi
> unset _un_ _os_
> export -f cygwin
> fi
>
> if cygwin 2>/dev/null ;then
> [[ $gfacl ]] || { printf "FATAL: Cannot find getfacl in path\n";
> exit 1; }
> sub gfacl () { "$gfacl" "$@"; }
> else
> ## linux version has broken semantics requiring "-p"
> sub gfacl () { "$gfacl" -p "$@" ; }
> fi
>
> export -f gfacl
>
>
> sub facl2str {
> string fn=${1:?"Need pathname"}
> string s1='/^\#.*$/d; /^\s*$/d; s/\s*#.*$//;
> s/^(.)(ser|roup|ask|ther):/\1:/; y/\n/,/'
> string facl=$(gfacl -a "$fn"|sed -r "$s1"|tr "\n" ",")
> facl=${facl%,}
> string dacl=$(gfacl -d "$fn"|sed -r "s/^default://; $s1"|tr "\n"
> ",")
> dacl=${dacl%,}
> printf "[%s/%s]\n" "$facl" "$dacl"
> }
>
>
>
> int acllen=0 maxfnln=0
> #for fn in "$@" ; do if ((maxfnln<${#fn})); then maxfnln=${#fn}; fi ; done
>
> sub acl_str () {
> if cygwin ;then
> perm=$(facl2str "$fn")
> else
> qfn=$(printf "%q " "$fn")
> out="$(chacl -l "$fn")"
> perm="${out#$qfn}"
> fi
> printf "%s\n" "$perm"
> }
>
>
> for fn in "$@"; do
> int max=40
> perm=$(acl_str "$fn")
> int len=${#perm}
> if ((len>_acl_len_)); then acllen=len; fi
> if ((acllen>max)); then acllen=max; fi
> printf "%-${acllen}s %s\n" "$perm" "$fn"
> done
>
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |