Lchown-1.01/0000755000175000017500000000000011266576071011332 5ustar nicknickLchown-1.01/t/0000755000175000017500000000000011266576071011575 5ustar nicknickLchown-1.01/t/sup.t0000444000175000017500000000346611266576071012600 0ustar nicknickuse strict; use warnings; use Test::More (tests => 17); use Lchown qw(lchown LCHOWN_AVAILABLE); SKIP: { skip "this system lacks lchown", 17 unless LCHOWN_AVAILABLE; is( lchown(0,0), 0, "null lchown gave 0" ); my $result = lchown 0, 0; is( $result, 0, "null lchown without parens" ); is( lchown(0,0,'nosuchfile','nosuchfile.bak'), 0, "lchown returns 0 with 2 missing files"); skip "not running as root", 14 if $>; symlink 'bar', 'foo' or die "symlink: $!"; is( lchown(123,456,'foo'), 1, "lchown foo success" ); my ($uid,$gid) = (lstat 'foo')[4,5]; is( $uid, 123, "lchown foo set uid 123" ); is( $gid, 456, "lchown foo set gid 456" ); unlink 'foo' or die "unlink: $!"; symlink 'bar', 'foo' or die "symlink: $!"; symlink 'bar', 'baz' or die "symlink: $!"; is( lchown(123,456,'foo','baz'), 2, "foo,baz success" ); ($uid,$gid) = (lstat 'foo')[4,5]; is( $uid, 123, "foo,baz set foo uid 123" ); is( $gid, 456, "foo,baz set foo gid 456" ); ($uid,$gid) = (lstat 'baz')[4,5]; is( $uid, 123, "foo,baz set baz uid 123" ); is( $gid, 456, "foo,baz set baz gid 456" ); unlink 'foo' or die "unlink: $!"; unlink 'baz' or die "unlink: $!"; symlink 'bar', 'foo' or die "symlink: $!"; is( lchown(123,456,'foo','nosuch'), 1, "foo,nosuch success for foo" ); ($uid,$gid) = (lstat 'foo')[4,5]; is( $uid, 123, "foo,nosuch set foo uid 123" ); is( $gid, 456, "foo,nosuch set foo gid 456" ); unlink 'foo' or die "unlink: $!"; symlink 'bar', 'foo' or die "symlink: $!"; is( lchown(123,456,'nosuch','foo'), 1, "nosuch,foo success for foo" ); ($uid,$gid) = (lstat 'foo')[4,5]; is( $uid, 123, "nosuch,foo set foo uid 123" ); is( $gid, 456, "nosuch,foo set foo gid 456" ); unlink 'foo' or die "unlink: $!"; } Lchown-1.01/t/notsup.t0000444000175000017500000000156111266576071013313 0ustar nicknickuse strict; use warnings; use Test::More (tests => 6); use Lchown qw(lchown LCHOWN_AVAILABLE); SKIP: { skip "this system has lchown", 6 if LCHOWN_AVAILABLE; my $uid = $>; my $gid = $) =~ /^(\d+)/; ok( ! defined lchown($uid, $gid), "null lchown call failed" ); like( $!, '/function not implemented/i', "null lchown gave ENOSYS" ); my $symlink_exists = eval { symlink("",""); 1 }; skip "Symlink not supported", 4 if !defined($symlink_exists); symlink 'bar', 'foo' or skip "can't make a symlink", 2; ok( ! defined lchown($uid, $gid, 'foo'), "valid lchown call failed" ); like( $!, '/function not implemented/i', "valid lchown gave ENOSYS" ); unlink 'foo'; ok( ! defined lchown($uid, $gid, 'nosuchfile'), "missing file lchown call failed" ); like( $!, '/function not implemented/i', "file valid lchown gave ENOSYS" ); } Lchown-1.01/t/noimport.t0000444000175000017500000000104211266576071013624 0ustar nicknickuse strict; use warnings; use Test::More (tests => 3); use Lchown (); SKIP: { skip "this system lacks lchown", 3 unless Lchown::LCHOWN_AVAILABLE; skip "not running as root", 3 if $>; symlink 'bar', 'foo' or die "symlink: $!"; my $result = Lchown::lchown 123, 456, 'foo'; is( $result, 1, "Lchown::Lchown prototype works" ); my ($uid,$gid) = (lstat 'foo')[4,5]; is( $uid, 123, "Lchown::lchown foo set uid 123" ); is( $gid, 456, "Lchown::lchown foo set gid 456" ); unlink 'foo' or die "unlink: $!"; } Lchown-1.01/t/pod.t0000444000175000017500000000023411266576071012541 0ustar nicknickuse strict; use warnings; use Test::More; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; all_pod_files_ok(); Lchown-1.01/t/pod-coverage.t0000444000175000017500000000027411266576071014336 0ustar nicknickuse strict; use warnings; use Test::More; eval "use Test::Pod::Coverage 1.00"; plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@; all_pod_coverage_ok(); Lchown-1.01/t/allplatforms.t0000444000175000017500000000022511266576071014457 0ustar nicknickuse strict; use warnings; use Test::More (tests => 2); BEGIN { use_ok('Lchown') } ok( !lchown(9,9,"nosuchfile"), "failed on nonexistent file" ); Lchown-1.01/lib/0000755000175000017500000000000011266576071012100 5ustar nicknickLchown-1.01/lib/Lchown.xs0000444000175000017500000000105311266576071013703 0ustar nicknick#include "EXTERN.h" #include "perl.h" #include "XSUB.h" MODULE = Lchown PACKAGE = Lchown PROTOTYPES: ENABLE SV * lchown(owner, group, ...) unsigned owner unsigned group PROTOTYPE: @ PREINIT: int i; int ok; STRLEN len; CODE: #ifdef HAS_LCHOWN ok = 0; for ( i=2 ; i system call, on platforms that support it. =head1 DEFAULT EXPORTS The following symbols are exported be default: =over =item lchown (LIST) Like the C builtin, but using the C system call so that symlinks will not be followed. Returns the number of files successfully changed. On systems without the C system call, C always returns C and sets C to C (Function not implemented). =back =head1 ADDITIONAL EXPORTS The following symbols are available for export but are not exported by default: =over =item LCHOWN_AVAILABLE () Returns true on platforms with the C system call, and false on platforms without. =back =head1 SEE ALSO L, L =head1 AUTHOR Nick Cleaton Enick@cleaton.netE =head1 COPYRIGHT AND LICENSE Copyright 2003-2009 Nick Cleaton, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut Lchown-1.01/README0000444000175000017500000000164211266576071012213 0ustar nicknickLchown - perl interface to the lchown(2) system call The Lchown module provides a perl interface to the lchown(2) UNIX system call, on systems that support lchown. The lchown(2) call is used to change the ownership and group of symbolic links. DEPENDENCIES The test suite requires the Test::More module, available from CPAN. The oldest perl version that I've tested against is 5.00404. INSTALLATION perl Build.PL ./Build ./Build test ./Build install This module should build and pass tests on systems without the lchown system call. Any lchown call will fail at runtime on such systems. Since the lchown system call often requires root privileges to make any change, most of the tests will be skipped unless "make test" is run as root. Copyright 2003-2009 Nick Cleaton, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Lchown-1.01/Build.PL0000444000175000017500000000067111266576071012630 0ustar nicknickuse strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'Lchown', dist_author => 'Nick Cleaton ', all_from => 'lib/Lchown.pm', license => 'perl', build_requires => { 'ExtUtils::CBuilder' => 0, 'Test::More' => 0, }, add_to_cleanup => [ 'Lchown-*' ], create_makefile_pl => 'small', ); $builder->create_build_script(); Lchown-1.01/Makefile.PL0000444000175000017500000000042311266576071013301 0ustar nicknick# Note: this file was auto-generated by Module::Build::Compat version 0.35 use Module::Build::Compat 0.02; Module::Build::Compat->run_build_pl(args => \@ARGV); require Module::Build; Module::Build::Compat->write_makefile(build_class => 'Module::Build'); Lchown-1.01/Changes0000444000175000017500000000124311266576071012623 0ustar nicknickRevision history for Perl extension Lchown. 1.01 2009-10-18 RT #25968 changed to Module::Build 1.00 Nov 13 2004 now works on perls back to 5.00404 minor code tidy added pod tests 0.07 Jan 02 2004 fixed test failure on platforms without symlinks 0.06 Oct 01 2003 replaced ENOTSUP with the more appropriate ENOSYS 0.05 Sep 30 2003 really added a README this time 0.04 Sep 30 2003 added a README 0.03 Sep 28 2003 tidied docs and Makefile.PL 0.02 Sep 28 2003 got it working and added tests 0.01 Sep 26 2003 original version; created by h2xs 1.19 Lchown-1.01/MANIFEST0000444000175000017500000000027711266576071012467 0ustar nicknickBuild.PL Changes lib/Lchown.pm lib/Lchown.xs MANIFEST This list of files MANIFEST.SKIP README t/allplatforms.t t/noimport.t t/notsup.t t/pod-coverage.t t/pod.t t/sup.t Makefile.PL META.yml Lchown-1.01/META.yml0000444000175000017500000000074311266576071012605 0ustar nicknick--- name: Lchown version: 1.01 author: - 'Nick Cleaton ' abstract: use the lchown(2) system call from Perl license: perl resources: license: http://dev.perl.org/licenses/ build_requires: ExtUtils::CBuilder: 0 Test::More: 0 configure_requires: Module::Build: 0.35 provides: Lchown: file: lib/Lchown.pm version: 1.01 generated_by: Module::Build version 0.35 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 Lchown-1.01/MANIFEST.SKIP0000444000175000017500000000142311266576071013226 0ustar nicknick #!start included /usr/local/share/perl/5.10.0/ExtUtils/MANIFEST.SKIP # Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.gitignore\b \b_darcs\b # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ # Avoid Devel::Cover files. \bcover_db\b #!end included /usr/local/share/perl/5.10.0/ExtUtils/MANIFEST.SKIP # Avoid Module::Build generated and utility files. \bBuild$ \bBuild.bat$ \b_build \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid archives of this distribution \bLchown-[\d\.\_]+