Skip to content

remove executable bit for various files #3025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2021

Conversation

svenevs
Copy link
Contributor

@svenevs svenevs commented Aug 23, 2021

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch.
    • AFAICT this is desired on 3.4 rather than master.
    • BUT do note that master branch has other files affected not in 3.4. Easy to do a separate PR for master-master if desired, let me know 🙂
  • There is reference to original bug report and related work.
    • Do you want me to create an issue to have this fix it?
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. Not applicable.
  • The feature is well documented and sample code can be built with the project CMake. It built for me. But I don't think that comprehensively tests things. It's not a feature though 🙂

Remove executable bits from files that do not need it. Including steps taken to identify for help in review, feel free to force push over my branch or alternatively fix it directly without a PR from me. See bottom checklist for "outliers".

# Finding the files that are executable
$ find . -type f -executable -not -path "*/.git/*"

The available file extensions for consideration:

$ find . -type f -executable -not -path "*/.git/*" -exec /bin/sh -c 'bname="$(basename {})"; echo ${bname##*.}' \; | sort | uniq
bib
binaryproto
caffemodel
cmake
cpp
h
hpp
jpg
markdown
md
ply
png
prototxt
py
sh
txt

Assuming sh and py files are correctly executable, some of these file types can be fixed as is but some I am not sure whether the executable bit matters. In this PR I'm removing it from everything except for sh and py files.

# To exclude more easily, just add another
#   -and -not "*.[ext to keep executable]"
# switch there at the end.
$ find . -type f -executable -not -path "*/.git/*" -and -not -name "*.sh" -and -not -name "*.py"

Then to actually fix the permissions you just want to, now that we have the right listing, execute chmod -x:

$ find . -type f -executable -not -path "*/.git/*" -and -not -name "*.sh" -and -not -name "*.py" -exec chmod -x {} \;

and to check what went down, look for executable files again without pruning (except for .git folder):

$ find . -type f -executable -not -path "*/.git/*"
./samples/python2/seeds.py
./samples/python2/common.py
./samples/python2/video.py
./modules/reg/samples/reg_shift.py
./modules/optflow/samples/motempl.py
./modules/face/samples/etc/crop_face.py
./modules/face/samples/etc/create_csv.py
./modules/cnn_3dobj/samples/datagen_front.sh
./modules/cnn_3dobj/samples/datagen_all.sh
./modules/cnn_3dobj/samples/datagen_back.sh
./modules/cnn_3dobj/samples/featstore.sh
./modules/dnns_easily_fooled/download_caffe_gradient_ascent.sh
./modules/dnns_easily_fooled/download_sferes.sh
./modules/dnns_easily_fooled/download_caffe_evolutionary_algorithm.sh

Unofficially labeling these as "outliers", do any of the below need to have the executable bit removed? As far as I could tell it's correct but I didn't look super close and don't use most of these modules.

Copy link
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thank you 👍

Keeping executable .py samples is OK.

@opencv-pushbot opencv-pushbot merged commit 29134ef into opencv:3.4 Aug 24, 2021
@svenevs svenevs deleted the fixperms-3.4 branch August 24, 2021 12:25
@alalek alalek mentioned this pull request Aug 28, 2021
@alalek alalek mentioned this pull request Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants