[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[ID 20000114.001] Perl rename function can delete files



This is a bug report for perl from JMoss@HuffmanCorp.com,
generated with the help of perlbug 1.26 running under perl 5.00503.


-----------------------------------------------------------------
[Please enter your report here]

There is a problem with the "rename" function in the latest builds
of ActiveState Perl, dating at least back to build 515.  The system
I'm running is WinNT 4.0 on Intel with Perl 5.005_03 build 521.

If you use "rename" to change the case of a file name on a network
volume the file just gets deleted.

The reason is that code has been added to the "win32_rename" function in
the file "win32.c" to use the "MoveFileEx" function when on WinNT.  The
"MoveFileEx" function is being called with the "MOVEFILE_COPY_ALLOWED"
mask set, and that is incorrect most of the time.

MOVEFILE_COPY_ALLOWED means: (quoting the MSDN documentation)

"If the file is to be moved to a different volume, the function simulates
the move by using the CopyFile and DeleteFile functions."

Therefore if you're just changing the case of the file name the file
gets copied to itself then deleted.  I should note that for some reason
this does not happen on local volumes.

I will be happy to add code to only use this flag when renaming across
volumes if you can tell me where to send it.

                             Jeff Moss


[Please do not change anything below this line]
-----------------------------------------------------------------

---
Site configuration information for perl 5.00503:

Summary of my perl5 (5.0 patchlevel 5 subversion 03) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-object
    uname=''
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cl.exe', optimize='-Od -MD -DNDEBUG -TP -GX', gccversion=
    cppflags='-DWIN32'
    ccflags ='-Od -MD -DNDEBUG -TP -GX -DWIN32 -D_CONSOLE -DNO_STRICT
-DHAVE_DES_FCRYPT -DPERL_OBJECT'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -release
-libpath:"C:\Perl\lib\CORE"  -machine:x86'
    libpth="C:\Perl\lib\CORE" "c:\program files\devstudio\vc\lib"
"c:\program files\devstudio\vc\mfc\lib" "%lib%" 
    libs= oldnames.lib kernel32.lib user32.lib gdi32.lib  winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib  oleaut32.lib netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
PerlCRT.lib
    libc=C:\Perl\lib\CORE\PerlCRT.lib, so=dll, useshrplib=yes,
libperl=perlcore.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-libpath:"C:\Perl\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY

---
@INC for perl 5.00503:
    C:/Perl/lib
    C:/Perl/site/lib
    .

---
Environment for perl 5.00503:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
 
PATH=C:\Perl\bin;C:\WINNT\system32;C:\WINNT;Y:\DLC;Y:\DLC\bin;C:\PROGRA~1\UL
TRAEDT;c:\data\util;c:\program files\devstudio\sharedide\bin\ide;c:\program
files\devstudio\sharedide\bin;c:\program
files\devstudio\vc\bin;y:\syteline;c:\watcom\binnt;c:\watcom\binw
    PERL5OPT=-MWild
    PERLTOOLS=c:\data\util\FortranTools\
    PERL_BADLANG (unset)
    SHELL (unset)


Follow-Ups from:
Gurusamy Sarathy <gsar@ActiveState.com>
Dominic Dunlop <domo@computer.org>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]