Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link() does not return the correct error on existing files (Win32) #12038

Closed
p5pRT opened this issue Apr 5, 2012 · 4 comments
Closed

link() does not return the correct error on existing files (Win32) #12038

p5pRT opened this issue Apr 5, 2012 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 5, 2012

Migrated from rt.perl.org#112272 (status was 'resolved')

Searchable as RT112272$

@p5pRT
Copy link
Author

p5pRT commented Apr 5, 2012

From lcons@cpan.org

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)

@p5pRT
Copy link
Author

p5pRT commented May 28, 2012

From @tonycoz

On Thu Apr 05 05​:01​:04 2012, lcons@​cpan.org wrote​:

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 23629bd and
2b42d7e.

Tony

@p5pRT
Copy link
Author

p5pRT commented May 28, 2012

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 28, 2012

@tonycoz - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant