Skip Menu |

This queue is for tickets about the File-Path CPAN distribution.

Report information
The Basics
Id: 70257
Status: new
Priority: 0/
Queue: File-Path

Owner: RICHE [...]
Requestors: Keith.S.Thompson [...]

Bug Information
Severity: Normal
Broken in:
  • 2.07_03
  • 2.08
Fixed in: (no value)

Subject: make_path silently ignores unrecognized keys
Download (untitled) / with headers
text/plain 1.1k
File::Path 2.08 introduced the "owner/user/uid" and "group" options to make_path(). The problem: There doesn't seem to be any good way to determine whether the version of File::Path being used supports these options. (Note, for example, that the default version in the latest Ubuntu has File::Path 2.07_03, which doesn't support them.) The real problem is that get_path() silently ignores any unrecognized option names. The attached script, when run as root using the latest File::Path, correctly creates the directory with the specified ownership. When the same script is run with an older File::Path, the "owner" option is silently ignored, and the directory is created with root ownership. I suggest that any unrecognized option should cause the call to fail. This could also catch typos. I don't suppose it makes sense to release a new version, say 2.07_04, that complains about "owner"; it's just as easy to upgrade to 2.08 or newer, which actually implements it. But this would be a useful check in case other options are added in newer versions. See also <>.
text/x-perl 667b
#!/usr/bin/perl use strict; use warnings; use File::Path; die "Run as root\n" if $< != 0; die "Usage: $0 username\n" if scalar @ARGV != 1; my $username = $ARGV[0]; die "\"$username\" is not a valid username\n" if not defined getpwnam($username); print "Using File::Path version $File::Path::VERSION with Perl $]\n"; my $tmpdir = "/tmp/file-path-test-$$"; print "Creating $tmpdir\n"; mkdir $tmpdir, 0777 or die "$tmpdir: $!\n"; my @result = File::Path::make_path ( "$tmpdir/new-dir", { owner => $username, mode => 0500, nosuchkey => 'WTF?' } ); print "Created ( @result )\n";

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to