117

I have a few files that have been executable before svn adding them. They have the svn:executable property set. Now, a few other files were checked in without the executable bit do not have it, and I want to set the svn:executable property:

$ svn propset svn:executable on *.cgi

Then I check the status and even the files with the svn:executable have been modified:

$ svn diff
Property changes on: a.cgi
___________________________________________________________________
Modified: svn:executable
   - 
   + *


Property changes on: b.cgi
___________________________________________________________________
Added: svn:executable
   + *

a.cgi should not be modified. I want to add the svn:executable bit to be set in the same way as it is on the other files, but can't figure out the command to do it.

4
  • 2
    I open this page every time I don't want to type svn propset svn:executable on (...). And the answer to the question should be for f in *.cgi; do if [ ! -x $f ]; then svn ps (...); fi; done, and just commit the modified files. Then move on. Nov 23, 2013 at 5:32
  • @TomaszGandor Think you're missing svn:executable somewhere in that second snippet. Maybe svn ps svn:executable on $f;?
    – Keith M
    Jun 22, 2017 at 23:28
  • 1
    en.wikipedia.org/wiki/Ellipsis_(linguistics) - yes, it was left as an exercise to the reader. Jun 23, 2017 at 0:27
  • if you subsequently ran svn st -uq you'd see only the changes
    – pstanton
    Apr 27, 2022 at 0:31

2 Answers 2

180

You are right to use the svn property editing commands. The property is svn:executable.

To add the "executable bit" in svn

svn propset svn:executable on <list of files>

To remove the "executable bit" in svn

svn propdel svn:executable <list of files>

The SVN documentation for this is located here.

As far as not modifying the executables, you are not modifying the executable (a checksum will verify that), but you are modifying the SVN repository. Remember that SVN revisions file systems, not just files; so, a modification of the permission bits will increase the SVN revision number, even if it's just a modification of a file's properties (and not a modification of the file itself).

2
  • When I run svn propset in the way shown above, it sets them to "*" but the natural way sets svn:executable to nothing, but which is still set. I want this property to be the same as the ones whose executable bit was set before adding them to subversion.
    – Jake
    Apr 22, 2011 at 16:11
  • 2
    Sorry for all the edits, but if I recall correctly, having it set to anything will turn on the executable bit, deleting it (and possibly setting it to null or whitespace) will turn it off. To get the value your SVN client was using, a svn propget can be used.
    – Edwin Buck
    Apr 22, 2011 at 16:15
-1

Here is how I set the executable property on all the *.py files in my project that have execute bit set on them. I execute this from the top level directory

for f in `find ./ -name '*.py'`; do echo $f; if [ -x $f ]; then echo $f 'is executable setting svn:executable'; svn propset svn:executable on $f; else echo $f 'is not executable'; fi; done;
3
  • How does the executable attribute get set without using propset? I didn't use it, and to the the best of my knowledge, nobody else did either. It appears on three files in the same directory and nowhere else, and there seems to be nothing special about those files. (They're java files, not sh or exe or bat or jar or whatever.) Oct 18, 2018 at 18:51
  • I believe if the file has the executable bit set when it is initially imported then the svn executable property will be set. Oct 20, 2018 at 12:49
  • pretty sure find has a -perm switch which might be slightly more elegant than the if/then but of course it would be more to remember Jul 31, 2020 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.