public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: L A Walsh <cygwin@tlinx.org>
To: Jason Pyeron <jpyeron@pdinc.us>, "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Re: git on mounted CIFS is it Git or Cygwin
Date: Thu, 30 Jan 2020 00:42:00 -0000	[thread overview]
Message-ID: <5E32267A.3010301@tlinx.org> (raw)
In-Reply-To: <00fe01d5d62e$32c07110$98415330$@pdinc.us>

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

  reply	other threads:[~2020-01-30  0:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-26 21:56 Jason Pyeron
2020-01-27 12:01 ` L A Walsh
2020-01-28 22:56   ` Jason Pyeron
2020-01-30  0:42     ` L A Walsh [this message]
2020-04-17 18:15       ` Andrey Repin
2020-01-30  3:18   ` Jason Pyeron
2020-02-05 23:31 Jason Pyeron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5E32267A.3010301@tlinx.org \
    --to=cygwin@tlinx.org \
    --cc=cygwin@cygwin.com \
    --cc=jpyeron@pdinc.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).