delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/01/29/19:43:38

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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=uZFOjWaOH1SuTo0PHtZe3qE0bHz4AoUrD52T9QDBhxG
uqIYw2c3PLMncz2OJ6mHLnvLaJJfE/6jwzXKUBkt6ATzkr0LtPS/PnFXNUHWGV1M
pVZUYVHQg6dbxHi+fu4LCLgHD6aFHknhYNeRlIH7pNVSXMN2YpbQrL0/j+ZOU5Uw
=
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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=yzs7jwGJ+zXrge79239F7vcdZI4=; b=LIcy63tqI7cG9qzCY
a9FmxoUaR+pxxjWihMu14mK34B6DEWBI3ro7dlhK4dcTUooA57AYczgn0VVaGLc/
o1bYJ7pFyXw47hJkHOgoDtKrc975ft+zE76JGtM9i/wvAqhUmxuZkIdlmTwUVGNJ
RZYf9XixONX+wVQLrYimIukXG4=
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-Spam-SWARE-Status: No, score=-5.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,SPF_PASS autolearn=ham version=3.3.1 spammy=H*F:U*cygwin, ser, Mine, standing
X-HELO: Ishtar.sc.tlinx.org
Message-ID: <5E32267A.3010301@tlinx.org>
Date: Wed, 29 Jan 2020 16:42:34 -0800
From: L A Walsh <cygwin AT tlinx DOT org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Jason Pyeron <jpyeron AT pdinc DOT us>, "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Re: git on mounted CIFS is it Git or Cygwin
References: <062b01d5d493$71400640$53c012c0$@pdinc.us> <5E2ED10B DOT 6050601 AT tlinx DOT org> <00fe01d5d62e$32c07110$98415330$@pdinc.us>
In-Reply-To: <00fe01d5d62e$32c07110$98415330$@pdinc.us>
X-IsSubscribed: yes

On 2020/01/28 14:56, Jason Pyeron wrote:
....

Two short details,
ll is an alias commonly used on unix/linux/cygwin
most often standing for "ls -l" in its simplest form.
Mine does a few other things

alias llg='ls -l'         #long listing

alias ll='llg -gG'        # same with user+group turned off

lsacl is a shell script I use to get a more convenient and
compact form of acl's on linux; laster ported it to cygwin to do the same:


Here it is -- feel free to pass it along:
---
lsacl
---
>  cat ~/bin/lsacl
#!/bin/bash

## $Id: lsacl,v 1.5 2015-08-02 10:29:25-07 law Exp $
# 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)

#add cygwin function to return true/false
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

- Raw text -


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