Ticket UUID: | 281f18eef310f4ac211a180ff2d93e6a21ba50e0 | ||
Title: | Rename directory moves files to the wrong director | ||
Status: | Open | Type: | Code_Defect |
Severity: | Important | Priority: | |
Subsystem: | Resolution: | ||
Last Modified: | 2011-03-12 17:12:22 | ||
Version Found In: | c92ec16f81 | ||
Description & Comments: | |||
If you move a directory, fossil moves the files to the wrong directory when you the .. directory. Observe:
9:02 sean@somehost-98 % cd /tmp/ 9:02 sean@somehost-98 % mkdir fst 9:02 sean@somehost-98 % cd fst/ 9:02 sean@somehost-98 % fs open ~/src/.fossils/fossil-test-repository test.sh project-name: <unnamed> repository: /Users/sean/src/.fossils/fossil-test-repository local-root: /private/tmp/fst/ project-code: 70164ac6b1269749f782f3dfce03f9cae7fc0c64 server-code: 4d7de95913a31ac17b29e29e96794b42d2575025 checkout: 25317d0b17378032e0120a58e3bb2d8c0b9fd99d 2011-02-08 22:17:00 UTC parent: ef432a9584e7771b7ac82ba058ecff84f744deb1 2011-02-08 16:31:20 UTC tags: trunk comment: Updating test (user: sean) 9:02 sean@somehost-98 % ll total 24 -rw-r--r-- 1 sean wheel 7168 Mar 12 09:02 _FOSSIL_ -rwxr-xr-x 1 sean wheel 29 Mar 12 09:02 test.sh 9:02 sean@somehost-98 % mkdir -p foo/bar/baz 9:02 sean@somehost-98 % cd foo/bar/baz/ 9:02 sean@somehost-98 % echo test1 > file1.txt 9:02 sean@somehost-98 % echo test2 > file2.txt 9:03 sean@somehost-98 % fs addrem ADDED foo/bar/baz/file1.txt ADDED foo/bar/baz/file2.txt added 2 files, deleted 0 files 9:03 sean@somehost-98 % fs ci -m "Fossil dir move bug" New_Version: 72ede87aa33fb39c8fac6c72adb1c5dc69260597 9:03 sean@somehost-98 % fs stat repository: /Users/sean/src/.fossils/fossil-test-repository local-root: /private/tmp/fst/ server-code: 4d7de95913a31ac17b29e29e96794b42d2575025 checkout: 72ede87aa33fb39c8fac6c72adb1c5dc69260597 2011-03-12 17:03:15 UTC parent: 25317d0b17378032e0120a58e3bb2d8c0b9fd99d 2011-02-08 22:17:00 UTC tags: trunk comment: Fossil dir move bug (user: sean) 9:03 sean@somehost-98 % cd .. 9:03 sean@somehost-98 % mkdir ../bur 9:03 sean@somehost-98 % pwd /tmp/fst/foo/bar 9:03 sean@somehost-98 % fs mv baz ../bur/ RENAME foo/bar/baz/file1.txt foo/bur/file1.txt RENAME foo/bar/baz/file2.txt foo/bur/file2.txt 9:03 sean@somehost-98 % mv baz ../bur/ 9:04 sean@somehost-98 % fs stat repository: /Users/sean/src/.fossils/fossil-test-repository local-root: /private/tmp/fst/ server-code: 4d7de95913a31ac17b29e29e96794b42d2575025 checkout: 72ede87aa33fb39c8fac6c72adb1c5dc69260597 2011-03-12 17:03:15 UTC parent: 25317d0b17378032e0120a58e3bb2d8c0b9fd99d 2011-02-08 22:17:00 UTC tags: trunk comment: Fossil dir move bug (user: sean) MISSING foo/bur/file1.txt MISSING foo/bur/file2.txt 9:04 sean@somehost-98 % cd ../bur/ 9:04 sean@somehost-98 % ll total 0 drwxr-xr-x 4 sean wheel 136 Mar 12 09:03 baz 9:04 sean@somehost-98 % ll baz/ total 16 -rw-r--r-- 1 sean wheel 6 Mar 12 09:02 file1.txt -rw-r--r-- 1 sean wheel 6 Mar 12 09:03 file2.txt 9:04 sean@somehost-98 % fs addremove ADDED foo/bur/baz/file1.txt ADDED foo/bur/baz/file2.txt DELETED foo/bur/file1.txt DELETED foo/bur/file2.txt added 2 files, deleted 2 files 9:04 sean@somehost-98 % fs ci -m "files ended up in the wrong dir" New_Version: b006a48a67d94f6acedde8fc26bc44d5ab793b79 9:04 sean@somehost-98 % fs stat repository: /Users/sean/src/.fossils/fossil-test-repository local-root: /private/tmp/fst/ server-code: 4d7de95913a31ac17b29e29e96794b42d2575025 checkout: b006a48a67d94f6acedde8fc26bc44d5ab793b79 2011-03-12 17:04:53 UTC parent: 72ede87aa33fb39c8fac6c72adb1c5dc69260597 2011-03-12 17:03:15 UTC tags: trunk comment: files ended up in the wrong dir (user: sean) 9:04 sean@somehost-98 % fs extra 9:04 sean@somehost-98 % fs ls foo/bur/baz/file1.txt foo/bur/baz/file2.txt test.sh Pretty minor, but unexpected with large numbers of files. I'd expect `fs mv baz` to move the directory object itself under bur. Seems like an off-by-one error in terms of path resolution but I haven't looked at the code yet. I remember seeing this in practice with ../../../ as my path and I think the files ended up ../../../ and not ../../../some/sub/dir/ (don't quote me on that, it was kinda late last night when I saw this and noted the behavior). I think if you resolved the source and destination directories to absolute paths (or absolute relative to the fossil checkout) that this bug would be fixed. |