Skip Menu |
Report information
Id: 112272
Status: resolved
Priority: 0/
Queue: perl5

Owner: tonyc <tony [at] develop-help.com>
Requestors: lcons [at] cpan.org
Cc:
AdminCc:

Operating System: mswin32
PatchStatus: (no value)
Severity: High
Type: core
Perl Version: 5.14.2
Fixed In: (no value)



CC: lcons [...] cpan.org
Subject: link() does not return the correct error on existing files (Win32)
Date: Thu, 5 Apr 2012 14:00:44 +0200
To: perlbug [...] perl.org
From: Lionel Cons <lcons [...] cpan.org>
Download (untitled) / with headers
text/plain 3.3k
This is a bug report for perl from lcons@cpan.org, generated with the help of perlbug 1.39 running under perl 5.14.2. This has been seen when using Strawberry Perl on Windows 7. When using the link() built-in to link to an existing file, the function fails and sets $! to EINVAL. On other systems, EEXIST is used. This seems to violate the POSIX standard (http://pubs.opengroup.org/onli nepubs/009695399/functions/link.html) that does not even list EINVAL in its list of possible errors. Note that, in this case, $^E is set to ERROR_ALREADY_EXISTS (Cannot create a file when that file already exists) so the problem may simply bet a mapping between $^E and $!. This has been initially reported as https://rt.cpan.org/Public/Bug/Display.html?id=76324. --- Flags: category=core severity=high --- Site configuration information for perl 5.14.2: Configured by 1 at Tue Nov 22 21:07:24 2011. Summary of my perl5 (revision 5 version 14 subversion 2) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='Win32 strawberryperl 5.14.2.1 #1 Tue Nov 22 21:00:59 2011 i386' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.4.7', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"' libpth=C:\strawberry\c\lib C:\strawberry\c\i686-w64-mingw32\lib libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl514.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"' Locally applied patches: --- @INC for perl 5.14.2: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib . --- Environment for perl 5.14.2: HOME (unset) LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=C:\Program Files\PC Connectivity Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\QuickTime\QTSystem\;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin PERL_BADLANG (unset) PERL_JSON_BACKEND=JSON::XS PERL_YAML_BACKEND=YAML SHELL (unset)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 961b
On Thu Apr 05 05:01:04 2012, lcons@cpan.org wrote: Show quoted text
> This is a bug report for perl from lcons@cpan.org, > generated with the help of perlbug 1.39 running under perl 5.14.2. > > This has been seen when using Strawberry Perl on Windows 7. > > When using the link() built-in to link to an existing file, the > function > fails and sets $! to EINVAL. On other systems, EEXIST is used. > > This seems to violate the POSIX standard > (http://pubs.opengroup.org/onli nepubs/009695399/functions/link.html) > that > does not even list EINVAL in its list of possible errors. > > Note that, in this case, $^E is set to ERROR_ALREADY_EXISTS (Cannot > create a file when that file already exists) so the problem may simply > bet a mapping between $^E and $!. > > This has been initially reported as > https://rt.cpan.org/Public/Bug/Display.html?id=76324.
Tested and fixed by 23629bd37b27c6af15ae899eccd83273eb1353bb and 2b42d7ed85d297655c1e58d1db212901dc38654f. Tony


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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org