Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3E2A9396.EF36FE73@phekda.freeserve.co.uk> Date: Sun, 19 Jan 2003 12:01:26 +0000 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: Take on __solve_symlinks() References: <3E286C07 DOT 7040200 AT mif DOT vu DOT lt> <3E2943DA DOT 523770FC AT phekda DOT freeserve DOT co DOT uk> <3E297258 DOT 50906 AT mif DOT vu DOT lt> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Laurynas Biveinis wrote: > > Richard Dawe wrote: > >>Well, maybe I'm on drugs, > > > > > > Maybe the problem is that I'm not on drugs (caffeine)! ;) > > Nope, it's quite clear that the problems are on my side :) I haven't been communicating very well. [snip] > No I don't, but I didn't see any failures, probably because we're > running two different test programs - I've cleaned up the test program a > bit. I'm attaching it. Could you tell if it fails with your testcases? Which test cases? The ones I have described or the ones that failed? The test cases that failed are in the CVS xsymlink test. I haven't added any test cases to that for a while. The tests that fail are the ones that take the current directory, count the number of slashes (n_slashes) and then prepend lots of ".."s to the path without the directory (cwd_without_drive). > > * symlinks between drives; > > Will see, the problem is that not everybody has multiple drives... Most computers have a floppy drive, don't they? > > * paths using /dev/ instead of :; > > * paths using environment variables in paths - e.g.: /dev/env/FOO. > > OK. Will add those tests too. Thanks. > > Basically tests that mix absolute and relative paths in every possible > > way. Most of the tests are too "normal" at the moment IMHO. Not that > > I am criticising. > > See that part about drugs above :) 8) > > It's just that you may not have thought of bizarre filenames as > > much as I have, while testing fileutils, etc. ;) > > Right. I was trying to make up tests according to the problem > description, and probably failed. Like I said, I haven't been communicating very well. > >> /* FIXME below, but note that you're insane to run this test > >>really that deep :) */ > >> test_success("c:../../../../../../../../../../../../../../../link", > >>"c:/autoexec.bat"); > > > Why is this marked as a FIXME? > > > > Why is it insane? Sure, having more than 8 levels of directories is > > unsupported on DOS, but the code should cope with excess ".."s. > > No I mean, the test will not work as expected if there won't be enough > '../' to try to get above c:/ from the cwd on C:. I tried to make this > test to expose the bug you're talking about - isn't this the same > situation? (relative path with drive letter and trying to get above the > root). [snip] Yes, but it also happens with an absolute path trying to get above root. Since one of the tests already computes the number of ".."s to root (n_slashes), you could use that number to construct a path that will always work. I ran your test program in c:/djgpp.204/rdawe-test/symlink/laurynas. I copied all the test symlinks, etc. from the actual DJGPP test directory. (I also ran your program in the test directory and it gave the same results, so I copied all the test data correctly.) Here's what your test program gives me: Test 19 failed - __solve_symlinks returns wrong resolved path Returned path: c:/djgpp.204/rdawe-test/symlink/laurynas/test1 Expected path: c:/djgpp.204/rdawe-test/symlink/laurynas/file1 Test 27 failed - __solve_symlinks returns wrong resolved path Returned path: c:/link Expected path: c:/autoexec.bat Test 28 failed - __solve_symlinks returns wrong resolved path Returned path: c:/link Expected path: c:/autoexec.bat Test 29 failed - __solve_symlinks returns wrong resolved path Returned path: c:/link Expected path: c:/autoexec.bat Test 30 failed - __solve_symlinks returns wrong resolved path Returned path: c:/link Expected path: c:/autoexec.bat Test 31 failed - __solve_symlinks returns wrong resolved path Returned path: c:/link Expected path: c:/autoexec.bat Test 34 failed - __solve_symlinks returns wrong resolved path Returned path: c:/tdir/link Expected path: c:/config.sys Test 35 failed - __solve_symlinks returns wrong resolved path Returned path: c:/tdir/link Expected path: c:/config.sys Test 36 failed - __solve_symlinks returns wrong resolved path Returned path: c:/tdir/link Expected path: c:/config.sys Test 38 failed - __solve_symlinks returns wrong resolved path Returned path: c:/djgpp/link Expected path: c:/djgpp.204/djgpp.env Running __solve_symlinks() and readlink() testsuite: Tests that check __solve_symlinks() works: Test 1 passed Test 2 passed Test 3 passed Test 4 passed Test 5 passed Test 6 passed Test 7 passed Test 8 passed Test 9 passed Test 10 passed Test 11 passed Test 12 passed Test 13 passed Tests that check __solve_symlinks() based on current directory: Test 14: Solving c:/djgpp.204/rdawe-test/symlink/laurynas/../../../../djgpp.204/rdawe-test/symlink/laurynas/test1 Test 15 passed Test 16: Solving c:../../../../djgpp.204/rdawe-test/symlink/laurynas/test1 Test 17 passed Test 18: Solving c:../../../../../djgpp.204/rdawe-test/symlink/laurynas/test1 Test 19 passed Tests that check __solve_symlinks() failure cases: Test 20 passed Test 21 passed 2003 tests: Test 22 passed Test 23 passed Test 24 passed Test 25 passed Test 26 passed Test 27 passed Test 28 passed Test 29 passed Test 30 passed Test 31 passed Test 32 passed Test 33 passed Test 34 passed Test 35 passed Test 36 passed Test 37 passed Test 38 passed FAIL Let me know if you want me to retest sometime. Thanks, bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]