A.M.Raportirenko | 1 Jun 10:04

rename-file Invalid argument


This is because unix:unix-resolve-links from unix-glibc2.lisp appends trailing
/ to the directory pathname. What reason in this?

root <at> sunct1 tmp # lisp
CMU Common Lisp 2008-04-02+ (sunct1) (19E), running on sunct1
With core: /opt/local/lib/cmucl/lib/lisp.core
Dumped on: Thu, 2008-04-03 10:12:05+04:00 on sunct1
Send questions and bug reports to your local CMUCL maintainer, 
or see <http://www.cons.org/cmucl/support.html>.
Loaded subsystems:
    Python 1.1, target Intel x86
    CLOS based on Gerd's PCL 2004/04/14 03:32:47
* (unix:unix-file-kind "file.aaa")

:FILE
* (rename-file "file.aaa" "file.bbb")

#P"/opt/tmp/file.bbb"
#P"/opt/tmp/file.aaa"
#P"/opt/tmp/file.bbb"
* (unix:unix-file-kind "directory.aaa")

:DIRECTORY
* (rename-file "directory.aaa" "directory.bbb")

File-error in function RENAME-FILE:
   Failed to rename /opt/tmp/directory.aaa/ 
to /opt/tmp/directory.aaa/directory.bbb: Invalid argument
   [Condition of type KERNEL:SIMPLE-FILE-ERROR]
(Continue reading)

Madhu | 1 Jun 14:52
Favicon

Re: rename-file Invalid argument

  [USUAL PATHNAMES DISCLAIMER: Abandon hope all ye etc. etc. ]

* "A.M.Raportirenko" <200806011208.17857.ram <at> sunct1.jinr.ru> :
Wrote on Sun, 1 Jun 2008 12:08:17 +0400:

| This is because unix:unix-resolve-links from unix-glibc2.lisp appends
| trailing / to the directory pathname. What reason in this?

[If you just want to solve your problem portably, just specify the
absolute directory in the pathname in your call to RENAME-FILE.]

I think the analysis is slightly incorrect and there is a deeper
question here: the question should be whether unix-resolve-links should
be called at all,

[First (use INSPECT to) note that:

 #p"/opt/tmp/directory.aaa/" is a physical pathname which is a
 ``directory'' with :name nil :version nil and :type nil,

 #p"/opt/tmp/directory.aaa" is a physical pathname representing a
 ``file'' with :name "directory" and :type "aaa".

 The directory pathname can be considered to be distinguished by having
 null name version and type components]

| * (rename-file "directory.aaa" "directory.bbb")

 ,---- CLHS RENAME-FILE
 | rename-file filespec new-name => defaulted-new-name, old-truename,
(Continue reading)

Raymond Toy (RT/EUS | 18 Jun 17:26
Favicon

Re: rename-file Invalid argument

Madhu wrote:
[snip]
> 
> 
> | * (rename-file "directory.aaa" "directory.bbb")
> 
>  ,---- CLHS RENAME-FILE
>  | rename-file filespec new-name => defaulted-new-name, old-truename,
>  | new-truename
>  |
>  | rename-file modifies the file system in such a way that the file
>  | indicated by filespec is renamed to defaulted-new-name.
>  |
>  | rename-file returns three values if successful. The primary value,
>  | defaulted-new-name, is the resulting name which is composed of
>  | new-name with any missing components filled in by performing a
>  | merge-pathnames operation using filespec as the defaults. The
>  | secondary value, old-truename, is the truename of the file before it
>  | was renamed. The tertiary value, new-truename, is the truename of the
>  | file after it was renamed.
>   `----
> 
[snip]
> Now the real issue in RENAME-FILE is: should one be calling TRUENAME in
> the first place to come up with the arguments to UNIX:UNIX-RENAME ---
> this is the step that resolves links.  Reading the second line of the
> spec quoted above, it should not.
> 
> The attached patch should fix your problem, and also fix the current
> violation of the clause which says a logical pathname being returned as
(Continue reading)


Gmane