Bug #34807 type_varchar fails under Windows if mysql-test/std_data/vchar.frm is not edited
Submitted: 25 Feb 2008 14:37 Modified: 24 Feb 2009 20:44
Reporter: Guilhem Bichot Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.1-bk OS:Windows (32 bit)
Assigned to: CPU Architecture:Any

[25 Feb 2008 14:37] Guilhem Bichot
Description:
For years I have configured bk to not edit all files in the tree but just check them out in read-only mode, then I do "bk edit" for each file I really have to modify. This makes "bk citool" instant.

Now, on my Windows machine, a few tests fail in a 5.1 tree, for example type_varchar.test: it says that at line 34, ALTER TABLE fails because it cannot rename test/t1.frm to test/#sql2-c44-1.frm, errno 17 ("file exists").
What happens is:
the test starts by copying std_data/vchar.frm into var/master-data/test/. Then it does a TRUNCATE TABLE on vchar, then an ALTER TABLE on vchar, which renames test/vchar.frm to test/#sql2-c44-1.frm, then deletes test/#sql2-c44-1.frm. The deletion returns success, but it seems the file stays around, which later causes the ALTER TABLE on t1 of line 34, which reuses the same temporary name, to fail.
The cause seems to be that std_data/vchar.frm is not writable, so when at the start of the test it is copied to test/vchar.frm, this frm is not writable either, so the deletions of ALTER TABLE fail silently.
If I "bk edit std_data/vchar.frm" it fixes this problem.

How to repeat:
Probably do "bk unedit std_data/vchar.frm" and run the test, under Windows.

Suggested fix:
Like in varbinary.test: use the "chmod" command which implies that the test cannot be run as root (see start of varbinary.test):
# This test uses chmod, can't be run with root permissions
-- source include/not_as_root.inc
...
copy_file std_data/bug19371.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm;
chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.frm;

"bk chmod" won't help (the help text of it says that add write permission is pointless).
Workaround: "bk edit std_data/*"
[24 Feb 2009 15:11] Patrick Crews
For the test suite to run, files in std_data must have certain permissions.

I believe I filed a request to have this requirement be documented when closing out another bug.
Part of the reason for the files in std_data are that we want to manipulate them and as a result, they need to allow certain operations.

Also, I believe this is no longer an issue due to the switch to bzr as well.
[24 Feb 2009 20:44] Guilhem Bichot
Hi Patrick. Indeed after the switch to bzr, it works, because bzr always checks out files as writable, for example in 5.1:
-rw-r--r-- 1 guilhem users 8616 2008-05-07 11:11 std_data/vchar.frm
When we were using bk, it was a bug (so I'm moving it to "can't repeat"). It was not a bug in my setup, documentation wouldn't have fixed this in any way: it was the responsibility of the developer checking in a file into bk, that this file is checked in with the proper permissions, so that tests run ok. One couldn't expect all devs to run "chmod" by hand on test files in their bk tree before running the test... In other words, I was using bk in an allowed manner with which the checked -in file's permissions were incompatible. Now irrelevant due to the bzr switch.