JSONTestSuite icon indicating copy to clipboard operation
JSONTestSuite copied to clipboard

Fix executable flags

Open themobiusproject opened this issue 5 years ago • 4 comments

Remove executable flag from json, swift, c, h, m files Add executable flag to pl, py, r, rb files

Resolves #87

themobiusproject avatar Jun 09 '20 04:06 themobiusproject

This is close, but there are still a few discrepancies. This command:

find . -type f -executable \! \( -exec bash -c 'case $(file -b --mime-type -- "$1") in application/x-mach-binary) ;& application/x-executable) ;& application/x-pie-executable) exit 0 ;; esac; exit 1' _ {} \; -o -exec cmp -sn2 -- =(<<<'#!') {} \; \) -printf '%P\n'

shows a few files that are still marked executable, but should not be:

parsers/test_Json.NET/Program.cs
parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/Newtonsoft.Json.dll
parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/System.Runtime.Serialization.Primitives.dll
parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.dll
parsers/test_Json.NET/bin/Release/netcoreapp1.0/publish/test_Json.NET.pdb
parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakChanges.icns
parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakGeneric.icns
parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakImage.icns
parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakPlugin.icns
parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakProject.icns
parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakScript.icns
parsers/test_Squeak_JSON_tonyg/Squeak.app/Contents/Resources/SqueakSources.icns
parsers/test_java_jackson_2_8_4/jackson-annotations-2.2.3.jar
parsers/test_json.cr
parsers/test_json.php
parsers/test_json_re.rb

That list includes a ruby script that does not have a shebang line. Adding a shebang would make its execute bit reasonable.

If the "not" operator is moved from after -executable to before it, the command shows that these files are still not marked executable, but technically should be:

parsers/test_ObjCNSJSONSerializer/test_ObjCNSJSONSerializer/a.out.dSYM/Contents/Resources/DWARF/a.out
parsers/test_ccan_json/json/_test/x.py
parsers/test_json-rust/target/debug/tj.dSYM/Contents/Resources/DWARF/tj
parsers/test_json-rustc_serialize/rj/target/debug/rj.dSYM/Contents/Resources/DWARF/rj

Though if the binaries in that list (everything except for x.py) have never been executed, does having the execute bit set really matter?

cebtenzzre avatar Jun 09 '20 19:06 cebtenzzre

That is more bash that I normally string together. But your command is also giving me an error of -bash: syntax error near unexpected token '('.

I personally try to keep executable files with their executable flag set even though it is just about as easy to type bash bashfile.sh. I will chmod the files listed above and leave it there.

themobiusproject avatar Jun 10 '20 01:06 themobiusproject

@themobiusproject Sorry, I use zsh and I've gotten so used to it that I sometimes forget which features are standard. In bash you can substitute =(<<<'#!') with the path to a file with the contents #! (newline is optional).

cebtenzzre avatar Jun 10 '20 06:06 cebtenzzre

@Cebtenzzre Thank you for the bash fix and I am glad that my comment could clue you in to the problem. I am going to dissect that command a bit and try to add pieces to my repertoire.

themobiusproject avatar Jun 10 '20 13:06 themobiusproject