Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Test fCmd-9.4 relies on buggy rename implementation

Closed / Fixed219158ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 22 days ago
Descriptionplain2000-10-26 05:02:25
OriginalBugID: 1399 Bug
Version: 8.0.3
SubmitDate: '1999-03-02'
LastModified: '2000-04-03'
Severity: LOW
Status: Assigned
Submitter: pat
ChangedBy: hobbs
OS: Linux-SuSE
OSVersion: + NCR Unix + Siemens Reliant Unix
Machine: Other
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:
Ulrich Schöbel

ReproducibleScript:
Test fCmd-9.4 works on Linux and NCR, but fails on Siemens (Reliant 5.43).

ObservedBehavior:
file rename uses the rename syscall. According to the man page and an ancient
AT&T spec "rename" should fail with EACCES when moving a 555 directory to a new
destination. fCmd-9.4 expects a buggy implementation of "rename".

DesiredBehavior:
Thus, Tcls "file rename" should fail, too.




The solaris docs seem to say the same thing, but it does indeed
work without error on Solaris (as well as Linux and HP)... 
-- 04/03/2000 hobbs
andreas_kupries Ticket [219158ffff]: 1 change [History diff]2001-08-24 05:09:20
vincentdarley Ticket [219158ffff]: 2 changes [History diff]2001-09-18 00:20:25
vincentdarleyplain2002-04-05 00:55:34
Logged In: YES 
user_id=32170

This is not something I am qualified to look into.
dgpplain2002-07-06 03:53:45
Logged In: YES 
user_id=80530

should this be closed as really being "bugs"
in the operating system(s) ?
dgp Ticket [219158ffff]: 1 change [History diff]2003-11-13 05:25:14
vincentdarley Ticket [219158ffff]: 1 change [History diff]2003-11-13 05:53:48
smallmplain2008-02-11 10:14:20
Logged In: YES 
user_id=691174
Originator: NO

OpenBSD 4.2-current also fails on this test when using Tcl 8.5.1.

According to this page below, an implementation has the option to fail 
when the source directory to rename lacks write permission:

http://www.opengroup.org/onlinepubs/009695399/functions/rename.html

"Write access permission is required for the directory containing
old and the directory containing new. If the old argument points
to the pathname of a directory, write access permission may be
required for the directory named by old, and, if it exists, the
directory named by new."
dgpplain2013-03-24 22:10:11
What's the story on BSD systems now?
smallmplain2013-05-07 10:02:36
Using 8.6.0, it still fails for me on openbsd-current dated May 3,
2013 on macppc:

fCmd.test


==== fCmd-9.4.b file rename: comprehensive: dir to new name FAILED
==== Contents of test case:

    file mkdir td1 td2
    testchmod 555 td2
    file rename td1 td3
    file rename td2 td4
    list [lsort [glob td*]] [file writable td3] [file writable td4]

---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: error renaming "td2" to "td4": permission denied
    while executing
"file rename td2 td4"
    ("uplevel" body line 5)
    invoked from within
"uplevel 1 $script"
---- errorCode: POSIX EACCES {permission denied}
==== fCmd-9.4.b FAILED

I tried NetBSD 6.0.1 and DragonFlyBSD 3.3 and it passed in both of those.

Now that I read my comment below, I'm not sure how I thought that
quote applied here. Maybe I missed the word _containing_? Sorry about
that. I wear glasses now.
smallmplain2013-05-08 08:58:43
I was hasty with the last paragraph of this new comment. Of course it was the second sentence of the quote, with the words "write access permission may be required for the directory named by old" that applies here. The younger me wasn't as blind as I thought.
smallmplain2013-05-18 09:57:27
One more thing, this is intentional behaviour on the part of OpenBSD, as recently clarified in their rename(2) man page: http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/sys/rename.2.diff?r1=1.18;r2=1.19

http://marc.info/?l=openbsd-misc&m=136802986314774&w=2
serhiy.storchakawiki2026-10-12 11:18:59

POSIX allows rename() to require write permission for a directory being renamed, and OpenBSD and macOS 10.5 do. Proposed fix in branch fCmd-test-constraints: fCmd-9.4 is split into a test for a writable directory, which runs everywhere, and tests for a read-only directory which expect success or "permission denied" depending on the new constraint renameNeedsDirWrite (OpenBSD, macOS 10.5).

The branch also restores the definition of notWine, see [300724b80c].

jan.nijtmanswiki2026-11-11 10:59:38

Fixed in [trunk] and core-9-0-branch.

Had to add an additional notOSX constraint on fCmd-9.4.2, that's all.

Log in (anonymous is fine) to add a comment.