Bug#748562: overkill?

2014-05-20 Thread Leandro Penz
I used to have a one-liner until I got tired of the poor performance.
On a quick test here in my PC, execpermfix took 2.7s to process a directory
while find with file and grep (no chmod) took 18.5s (~5 runs).
execpermfix also has better error-handling, and it only gives x where there
is an r - you'll never get a "rwxr-x--x" permission.
The -n and -v can be used to check for files that should have the
permission. The default quiet mode follows the unix philosophy.

I think it has its value, and I always use it after updating legacy (big)
CVS repositories.


Bug#748562: overkill?

2014-05-20 Thread Barak A. Pearlmutter
Instead of writing this execpermfix thing in C, I'd do it
as a one-liner in shell.

  find FILES-AND-DIRECTORIES \
-type f \
-execdir sh -c 'file --brief "$1" | grep -q executable' -- '{}' \; \
-print0 \
  | xargs -0 chmod --verbose +x

Works for me!

(The contortions in the middle are to make sure filenames containing
whitespace, literal single or double quotes, etc, are handled
correctly.)

Cheers,

--Barak.
--
Barak A. Pearlmutter
 Hamilton Institute & Dept Comp Sci, NUI Maynooth, Co. Kildare, Ireland
 http://www.bcl.hamilton.ie/~barak/


-- 
To UNSUBSCRIBE, email to debian-wnpp-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/87ppj8dtz3@cs.nuim.ie