Making a file un-exectuable from bzr doesn't work, as bzr clears svn:executable instead of deleting it

Bug #304866 reported by Wesley J. Landaker
2
Affects Status Importance Assigned to Milestone
Bazaar Subversion Plugin
Fix Released
High
Jelmer Vernooij

Bug Description

bzr-svn's handling of svn:executable isn't quite right. Below is a transcript that demonstrates the issue with bzr 1.9 and bzr-svn 0.4.15 (both from intrepid packages):

First, we set up the test:

~$ cd /tmp/
/tmp$ mkdir bzr-svn-executable-test
/tmp$ cd bzr-svn-executable-test/
/tmp/bzr-svn-executable-test$ svnadmin create svn-repos
/tmp/bzr-svn-executable-test$ svn co file://`pwd`/svn-repos svn-co
Checked out revision 0.
/tmp/bzr-svn-executable-test$ bzr co svn-repos bzr-co
Initialising Subversion metadata cache in /home/wjlanda/.bazaar/svn-cache/42ba17a7-08f8-4050-b8b6-4460548d23a6

Now, we make two test files from svn:

/tmp/bzr-svn-executable-test$ cd svn-co/
/tmp/bzr-svn-executable-test/svn-co$ touch non-exe-from-svn
/tmp/bzr-svn-executable-test/svn-co$ touch exe-from-svn
/tmp/bzr-svn-executable-test/svn-co$ svn add *
A exe-from-svn
A non-exe-from-svn
/tmp/bzr-svn-executable-test/svn-co$ svn ps svn:executable '*' exe-from-svn
property 'svn:executable' set on 'exe-from-svn'
/tmp/bzr-svn-executable-test/svn-co$ svn commit -m "Two files from svn"
Adding exe-from-svn
Adding non-exe-from-svn
Transmitting file data ..
Committed revision 1.
/tmp/bzr-svn-executable-test/svn-co$ ls -l
total 0
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:35 exe-from-svn
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:34 non-exe-from-svn

Now, we make two different test files from bzr:

/tmp/bzr-svn-executable-test/svn-co$ cd ../bzr-co/
/tmp/bzr-svn-executable-test/bzr-co$ bzr up
+N exe-from-svn
+N non-exe-from-svn
All changes applied successfully.
Updated to revision 2.
/tmp/bzr-svn-executable-test/bzr-co$ touch exe-from-bzr non-exe-from-bzr
/tmp/bzr-svn-executable-test/bzr-co$ chmod a+x exe-from-bzr
/tmp/bzr-svn-executable-test/bzr-co$ bzr add
added exe-from-bzr
added non-exe-from-bzr
/tmp/bzr-svn-executable-test/bzr-co$ bzr commit -m "Two files from bzr"
Committing to: /tmp/bzr-svn-executable-test/svn-repos
added exe-from-bzr
added non-exe-from-bzr
Committed revision 3.
/tmp/bzr-svn-executable-test/bzr-co$ ls -l
total 0
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:36 exe-from-bzr
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:35 exe-from-svn
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:36 non-exe-from-bzr
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:35 non-exe-from-svn

Now we flip the svn:executable bit on the test files made from bzr, from svn:

/tmp/bzr-svn-executable-test/bzr-co$ cd ../svn-co
/tmp/bzr-svn-executable-test/svn-co$ svn up
A non-exe-from-bzr
A exe-from-bzr
 U .
Updated to revision 2.
/tmp/bzr-svn-executable-test/svn-co$ ls -l
total 0
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:36 exe-from-bzr
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:35 exe-from-svn
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:36 non-exe-from-bzr
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:34 non-exe-from-svn
/tmp/bzr-svn-executable-test/svn-co$ svn pdel svn:executable exe-from-bzr
property 'svn:executable' deleted from 'exe-from-bzr'.
/tmp/bzr-svn-executable-test/svn-co$ svn mv exe-from-bzr exe-from-bzr-non-exe-from-svn
A exe-from-bzr-non-exe-from-svn
D exe-from-bzr
/tmp/bzr-svn-executable-test/svn-co$ svn ps svn:executable '*' non-exe-from-bzr
property 'svn:executable' set on 'non-exe-from-bzr'
/tmp/bzr-svn-executable-test/svn-co$ svn mv non-exe-from-bzr non-exe-from-bzr-exe-from-svn
A non-exe-from-bzr-exe-from-svn
D non-exe-from-bzr
/tmp/bzr-svn-executable-test/svn-co$ svn commit -m "Fliped svn:exectuable on the two files from bzr."
Deleting exe-from-bzr
Adding exe-from-bzr-non-exe-from-svn
Deleting non-exe-from-bzr
Adding non-exe-from-bzr-exe-from-svn

Committed revision 3.
/tmp/bzr-svn-executable-test/svn-co$ ls -l
total 0
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:37 exe-from-bzr-non-exe-from-svn
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:35 exe-from-svn
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:38 non-exe-from-bzr-exe-from-svn
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:34 non-exe-from-svn

Now we flip the x-bit on the two files from svn, from bzr:

/tmp/bzr-svn-executable-test/svn-co$ cd ../bzr-co/
/tmp/bzr-svn-executable-test/bzr-co$ bzr up
+N exe-from-bzr-non-exe-from-svn
+N non-exe-from-bzr-exe-from-svn
-D exe-from-bzr
-D non-exe-from-bzr
All changes applied successfully.
Updated to revision 4.
/tmp/bzr-svn-executable-test/bzr-co$ ls -l
total 0
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:38 exe-from-bzr-non-exe-from-svn
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:35 exe-from-svn
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:38 non-exe-from-bzr-exe-from-svn
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:35 non-exe-from-svn
/tmp/bzr-svn-executable-test/bzr-co$ chmod a+x non-exe-from-svn
/tmp/bzr-svn-executable-test/bzr-co$ bzr mv non-exe-from-svn non-exe-from-svn-exe-from-bzr
non-exe-from-svn => non-exe-from-svn-exe-from-bzr
/tmp/bzr-svn-executable-test/bzr-co$ chmod a-x exe-from-svn
/tmp/bzr-svn-executable-test/bzr-co$ bzr mv exe-from-svn exe-from-svn-non-exe-from-bzr
exe-from-svn => exe-from-svn-non-exe-from-bzr
/tmp/bzr-svn-executable-test/bzr-co$ bzr commit -m "Fliped x-bit on the two files from svn."
Committing to: /tmp/bzr-svn-executable-test/svn-repos
modified and renamed exe-from-svn => exe-from-svn-non-exe-from-bzr
modified and renamed non-exe-from-svn => non-exe-from-svn-exe-from-bzr
Committed revision 5.
/tmp/bzr-svn-executable-test/bzr-co$ ls -l
total 0
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:38 exe-from-bzr-non-exe-from-svn
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:35 exe-from-svn-non-exe-from-bzr
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:38 non-exe-from-bzr-exe-from-svn
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:35 non-exe-from-svn-exe-from-bzr

So far so good, but here is the problem:

/tmp/bzr-svn-executable-test/bzr-co$ cd ../svn-co/
/tmp/bzr-svn-executable-test/svn-co$ svn up
D exe-from-svn
D non-exe-from-svn
A exe-from-svn-non-exe-from-bzr
A non-exe-from-svn-exe-from-bzr
 U .
Updated to revision 4.
/tmp/bzr-svn-executable-test/svn-co$ ls -l
total 0
-rw-r--r-- 1 wjlanda wjlanda 0 2008-12-03 09:37 exe-from-bzr-non-exe-from-svn
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:40 exe-from-svn-non-exe-from-bzr
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:38 non-exe-from-bzr-exe-from-svn
-rwxr-xr-x 1 wjlanda wjlanda 0 2008-12-03 09:40 non-exe-from-svn-exe-from-bzr
/tmp/bzr-svn-executable-test/svn-co$ svn pl exe-from-svn-non-exe-from-bzr
Properties on 'exe-from-svn-non-exe-from-bzr':
  svn:executable
/tmp/bzr-svn-executable-test/svn-co$ svn pg svn:executable exe-from-svn-non-exe-from-bzr

/tmp/bzr-svn-executable-test/svn-co$

Note that the exe-from-svn-non-exe-from-bzr case didn't work. The reason is that bzr-svn apparently *cleared* the svn:executable property, instead of deleting it, like svn expects.

Related branches

Revision history for this message
Wesley J. Landaker (wjl) wrote :

I think this is basically the change that's needed, but this isn't complete because there isn't actually a delete_prop implemented in the bzr-svn bindings:

Basically, instead of clearing the svn:executable value, delete it:

=== modified file 'commit.py'
--- commit.py 2008-11-08 20:02:02 +0000
+++ commit.py 2008-12-03 16:55:27 +0000
@@ -309,11 +309,10 @@
             if child_editor is not None:
                 if old_executable != child_ie.executable:
                     if child_ie.executable:
- value = properties.PROP_EXECUTABLE_VALUE
+ child_editor.change_prop(properties.PROP_EXECUTABLE,
+ PROP_EXECUTABLE_VALUE)
                     else:
- value = None
- child_editor.change_prop(
- properties.PROP_EXECUTABLE, value)
+ child_editor.delete_prop(properties.PROP_EXECUTABLE)

                 if old_special != (child_ie.kind == 'symlink'):
                     if child_ie.kind == 'symlink':

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

There is no delete_prop() function in Subversion. Setting a property to NULL (None) is the right way to remove properties, as bzr-svn is already doing.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Looks like there's actually a bug in the bindings causing None to be interpreted as an empty string...

Jelmer Vernooij (jelmer)
Changed in bzr-svn:
assignee: nobody → jelmer
importance: Undecided → High
milestone: none → 0.4.16
status: New → Fix Committed
Jelmer Vernooij (jelmer)
Changed in bzr-svn:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.