| Bug #41959 | mtr: error message when mkpath() fails and the file exists but is not directory | ||
|---|---|---|---|
| Submitted: | 8 Jan 2009 13:20 | Modified: | 30 Jan 2009 18:08 |
| Reporter: | Sven Sandberg | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Tests | Severity: | S3 (Non-critical) |
| Version: | 5.1 | OS: | Any |
| Assigned to: | Sven Sandberg | CPU Architecture: | Any |
| Tags: | error message, mkpath, mtr | ||
[8 Jan 2009 13:22]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/62683 2710 Sven Sandberg 2009-01-08 BUG#41959: mtr: error message when mkpath() fails and the file exists but is not directory Problem: when mtr tries to create a directory, and the target exists but is a file instead of directory, it tries several times to create the directory again before it fails. Fix: make it check if the target exists and is a non-directory.
[8 Jan 2009 13:26]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/62685 2710 Sven Sandberg 2009-01-08 BUG#41959: mtr: error message when mkpath() fails and the file exists but is not directory Problem: when mtr tries to create a directory, and the target exists but is a file instead of directory, it tries several times to create the directory again before it fails. Fix: make it check if the target exists and is a non-directory.
[8 Jan 2009 13:58]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/62688 2779 Sven Sandberg 2009-01-08 [merge] merged BUG#41959 from 5.1-rpl to 6.0-rpl
[8 Jan 2009 15:46]
Sven Sandberg
pushed to 5.1-rpl and 6.0-rpl
[30 Jan 2009 13:26]
Bugs System
Pushed into 6.0.10-alpha (revid:luis.soares@sun.com-20090129165607-wiskabxm948yx463) (version source revid:luis.soares@sun.com-20090129163120-e2ntks4wgpqde6zt) (merge vers: 6.0.10-alpha) (pib:6)
[30 Jan 2009 15:07]
Bugs System
Pushed into 5.1.32 (revid:luis.soares@sun.com-20090129165946-d6jnnfqfokuzr09y) (version source revid:sven@mysql.com-20090108132840-1a0vvvxqrbkidfk3) (merge vers: 5.1.31) (pib:6)
[30 Jan 2009 18:08]
Paul DuBois
Test suite changes. No changelog entry needed.
[17 Feb 2009 14:52]
Bugs System
Pushed into 5.1.32-ndb-6.3.23 (revid:tomas.ulin@sun.com-20090217131017-6u8qz1edkjfiobef) (version source revid:tomas.ulin@sun.com-20090203133556-9rclp06ol19bmzs4) (merge vers: 5.1.32-ndb-6.3.22) (pib:6)
[17 Feb 2009 16:40]
Bugs System
Pushed into 5.1.32-ndb-6.4.3 (revid:tomas.ulin@sun.com-20090217134419-5ha6xg4dpedrbmau) (version source revid:tomas.ulin@sun.com-20090203133556-9rclp06ol19bmzs4) (merge vers: 5.1.32-ndb-6.3.22) (pib:6)
[17 Feb 2009 18:16]
Bugs System
Pushed into 5.1.32-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090217134216-5699eq74ws4oxa0j) (version source revid:tomas.ulin@sun.com-20090201210519-vehobc4sy3g9s38e) (merge vers: 5.1.32-ndb-6.2.17) (pib:6)

Description: when mtr's mkpath() tries to create a directory that already exists but is a file (not directory), it doesn't give an error message How to repeat: read the code Suggested fix: === modified file 'mysql-test/lib/My/File/Path.pm' --- mysql-test/lib/My/File/Path.pm 2008-12-18 12:58:55 +0000 +++ mysql-test/lib/My/File/Path.pm 2008-12-20 10:36:01 +0000 @@ -61,6 +61,9 @@ sub mkpath { my $path; + + die "Usage: mkpath(<path>)" unless @_ == 1; + foreach my $dir ( File::Spec->splitdir( @_ ) ) { #print "dir: $dir\n"; if ($dir =~ /^[a-z]:/i){ @@ -72,8 +75,9 @@ $path= File::Spec->catdir($path, $dir); #print "path: $path\n"; - next if -d $path; # Path already exist - next if mkdir($path); # mkdir worked + next if -d $path; # Path already exists and is a directory + croak("File already exists but is not a directory: '$path'") if -e $path; + next if mkdir($path); # mkdir failed, try one more time next if mkdir($path);