Skip Menu |
 

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

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

People
Owner: RICHE [...] cpan.org
Requestors: Keith.S.Thompson [...] gmail.com
Cc:
AdminCc:

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 <http://stackoverflow.com/questions/7053198/using-filepath-to-create-directory-but-owner-and-group-are-not-set-correctly>.
Subject: make_path_bug.pl
Download make_path_bug.pl
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";
Download (untitled) / with headers
text/plain 1.4k
On Sat Aug 13 18:12:43 2011, Keith.S.Thompson wrote: Show quoted text
> 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 > <http://stackoverflow.com/questions/7053198/using-filepath-to-create- > directory-but-owner-and-group-are-not-set-correctly>.
I have filed a pull request intended to address this problem: https://github.com/rpcme/File-Path/pull/21 Please review. Thank you very much. Jim Keenan
Download (untitled) / with headers
text/plain 235b
Show quoted text
> I have filed a pull request intended to address this problem: > > https://github.com/rpcme/File-Path/pull/21 > > Please review. > > Thank you very much. > Jim Keenan
PR was reviewed, merged, and is resident in the 2.11 release.


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.