Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Test-File for openSUSE:Factory checked in at 2023-01-05 15:00:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Test-File (Old) and /work/SRC/openSUSE:Factory/.perl-Test-File.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Test-File" Thu Jan 5 15:00:15 2023 rev:7 rq:1055888 version:1.993 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Test-File/perl-Test-File.changes 2022-02-23 16:25:34.579506955 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Test-File.new.1563/perl-Test-File.changes 2023-01-05 15:00:27.088893329 +0100 @@ -1,0 +2,13 @@ +Tue Jan 3 03:12:26 UTC 2023 - Tina Müller <[email protected]> + +- updated to 1.993 + see /usr/share/doc/packages/perl-Test-File/Changes + + 1.993 2022-12-31T20:33:55Z + * Try harder to check for symlinks on Windows by stealing some code + from Win32:: (Jean-Damien Durand) GitHub #36 + + 1.992_01 2022-11-10T21:59:59Z + * Try harder to test Windows symlinks, #36 from Jean-Damien Durand + +------------------------------------------------------------------- Old: ---- Test-File-1.992.tar.gz New: ---- Test-File-1.993.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Test-File.spec ++++++ --- /var/tmp/diff_new_pack.Xo5mkg/_old 2023-01-05 15:00:27.640896239 +0100 +++ /var/tmp/diff_new_pack.Xo5mkg/_new 2023-01-05 15:00:27.644896260 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-Test-File # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,14 +18,13 @@ %define cpan_name Test-File Name: perl-Test-File -Version: 1.992 +Version: 1.993 Release: 0 License: Artistic-2.0 Summary: Test file attributes URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/B/BD/BDFOY/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml -BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(ExtUtils::MakeMaker) >= 6.64 @@ -56,7 +55,7 @@ %autosetup -n %{cpan_name}-%{version} %build -perl Makefile.PL INSTALLDIRS=vendor +perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" %make_build %check ++++++ Test-File-1.992.tar.gz -> Test-File-1.993.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/Changes new/Test-File-1.993/Changes --- old/Test-File-1.992/Changes 2022-02-15 20:41:26.000000000 +0100 +++ new/Test-File-1.993/Changes 2022-12-31 21:35:16.000000000 +0100 @@ -1,5 +1,12 @@ Revision history for Perl module Test::File +1.993 2022-12-31T20:33:55Z + * Try harder to check for symlinks on Windows by stealing some code + from Win32:: (Jean-Damien Durand) GitHub #36 + +1.992_01 2022-11-10T21:59:59Z + * Try harder to test Windows symlinks, #36 from Jean-Damien Durand + 1.992 2022-02-15T19:40:16Z * GitHub #29 - race condition in tests for mtime, from Slaven ReziÄ. Most people never experienced this timing issue, so if you have this diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/File.xs new/Test-File-1.993/File.xs --- old/Test-File-1.992/File.xs 1970-01-01 01:00:00.000000000 +0100 +++ new/Test-File-1.993/File.xs 2022-12-31 21:34:43.000000000 +0100 @@ -0,0 +1,204 @@ +/* Bare copy of a part of Win32.xs */ +#define WIN32_LEAN_AND_MEAN +#define _WIN32_WINNT 0x0500 +#include <windows.h> + +#define PERL_NO_GET_CONTEXT +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#define GETPROC(fn) pfn##fn = (PFN##fn)GetProcAddress(module, #fn) + +typedef LONG (WINAPI *PFNRegGetValueA)(HKEY, LPCSTR, LPCSTR, DWORD, LPDWORD, PVOID, LPDWORD); + +/* Use explicit struct definition because wSuiteMask and + * wProductType are not defined in the VC++ 6.0 headers. + * WORD type has been replaced by unsigned short because + * WORD is already used by Perl itself. + */ +struct g_osver_t { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + CHAR szCSDVersion[128]; + unsigned short wServicePackMajor; + unsigned short wServicePackMinor; + unsigned short wSuiteMask; + BYTE wProductType; + BYTE wReserved; +} g_osver = {0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0}; +BOOL g_osver_ex = TRUE; + +XS(w32_GetOSVersion) +{ + dXSARGS; + if (items) + Perl_croak(aTHX_ "usage: Win32::GetOSVersion()"); + + if (GIMME_V == G_SCALAR) { + XSRETURN_IV(g_osver.dwPlatformId); + } + XPUSHs(sv_2mortal(newSVpvn(g_osver.szCSDVersion, strlen(g_osver.szCSDVersion)))); + + XPUSHs(sv_2mortal(newSViv(g_osver.dwMajorVersion))); + XPUSHs(sv_2mortal(newSViv(g_osver.dwMinorVersion))); + XPUSHs(sv_2mortal(newSViv(g_osver.dwBuildNumber))); + XPUSHs(sv_2mortal(newSViv(g_osver.dwPlatformId))); + if (g_osver_ex) { + XPUSHs(sv_2mortal(newSViv(g_osver.wServicePackMajor))); + XPUSHs(sv_2mortal(newSViv(g_osver.wServicePackMinor))); + XPUSHs(sv_2mortal(newSViv(g_osver.wSuiteMask))); + XPUSHs(sv_2mortal(newSViv(g_osver.wProductType))); + } + PUTBACK; +} + +XS(w32_GetProcessPrivileges) +{ + dXSARGS; + BOOL ret; + HV *priv_hv; + HANDLE proc_handle, token; + char *priv_name = NULL; + TOKEN_PRIVILEGES *privs = NULL; + DWORD i, pid, priv_name_len = 100, privs_len = 300; + + if (items > 1) + Perl_croak(aTHX_ "usage: Win32::GetProcessPrivileges([$pid])"); + + if (items == 0) { + EXTEND(SP, 1); + pid = GetCurrentProcessId(); + } + else { + pid = (DWORD)SvUV(ST(0)); + } + + proc_handle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); + + if (!proc_handle) + XSRETURN_NO; + + ret = OpenProcessToken(proc_handle, TOKEN_QUERY, &token); + CloseHandle(proc_handle); + + if (!ret) + XSRETURN_NO; + + do { + Renewc(privs, privs_len, char, TOKEN_PRIVILEGES); + ret = GetTokenInformation( + token, TokenPrivileges, privs, privs_len, &privs_len + ); + } while (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER); + + CloseHandle(token); + + if (!ret) { + Safefree(privs); + XSRETURN_NO; + } + + priv_hv = newHV(); + New(0, priv_name, priv_name_len, char); + + for (i = 0; i < privs->PrivilegeCount; ++i) { + DWORD ret_len = 0; + LUID_AND_ATTRIBUTES *priv = &privs->Privileges[i]; + BOOL is_enabled = !!(priv->Attributes & SE_PRIVILEGE_ENABLED); + + if (priv->Attributes & SE_PRIVILEGE_REMOVED) + continue; + + do { + ret_len = priv_name_len; + ret = LookupPrivilegeNameA( + NULL, &priv->Luid, priv_name, &ret_len + ); + + if (ret_len > priv_name_len) { + priv_name_len = ret_len + 1; + Renew(priv_name, priv_name_len, char); + } + } while (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER); + + if (!ret) { + SvREFCNT_dec((SV*)priv_hv); + Safefree(privs); + Safefree(priv_name); + XSRETURN_NO; + } + + hv_store(priv_hv, priv_name, ret_len, newSViv(is_enabled), 0); + } + + Safefree(privs); + Safefree(priv_name); + + ST(0) = sv_2mortal(newRV_noinc((SV*)priv_hv)); + XSRETURN(1); +} + +XS(w32_IsDeveloperModeEnabled) +{ + dXSARGS; + LONG status; + DWORD val, val_size = sizeof(val); + PFNRegGetValueA pfnRegGetValueA; + HMODULE module; + + if (items) + Perl_croak(aTHX_ "usage: Win32::IsDeveloperModeEnabled()"); + + EXTEND(SP, 1); + + /* developer mode was introduced in Windows 10 */ + if (g_osver.dwMajorVersion < 10) + XSRETURN_NO; + + module = GetModuleHandleA("advapi32.dll"); + GETPROC(RegGetValueA); + if (!pfnRegGetValueA) + XSRETURN_NO; + + status = pfnRegGetValueA( + HKEY_LOCAL_MACHINE, + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AppModelUnlock", + "AllowDevelopmentWithoutDevLicense", + RRF_RT_REG_DWORD | KEY_WOW64_64KEY, + NULL, + &val, + &val_size + ); + + if (status == ERROR_SUCCESS && val == 1) + XSRETURN_YES; + + XSRETURN_NO; +} + +MODULE = Test::File PACKAGE = Test::File::Win32 + +PROTOTYPES: DISABLE + +BOOT: +{ + const char *file = __FILE__; + + if (g_osver.dwOSVersionInfoSize == 0) { + g_osver.dwOSVersionInfoSize = sizeof(g_osver); + if (!GetVersionExA((OSVERSIONINFOA*)&g_osver)) { + g_osver_ex = FALSE; + g_osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); + GetVersionExA((OSVERSIONINFOA*)&g_osver); + } + } + + newXS("Test::File::Win32::GetOSVersion", w32_GetOSVersion, file); + newXS("Test::File::Win32::GetProcessPrivileges", w32_GetProcessPrivileges, file); + newXS("Test::File::Win32::IsDeveloperModeEnabled", w32_IsDeveloperModeEnabled, file); + XSRETURN_YES; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/MANIFEST new/Test-File-1.993/MANIFEST --- old/Test-File-1.992/MANIFEST 2022-02-15 20:41:31.000000000 +0100 +++ new/Test-File-1.993/MANIFEST 2023-01-01 14:36:49.000000000 +0100 @@ -1,6 +1,7 @@ Changes CITATION.cff examples/README +File.xs INSTALL.SKIP lib/Test/File.pm LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/MANIFEST.SKIP new/Test-File-1.993/MANIFEST.SKIP --- old/Test-File-1.992/MANIFEST.SKIP 2022-02-15 20:41:26.000000000 +0100 +++ new/Test-File-1.993/MANIFEST.SKIP 2022-12-31 21:34:43.000000000 +0100 @@ -70,3 +70,4 @@ \.icloud$ \A\.github\b +\.gitattributes\b diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/META.json new/Test-File-1.993/META.json --- old/Test-File-1.992/META.json 2022-02-15 20:41:31.000000000 +0100 +++ new/Test-File-1.993/META.json 2023-01-01 14:36:49.000000000 +0100 @@ -4,7 +4,7 @@ "brian d foy <[email protected]>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010", "keywords" : [ "testing", "file" @@ -66,10 +66,10 @@ "homepage" : "https://github.com/briandfoy/test-file", "repository" : { "type" : "git", - "url" : "https://github.com/briandfoy/test-file.git", + "url" : "https://github.com/briandfoy/test-file", "web" : "https://github.com/briandfoy/test-file" } }, - "version" : "1.992", - "x_serialization_backend" : "JSON::PP version 4.06" + "version" : "1.993", + "x_serialization_backend" : "JSON::PP version 4.07" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/META.yml new/Test-File-1.993/META.yml --- old/Test-File-1.992/META.yml 2022-02-15 20:41:30.000000000 +0100 +++ new/Test-File-1.993/META.yml 2023-01-01 14:36:48.000000000 +0100 @@ -10,7 +10,7 @@ ExtUtils::MakeMaker: '6.64' File::Spec::Functions: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010' keywords: - testing - file @@ -37,6 +37,6 @@ resources: bugtracker: https://github.com/briandfoy/test-file/issues homepage: https://github.com/briandfoy/test-file - repository: https://github.com/briandfoy/test-file.git -version: '1.992' + repository: https://github.com/briandfoy/test-file +version: '1.993' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/Makefile.PL new/Test-File-1.993/Makefile.PL --- old/Test-File-1.992/Makefile.PL 2022-02-15 20:41:26.000000000 +0100 +++ new/Test-File-1.993/Makefile.PL 2022-12-31 21:34:43.000000000 +0100 @@ -75,7 +75,7 @@ resources => { repository => { type => 'git', - url => "$github.git", + url => $github, web => $github, }, bugtracker => { @@ -95,6 +95,14 @@ test => { TESTS => 't/*.t t/*/*.t' }, ); +sub MY::dynamic { + # + # No dynamic library unless on MSWin32 + # + package MY; + my ($self) = @_; + $^O eq 'MSWin32' ? $self->SUPER::dynamic : ''; +} sub arguments { \%WriteMakefile } @@ -115,19 +123,5 @@ WriteMakefile( %$arguments ); } -BEGIN { -use ExtUtils::MM_Unix; -package ExtUtils::MM_Unix; - -my $original = \&ExtUtils::MM_Unix::init_dirscan; -no warnings 'redefine'; - -*init_dirscan = sub { - &$original; - delete $_[0]{PM}{'README.pod'}; - $_[0]; - }; -} - no warnings; __PACKAGE__; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/lib/Test/File.pm new/Test-File-1.993/lib/Test/File.pm --- old/Test-File-1.992/lib/Test/File.pm 2022-02-15 20:41:26.000000000 +0100 +++ new/Test-File-1.993/lib/Test/File.pm 2022-12-31 21:34:43.000000000 +0100 @@ -7,6 +7,7 @@ use Exporter qw(import); use File::Spec; use Test::Builder; +use XSLoader; @EXPORT = qw( file_exists_ok file_not_exists_ok @@ -30,7 +31,8 @@ file_mtime_gt_ok file_mtime_lt_ok file_mtime_age_ok ); -$VERSION = '1.992'; +$VERSION = '1.993'; +XSLoader::load(__PACKAGE__, $VERSION) if $^O eq 'MSWin32'; my $Test = Test::Builder->new(); @@ -67,6 +69,8 @@ =head2 Functions +=over 4 + =cut sub _is_plain_file { @@ -103,7 +107,60 @@ } # returns true if symlinks can't exist -sub _no_symlinks_here { ! eval { symlink("",""); 1 } } +BEGIN { + my $cannot_symlink; + + sub _no_symlinks_here { + return $cannot_symlink if defined $cannot_symlink; + + $cannot_symlink = ! do { + eval { + symlink("",""); # symlink exist in perl + _IsSymlinkCreationAllowed() # symlink is ok in current session + } + }; + } + + sub _IsSymlinkCreationAllowed { + if ($^O eq 'MSWin32') { + # + # Bare copy of Perl's Win32::IsSymlinkCreationAllowed but with Test::File::Win32 namespace instead of Win32 + # + my(undef, $major, $minor, $build) = Test::File::Win32::GetOSVersion(); + + # Vista was the first Windows version with symlink support + return !!0 if $major < 6; + + # Since Windows 10 1703, enabling the developer mode allows to create + # symlinks regardless of process privileges + if ($major > 10 || ($major == 10 && ($minor > 0 || $build > 15063))) { + return !!1 if Test::File::Win32::IsDeveloperModeEnabled(); + } + + my $privs = Test::File::Win32::GetProcessPrivileges(); + + return !!0 unless $privs; + + # It doesn't matter if the permission is enabled or not, it just has to + # exist. CreateSymbolicLink() will automatically enable it when needed. + return exists $privs->{SeCreateSymbolicLinkPrivilege}; + } + + 1; + } + +=item has_symlinks + +Returns true is this module thinks that the current system supports +symlinks. + +This is not a test function. It's something that tests can use to +determine what it should expect or skip. + +=cut + + sub has_symlinks { ! _no_symlinks_here() } +} # owner_is and owner_isn't should skip on OS where the question makes no # sense. I really don't know a good way to test for that, so I'm going @@ -124,8 +181,6 @@ return 0; } -=over 4 - =item file_exists_ok( FILENAME [, NAME ] ) Ok if the file exists, and not ok otherwise. @@ -1746,7 +1801,7 @@ This module is in Github: - https://github.com/briandfoy/test-file.git + https://github.com/briandfoy/test-file =head1 AUTHOR @@ -1773,9 +1828,12 @@ Torbjørn Lindahl is working on L<Test2::Tools::File> and we're working together to align our interfaces. +Jean-Damien Durand added bits to use Win32::IsSymlinkCreationAllowed, +new since Win32 0.55. + =head1 COPYRIGHT AND LICENSE -Copyright © 2002-2022, brian d foy <[email protected]>. All rights reserved. +Copyright © 2002-2023, brian d foy <[email protected]>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/t/links.t new/Test-File-1.993/t/links.t --- old/Test-File-1.992/t/links.t 2022-02-15 20:41:26.000000000 +0100 +++ new/Test-File-1.993/t/links.t 2022-12-31 21:34:43.000000000 +0100 @@ -4,9 +4,9 @@ use Test::More 1; use Test::File; -my $can_symlink = eval { symlink("",""); 1 }; +my $can_symlink = Test::File::has_symlinks(); -plan skip_all => "This system does't do symlinks" unless $can_symlink; +plan skip_all => "This system doesn't do symlinks" unless $can_symlink; require "./t/setup_common"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/t/setup_common new/Test-File-1.993/t/setup_common --- old/Test-File-1.992/t/setup_common 2022-02-15 20:41:26.000000000 +0100 +++ new/Test-File-1.993/t/setup_common 2022-12-31 21:34:43.000000000 +0100 @@ -1,6 +1,7 @@ use strict; use Test::More 1; +END{ done_testing() unless caller } use Config; use File::Temp qw(tempdir); @@ -9,7 +10,7 @@ sub is_msys () { scalar grep { lc($^O) eq $_ or lc($Config{osname}) eq $_ } qw( msys msys2 ) } -sub is_win32 () { $^O eq 'MSWin32' } +sub is_win32 () { $^O eq 'MSWin32' } sub is_unix_superuser () { ( not is_win32() and ( $> == 0 or $< == 0 ) ) @@ -17,7 +18,8 @@ ( is_cygwin() and grep { $_ == 544 } split /\s+/, `/usr/bin/id -G` ) } -my $dir = tempdir( CLEANUP => 1 ) or BAIL_OUT( "Could not setup temp directory" ); +my $dir = tempdir( CLEANUP => 0 ) or BAIL_OUT( "Could not setup temp directory" ); +print "Temp dir in <$dir>\n"; unless( -d $dir ) { mkdir 'test_files', 0700 @@ -51,6 +53,9 @@ my $count = chmod 0200, 'writable', 'not_readable', 'zero_file', 'max_file', 'non_zero_file'; is( $count, 5 ) or BAIL_OUT( "Could not make files writable" ); +if( is_win32() ) { + system 'attrib', '+', 'not_readable'; + } } { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-File-1.992/t/test_files.t new/Test-File-1.993/t/test_files.t --- old/Test-File-1.992/t/test_files.t 2022-02-15 20:41:26.000000000 +0100 +++ new/Test-File-1.993/t/test_files.t 2022-12-31 21:34:43.000000000 +0100 @@ -68,11 +68,11 @@ subtest readable_fails => sub { SKIP: { skip "Superuser has special privileges", 2, is_unix_superuser(); - test_out( 'not ok 1 - writeable is readable' ); - test_diag("file [writeable] is not readable"); - test_diag(" Failed test 'writeable is readable'"); + test_out( 'not ok 1 - non_readable is readable' ); + test_diag("file [non_readable] is not readable"); + test_diag(" Failed test 'non_readable is readable'"); test_diag( " at " . __FILE__ . " line " . (__LINE__+1) . "."); - file_readable_ok( 'writeable' ); + file_readable_ok( 'non_readable' ); test_test(); done_testing(); }};
