#47 RENAME-FILE :if-does-not-exist does not work

open
5
2012-01-16
2012-01-16
David Brown
No

GNU CLISP 2.49 (2010-07-07) (built on hepworth.siccegge.de [10.70.1.67])

Software: GNU C 4.6.1
gcc -falign-functions=4 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare -Wno-format-nonliteral -O -falign-functions=4 -DENABLE_UNICODE -DDYNAMIC_FFI -DDYNAMIC_MODULES -I. /usr/lib/libreadline.so -lncurses -ldl /usr/lib/libavcall.so /usr/lib/libcallback.so -L/usr/lib -lsigsegv libgnu_cl.a
SAFETY=0 TYPECODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.9
libreadline 5.2
libffcall 1.11
Features:
(READLINE REGEXP SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI GETTEXT
UNICODE BASE-CHAR=CHARACTER WORD-SIZE=64 PC386 UNIX)
C Modules: (clisp i18n syscalls regexp readline)
Installation directory: /usr/lib/clisp-2.49/
User language: ENGLISH
Machine: X86_64 (X86_64) a64.davidb.org [76.88.79.245]
(debian testing build)

[1]> (with-open-file (stream "first.txt" :direction :output :if-does-not-exist :create))
NIL
[2]> (with-open-file (stream "second.txt" :direction :output :if-does-not-exist :create))
NIL
[3]> (rename-file "first.txt" "second.txt" :if-exists :overwrite)

*** - EVAL/APPLY: Too many arguments (4 instead of at most 2) given to RENAME-FILE
The following restarts are available:
ABORT :R1 Abort main loop

Discussion

  • Sam Steingold

    Sam Steingold - 2012-01-16
    • labels: 100543 -->
    • milestone: 100335 -->
     
  • Sam Steingold

    Sam Steingold - 2012-01-16
    • labels: --> Extend ANSI CL
     
  • David Brown

    David Brown - 2012-01-16

    As documented, this does work if custom:*ansi* is nil. However, setting this to nil causes many other things to be different from the ANSI standard.

    So, this can be considered a feature request to either have a setting that allows rename-file to accept the :if-exists argument, or allow it when *ansi* is non-nil.

    Note that, as far as I can tell, all implementations either: 1. always overwrite on renames, or 2. Always allow an :if-exists argument.

    ANSI does not require rename-file to fail if the destination exists. Without it, there is no way to atomically replace a file.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks